Chess on Ethereum
Ongoing games
About
Ethereum contract for playing chess. Deployed to ropsten testnet. 0xB789679bC74Df60378b506FDB83ce0C26e3f2c0D You can use ethereum faucet to get free ether for the testnet.How to play
Use the startGame(fromIndex, toIndex) to start a new game against the creator of the contract (=me). After this both players use move(fromIndex, toIndex, gameId) to make the next move. GameId is the same as the address of the player who started the game
The rules of the chess are coded in the contract and is based on this project . You should not be able to make an invalid move as such transactions are reverted.
The ABI of the contractContract addres
The from_index and to_index parameters uses 0x88 presentation. This mean you have to use the following table to convert the positions
A | B | C | D | E | F | G | H | |
---|---|---|---|---|---|---|---|---|
8 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
7 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
6 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
5 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
4 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
3 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |
2 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |
1 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |
So for instance, to start the game with move d2-d4, you would call startContract(99, 67)
After this black could reply with d7-d5, which would mean move(19, 51)
I think the easiest way to play is to use MyEtherWallet and use the "interact with contract" feature. You need to provide the ABI and the address in order to interact.