| 4 allowing for playing chess with other clients that implement the same protocol. |
4 allowing for playing chess with other clients that implement the same protocol. |
| 5 |
5 |
| 6 This document describes the protocol in detail, including the message formats |
6 This document describes the protocol in detail, including the message formats |
| 7 and the expected behavior of clients and the server. |
7 and the expected behavior of clients and the server. |
| 8 |
8 |
| 9 The current protocol version is 24. |
9 The current protocol version is 25. |
| 10 |
10 |
| 11 ## Message Format |
11 ## Message Format |
| 12 |
12 |
| 13 The terminal-chess network protocol has two different message types: |
13 The terminal-chess network protocol has two different message types: |
| 14 |
14 |
| 164 50 moves without any captures or pawn moves. |
164 50 moves without any captures or pawn moves. |
| 165 |
165 |
| 166 The game MAY be ended at any time by any (including the waiting) player by |
166 The game MAY be ended at any time by any (including the waiting) player by |
| 167 [resignation](#resign). |
167 [resignation](#resign). |
| 168 |
168 |
| |
169 The game MAY also be ended after by agreeing on a [draw](#offer-a-draw). |
| |
170 |
| 169 #### Checkmate |
171 #### Checkmate |
| 170 |
172 |
| 171 Whe the active player determines they were checkmated with the last move, |
173 Whe the active player determines they were checkmated with the last move, |
| 172 they SHALL send a `CHECKMATE` message to the waiting player. |
174 they SHALL send a `CHECKMATE` message to the waiting player. |
| 173 When receiving such a message, the waiting player SHALL end the game without |
175 When receiving such a message, the waiting player SHALL end the game without |
| 213 When a player receives a `RESIGN` message, they SHALL end the game without |
215 When a player receives a `RESIGN` message, they SHALL end the game without |
| 214 any further confirmation. |
216 any further confirmation. |
| 215 |
217 |
| 216 ### Offer a Draw |
218 ### Offer a Draw |
| 217 |
219 |
| 218 _TODO: draw offers by the active player are bugged - see issue #980_ |
|
| 219 |
|
| 220 _TODO: the description is very confusing and should be cleaned up after fixing issue #980_ |
|
| 221 |
|
| 222 Both the active and the waiting player MAY send a `REMIS` message any time to |
220 Both the active and the waiting player MAY send a `REMIS` message any time to |
| 223 offer a draw. |
221 offer a draw. |
| 224 |
222 |
| 225 When the waiting player receives such an offer, they MAY choose to answer it |
223 When both players have sent a `REMIS` message to the other player within the |
| 226 with either an `ACCEPT` or a `DECLINE` message. |
224 same move, the draw is agreed upon and both players SHALL end the game. |
| 227 |
225 |
| 228 When the offer was accepted, both players SHALL end the game. |
226 Playing a move SHALL revoke any draw offers. |
| 229 Otherwise, they SHALL continue playing. |
|
| 230 When an offer was declined, the requesting player SHOULD NOT send another offer |
|
| 231 for the same position. |
|
| 232 |
|
| 233 When the active player receives such an offer, they MAY ignore it. |
|
| 234 No confirmation is sent. |
|
| 235 Instead, if the player chooses to accept the offer, they SHALL send a `REMIS` |
|
| 236 message on their own. |
|
| 237 |
227 |
| 238 ### Propose Resignation |
228 ### Propose Resignation |
| 239 |
229 |
| 240 The waiting player MAY propose resignation by sending a `TAUNT` message. |
230 The waiting player MAY propose resignation by sending a `TAUNT` message. |
| 241 |
231 |