| 94 char string[8]; |
94 char string[8]; |
| 95 } Move; |
95 } Move; |
| 96 |
96 |
| 97 typedef struct { |
97 typedef struct { |
| 98 uint8_t servercolor; |
98 uint8_t servercolor; |
| |
99 /** 1: play with timecontrol, 0: play without time control */ |
| 99 uint8_t timecontrol; |
100 uint8_t timecontrol; |
| |
101 /** If timecontrol is 1, initial clock time in seconds */ |
| 100 uint16_t time; |
102 uint16_t time; |
| |
103 /** If timecontrol is 1, time added per move in seconds */ |
| 101 uint16_t addtime; |
104 uint16_t addtime; |
| |
105 /** If timecontrol is 1, delay before the clock starts ticking down */ |
| |
106 uint16_t delay; |
| 102 } GameInfo; |
107 } GameInfo; |
| 103 |
108 |
| 104 /** The buffer length for player names in GameInfo structures. */ |
109 /** The buffer length for player names in GameState structures. */ |
| 105 #define PLAYER_NAME_BUFLEN 32 |
110 #define PLAYER_NAME_BUFLEN 32 |
| 106 |
111 |
| 107 typedef struct { |
112 typedef struct { |
| |
113 GameInfo info; |
| 108 Board board; |
114 Board board; |
| 109 Move* moves; |
115 Move* moves; |
| 110 /** optional name of the white player */ |
116 /** optional name of the white player */ |
| 111 char wname[PLAYER_NAME_BUFLEN]; |
117 char wname[PLAYER_NAME_BUFLEN]; |
| 112 /** optional name of the black player */ |
118 /** optional name of the black player */ |
| 361 |
367 |
| 362 /** |
368 /** |
| 363 * Returns the remaining time on the clock for the specified |
369 * Returns the remaining time on the clock for the specified |
| 364 * half-move number. |
370 * half-move number. |
| 365 * |
371 * |
| 366 * @param gameinfo the information about the game |
|
| 367 * @param gamestate the current game state |
372 * @param gamestate the current game state |
| 368 * @param move_number the half-move that is now going to be played |
373 * @param move_number the half-move that is now going to be played |
| 369 * @return the remaining time - if time control is disabled, this function |
374 * @return the remaining time - if time control is disabled, this function |
| 370 * always returns zero |
375 * always returns zero |
| 371 */ |
376 */ |
| 372 uint16_t remaining_movetime2(GameInfo *gameinfo, GameState *gamestate, |
377 uint16_t remaining_movetime2(GameState *gamestate, unsigned move_number); |
| 373 unsigned move_number); |
|
| 374 |
378 |
| 375 /** |
379 /** |
| 376 * Returns the remaining time on the clock for the specified player. |
380 * Returns the remaining time on the clock for the specified player. |
| 377 * |
381 * |
| 378 * @param gameinfo the information about the game |
|
| 379 * @param gamestate the current game state |
382 * @param gamestate the current game state |
| 380 * @param color either BLACK or WHITE |
383 * @param color either BLACK or WHITE |
| 381 * @return the remaining time - if time control is disabled, this function |
384 * @return the remaining time - if time control is disabled, this function |
| 382 * always returns zero |
385 * always returns zero |
| 383 */ |
386 */ |
| 384 uint16_t remaining_movetime(GameInfo *gameinfo, GameState *gamestate, |
387 uint16_t remaining_movetime(GameState *gamestate, uint8_t color); |
| 385 uint8_t color); |
|
| 386 |
388 |
| 387 /** |
389 /** |
| 388 * Converts clock time to string. |
390 * Converts clock time to string. |
| 389 * |
391 * |
| 390 * @param time the time to format |
392 * @param time the time to format |