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.
This commit is contained in:
parent
a7102a0e44
commit
76051cd76b
@ -61,11 +61,7 @@ struct Move {
|
|||||||
index: usize,
|
index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Action for Move {
|
impl Action for Move {}
|
||||||
fn id(&self) -> usize {
|
|
||||||
self.index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Tic-Tac-Toe game state
|
/// Tic-Tac-Toe game state
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -84,11 +84,7 @@ struct Move {
|
|||||||
index: usize,
|
index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Action for Move {
|
impl Action for Move {}
|
||||||
fn id(&self) -> usize {
|
|
||||||
self.index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Tic-Tac-Toe game state
|
/// Tic-Tac-Toe game state
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -119,11 +119,7 @@ struct Move {
|
|||||||
index: usize,
|
index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Action for Move {
|
impl Action for Move {}
|
||||||
fn id(&self) -> usize {
|
|
||||||
self.index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Tic-Tac-Toe game state
|
/// Tic-Tac-Toe game state
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -72,10 +72,7 @@ pub trait GameState: Clone + Debug {
|
|||||||
///
|
///
|
||||||
/// An action is dependent upon the specific game being defined, and includes
|
/// An action is dependent upon the specific game being defined, and includes
|
||||||
/// things like moves, attacks, and other decisions.
|
/// things like moves, attacks, and other decisions.
|
||||||
pub trait Action: Clone + Debug {
|
pub trait Action: Clone + Debug {}
|
||||||
/// Returns a uniqie identifier for this action
|
|
||||||
fn id(&self) -> usize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Trait used for players participating in a game
|
/// Trait used for players participating in a game
|
||||||
pub trait Player: Clone + Debug + PartialEq + Eq + Hash {}
|
pub trait Player: Clone + Debug + PartialEq + Eq + Hash {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user