Skip to content

Commit d8ea8b4

Browse files
committed
Add MCTS engine implementation and benchmark legal moves script improvements
- Introduced a new Jupyter notebook for MCTS engine implementation, including neural network architecture, MCTS node structure, and engine logic. - Implemented MCTS engine with batch evaluation and move selection strategies. - Enhanced benchmark_legal_moves.py to stabilize CPU frequency during measurements and allow multiple iterations for more reliable timing results. - Updated CPU affinity settings to use a less busy core and removed unnecessary Windows-specific priority settings.
1 parent e057932 commit d8ea8b4

File tree

7 files changed

+2990
-56
lines changed

7 files changed

+2990
-56
lines changed

draughts/move.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def __add__(self, other: Move) -> Move:
108108
move._len = len(new_captured) + 1
109109
return move
110110

111+
def __hash__(self) -> int:
112+
"""Hash based on the move path (start and end squares)."""
113+
return hash((self.square_list[0], self.square_list[-1]))
114+
111115
@classmethod
112116
def from_uci(cls, move: str, legal_moves: Iterable["Move"]) -> "Move":
113117
"""

examples/ai.ipynb

Lines changed: 757 additions & 19 deletions
Large diffs are not rendered by default.

examples/best_draughts_model.pt

19.2 MB
Binary file not shown.

examples/best_model.pt

19.2 MB
Binary file not shown.

0 commit comments

Comments
 (0)