Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the threefold repetition rule using incremental transposition tables #1

Open
i13e opened this issue Apr 16, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@i13e
Copy link
Owner

i13e commented Apr 16, 2023

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:

  1. Add a new transposition table for storing positions and their repetition counts.
  2. Update the move generator to check whether a move would result in a repeated position.
  3. Increment the repetition count in the transposition table whenever a position occurs for the second time.
  4. 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.

@i13e i13e added the enhancement New feature or request label Apr 28, 2023
@i13e i13e self-assigned this Apr 28, 2023
@i13e i13e added this to the 1.0 milestone Aug 5, 2023
@i13e i13e removed this from the 1.0 milestone Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant