Secure Battleship Game #25
Envoy-VC
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
BattleshipX is a secure and private battleship game that can be played with friends.
Showcase Link: https://ethglobal.com/showcase/battleshipx-0gc9h
How nillion is used?
While storing the secret game state in nillion, it is stored as follows:
where each number is 1XY where X is the row number and Y is the column number. The game state is stored in nillion in encrypted form. X and Y are in range of 0-9.
Why extra 1 at start? The extra 1 is added to make the number 3 digit as zero at the X position will be ignored by the game logic.
When a user attacks a position, the user sends the position to the contract.
For Example: User attacks position 7, 5. The contract will compute the attack with position 175, the computation starts at 1 and multiplies it by (value - position)
This is done through Array.reduce method. The logic is if there is a ship at that position, somewhere in the computation value == position and the result becomes 0. If the result is 0, the user has hit the ship.
Here is the entire nada program
The entre nillion methods are served through a FastAPI Server created in Python
https://github.com/Envoy-VC/battleship-x/tree/main/packages/api
Beta Was this translation helpful? Give feedback.
All reactions