From eed303e58f73264bc90e8db86ced115c246ebec0 Mon Sep 17 00:00:00 2001 From: David Kruger Date: Mon, 30 Jun 2025 20:18:29 -0700 Subject: [PATCH] Removing the id field from the Action trait This would in theory be useful for a transposition table, but we do not currently support that. As such I don't want to burden the implementation with that field until it is deemed necessary. --- examples/auto_tic_tac_toe.rs | 6 +----- examples/tic_tac_toe.rs | 6 +----- src/state.rs | 5 +---- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/examples/auto_tic_tac_toe.rs b/examples/auto_tic_tac_toe.rs index b6a5387..1183ea5 100644 --- a/examples/auto_tic_tac_toe.rs +++ b/examples/auto_tic_tac_toe.rs @@ -84,11 +84,7 @@ struct Move { index: usize, } -impl Action for Move { - fn id(&self) -> usize { - self.index - } -} +impl Action for Move {} /// Tic-Tac-Toe game state #[derive(Clone)] diff --git a/examples/tic_tac_toe.rs b/examples/tic_tac_toe.rs index 263b5c7..c0bc3ec 100644 --- a/examples/tic_tac_toe.rs +++ b/examples/tic_tac_toe.rs @@ -119,11 +119,7 @@ struct Move { index: usize, } -impl Action for Move { - fn id(&self) -> usize { - self.index - } -} +impl Action for Move {} /// Tic-Tac-Toe game state #[derive(Clone)] diff --git a/src/state.rs b/src/state.rs index 747063c..2048962 100644 --- a/src/state.rs +++ b/src/state.rs @@ -72,10 +72,7 @@ pub trait GameState: Clone + Debug { /// /// An action is dependent upon the specific game being defined, and includes /// things like moves, attacks, and other decisions. -pub trait Action: Clone + Debug { - /// Returns a uniqie identifier for this action - fn id(&self) -> usize; -} +pub trait Action: Clone + Debug {} /// Trait used for players participating in a game pub trait Player: Clone + Debug + PartialEq + Eq + Hash {}