Check&Mate is an online multiplayer chess game where players who wish to play the game are set to stake some amount of tokens(Crypto assets) before the start of a game.
A player who wishes to create a match begins with staking their share of desired tokens of any amount.After the successful transaction, a unique url for that game is generated allowing the creator to invite another player to join the game or share it with friends.
The Invitation link to join the game is created using socket programming where a unique room is created for every game allowing only 2 players to join per game.
After receiving the invitation link from Player 1, player 2 has to at least match the valuation of there desired tokens with the USD equivalent of what player 1 had staked while creating the game.This condition must be satisfied in order to start the game.
Every player is provided with a list of tokens (list includes tokens like WETH,DAI,LINK,WMATIC currently the most popular tokens on polygon) , from which a player has to select any one token for staking.
If no players were willing to join the game after it had been created, the creator is allowed to withdraw there staked tokens.
To provide some assistance, all possible valid moves for all pieces are shown within the chessboard everytime a player hovers over any piece.Players can also have a look at all the previously made moves within the game to analyze the game better .
After a checkmate is identified , the winner is allowed to retrieve the winning payout i.e all the tokens staked by both players over that game.
Technologies used
Discussion