From 76051cd76bc889e7f97031ca87932c058550137f 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. --- benches/e2e.rs | 6 +----- examples/auto_tic_tac_toe.rs | 6 +----- examples/tic_tac_toe.rs | 6 +----- src/state.rs | 5 +---- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/benches/e2e.rs b/benches/e2e.rs index f3c0499..b8f27a8 100644 --- a/benches/e2e.rs +++ b/benches/e2e.rs @@ -61,11 +61,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(Debug, Clone)] 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 {}