| 1133 |
1133 |
| 1134 bool check_threefold_repetition(const GameState *gamestate) { |
1134 bool check_threefold_repetition(const GameState *gamestate) { |
| 1135 // TODO: implement threefold repetition detection |
1135 // TODO: implement threefold repetition detection |
| 1136 return false; |
1136 return false; |
| 1137 } |
1137 } |
| |
1138 |
| |
1139 size_t filter_moves_allowed(GameState *gamestate, |
| |
1140 Color c, Row r, File f, Move *moves, moves_generator_func func) { |
| |
1141 |
| |
1142 /* worst case: the queen has the most moves */ |
| |
1143 Move candidates[QUEEN_MOVES_MAX]; |
| |
1144 size_t candidatecount = func(gamestate, c, r, f, candidates); |
| |
1145 size_t count = 0; |
| |
1146 |
| |
1147 for (size_t i = 0 ; i < candidatecount ; i++) { |
| |
1148 if (validate_move(gamestate, &candidates[i]) == VALID_MOVE_SEMANTICS) { |
| |
1149 moves[count++] = candidates[i]; |
| |
1150 } |
| |
1151 } |
| |
1152 |
| |
1153 return count; |
| |
1154 } |