There already have many tictactoe project in other blockchain platform. Now I just want to build very very simple flow of that game to run on zilliqa platform.
The compact features:
- Host always go first.
- Don’t tracking move.
- Don’t have server or contract to notify who are online and ready for match.
- No bet.
The flow will like:
Alicehost new contract.
Alicechange contract status top open. (need this step because contract state was empty until it has a transaction)
Alicegive the contract address to
Bobby some way.
Alicecontract to his list.
Bobclicked join and waiting for
- Change to game screen.
- If game ended, contract status will be changed to close.
- contract TicTacToe(owner: ByStr20, checksum: String)
- transition changeOpenStatus (b: Bool)
- transition join (mess: String)
- transition acceptChallenge ()
- transition move (slot : Uint32)
- transition refuseChallenge ()
- I has bundled @zilliqa-js with some adapt to make it work on cocos environment (both native app and web).
- The encrypted json of account was be store inside app. My design is create new one then send some zils from main account. In worst case like some one hack my hosting and inject some bad code, you won’t loss everything.
- Each player will deploy their own contract. Send it address to friends by hand.
- To make sure 2 players are using same contract (it mean same client version). I include the checksum of code in init call. If the code in hosing side was changed game will show out of date and require deploy new one. If the code in challenger was out of date, we won’t send the challenge.