summaryrefslogtreecommitdiff
path: root/src/neural-player.rs
diff options
context:
space:
mode:
authorDylan <boss@tehbox.org>2026-11-09 16:17:04 +1300
committerDylan <boss@tehbox.org>2026-11-09 16:17:04 +1300
commit0fd43eb6d9a4bae8d4c29fd614f9cf2a362f7b7c (patch)
treeeb926ba3fbc0dcde9717509e9fa02cc79a3679f9 /src/neural-player.rs
parent046969c820e89b74d55c2d07c47470237f11cc2a (diff)
downloadtigers-and-sheep-0fd43eb6d9a4bae8d4c29fd614f9cf2a362f7b7c.tar.gz
tigers-and-sheep-0fd43eb6d9a4bae8d4c29fd614f9cf2a362f7b7c.zip
feat: Draw by threefold repetition
A position coming up for the third time with the same side to move ends the game as a draw, in the TUI and in training self-play. Players now get the game's earlier boards in pick_move, and the search scores the first repetition on its path as a draw, so a side that is ahead avoids one and a side that is behind seeks one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/neural-player.rs')
-rw-r--r--src/neural-player.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/neural-player.rs b/src/neural-player.rs
index 3a9c4a0..f7e54c7 100644
--- a/src/neural-player.rs
+++ b/src/neural-player.rs
@@ -59,10 +59,10 @@ mod tests
let mut player = NeuralPlayer::new(Network::random(2), Duration::from_secs(3600), 12);
player.max_depth = 3;
let board = GameBoard::default();
- let m = player.pick_move(board, Turn::Sheep).unwrap();
+ let m = player.pick_move(board, Turn::Sheep, &[]).unwrap();
assert_eq!(board.check_move(m), Ok(()));
let report = player.last_search.expect("a report");
assert_eq!((report.mv, report.depth), (m, 3));
- assert_eq!(report.score, player.minimax(board, Turn::Sheep, 3, f32::NEG_INFINITY, f32::INFINITY, None).unwrap());
+ assert_eq!(report.score, player.minimax(board, Turn::Sheep, 3, f32::NEG_INFINITY, f32::INFINITY, None, &mut Vec::new()).unwrap());
}
}