src/chess/rules.c

changeset 218
1e9751f8eb0d
parent 216
d0c3d3016650
equal deleted inserted replaced
217:507490519676 218:1e9751f8eb0d
101 101
102 return simulation; 102 return simulation;
103 } 103 }
104 104
105 Color current_color(const GameState *gamestate) { 105 Color current_color(const GameState *gamestate) {
106 return (gamestate->movecount % 2 == 0) ? WHITE : BLACK; 106 // TODO: better would be an API that returns the correct number
107 unsigned mc = gamestate->movecount + gamestate->move_start;
108 return (mc % 2 == 0) ? WHITE : BLACK;
107 } 109 }
108 110
109 static void calc_movetime(GameState *gamestate, Move *move) { 111 static void calc_movetime(GameState *gamestate, Move *move) {
110 /* only if move has no time info, compute it */ 112 /* only if move has no time info, compute it */
111 if (move->movetime > 0) return; 113 if (move->movetime > 0) return;

mercurial