Try it out: https://near.org/ostolex.near/widget/CastleDice
- This repo with game's front-end written with Phaser3
- Front-end deployed to S3 bucket
- Solidity contract deployed on Aurora mainnet. Contract address: 0xdABc474d726FBaBB8fE5FAb4D10D9fF1601fc7e4
- BOS components
- Castledice frontend repo
- Castledice smart-contract repo
- Cadtledice frontend on BOS repo
- CastlediceOnline widget
- CastleDice widget
- CastlediceWaitingRoom
-
createRoom(address[] players) -> int, creates a room and returns the room ID.
-
makeMove(int roomId, int row, int col) -> int, validates and makes a move if it is valid, returns the remaining number of action points for the player (when the player changes, it returns the number of action points for the new player, not 0).
-
getBoardArray(int roomId) -> int[], returns an array representing the current state of the game board, where 0 represents an empty cell, 1 represents the first (blue) player (top-left corner, first element of the array), 2 represents the red player (last element of the array), and 3 represents a tree.
-
getCurrentPlayerIndex(int roomId) -> int, returns the index of the current player in the players array provided during room creation.
-
getCurrentPlayerMovesLeft(int roomId) -> int, returns the number of moves (action points) remaining for the current player.
-
isGameFinished(int roomId) -> checks if the game has ended.
-
getGameWinner(int roomId) -> returns the address of the winner if the game has ended (if not, it reverts, so it's better to check first).
-
getRoomIdByAddress(address player) -> (uint256) obtains the ID of the room in which a user is located based on their address.
-
getMyIndex(int roomId) -> int, returns player index (first player or second) of a method caller for the specific room.