-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently, Osmanthus does not support the threefold repetition rule, which states that a player can claim a draw if the same position occurs three times with the same player to move. While Python's chess library has support for this rule (see here), it is slow because it does not use incremental transposition tables.
To improve the performance of the engine, we should add support for the threefold repetition rule using incremental transposition tables. This would allow us to quickly check whether a position has occurred three times in the game and avoid recomputing the same position repeatedly.
Specifically, we should implement the following changes:
- Add a new transposition table for storing positions and their repetition counts.
- Update the move generator to check whether a move would result in a repeated position.
- Increment the repetition count in the transposition table whenever a position occurs for the second time.
- If a position occurs for the third time, the player can claim a draw.
By implementing these changes, we can ensure that Osmanthus correctly handles the threefold repetition rule while maintaining good performance.