summaryrefslogtreecommitdiff
path: root/src/game.rs
diff options
context:
space:
mode:
authorDylan <boss@tehbox.org>2026-11-05 13:46:28 +1300
committerDylan <boss@tehbox.org>2026-11-05 13:46:28 +1300
commit94f3df190a91898eb344b9214a57eb31792bcb1c (patch)
treedb123ed498e84453d89da4df99253e56e6ded259 /src/game.rs
parent8b6323efba32da9e3651ce882c02a6e7a6671f23 (diff)
downloadtigers-and-sheep-94f3df190a91898eb344b9214a57eb31792bcb1c.tar.gz
tigers-and-sheep-94f3df190a91898eb344b9214a57eb31792bcb1c.zip
feat: Neural network opponent trained by self-play
- NeuralPlayer: a MinimaxPlayer that scores positions with a small MLP (network.rs, hand-written backprop and Adam, no new dependencies) - train subcommand: self-play with TD(lambda) targets, cut at random exploration moves so sheep blunders don't bias the net towards tigers - neural subcommand: play against a trained network - evaluate now gets the side to move - Board symmetries; the search cache keys by the canonical board, which halves the depth-9 bench time with identical moves and scores Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/game.rs')
-rw-r--r--src/game.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/game.rs b/src/game.rs
index 11a77fd..5aef809 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -87,7 +87,7 @@ impl GameHandler
/// Play in the terminal with `p1` as the sheep and `p2` as the tigers, until someone wins and
/// the user quits. Returns the winner, or None if the user quit before the game was won.
- pub fn play_game<T1: Player, T2: Player>(&mut self, p1: &mut T1, p2: &mut T2) -> io::Result<Option<Turn>>
+ pub fn play_game(&mut self, p1: &mut dyn Player, p2: &mut dyn Player) -> io::Result<Option<Turn>>
{
let mut terminal = ratatui::init();
let result = execute!(io::stdout(), EnableMouseCapture)