Struct zero_sum::impls::tak::State
[−]
[src]
pub struct State { pub p1_flatstones: u8, pub p1_capstones: u8, pub p2_flatstones: u8, pub p2_capstones: u8, pub board: Vec<Vec<Vec<Piece>>>, pub ply_count: u16, // some fields omitted }
The state of the game.
Fields
p1_flatstones: u8
Player 1's remaining flatstones.
p1_capstones: u8
Player 1's remaining capstones.
p2_flatstones: u8
Player 2's remaining flatstones.
p2_capstones: u8
Player 2's remaining capstones.
board: Vec<Vec<Vec<Piece>>>
The board of pieces.
ply_count: u16
The number of half-moves passed since the start.
Methods
impl State
[src]
fn new(board_size: usize) -> State
Creates a blank state of the specified board size.
Panics
This function panics if it is passed a board size less than 3 or greater than 8.
fn from_plies(size: usize, plies: &[Ply]) -> Result<State, String>
Creates a state from the given board size and executes the given plies.
fn from_tps(tps: &str) -> Option<State>
Creates a state from a string in TPS format, i.e. "[TPS \"x5/x5/x5/x5/x5 1 1\"]"
.
Returns None
if the provided string has an error.
fn to_tps(&self) -> String
Trait Implementations
impl Extrapolatable<Ply> for State
[src]
fn extrapolate(&self) -> Vec<Ply>
Returns a list of plies that should be considered from the current state. The search system does not assume that all plies returned are correct. Read more
impl State for State
[src]
type Ply = Ply
type Resolution = Resolution
fn get_ply_count(&self) -> usize
Returns the number of plies that have passed in the game.
fn execute_ply(&mut self, ply: Option<&Ply>) -> Result<(), String>
Executes the given ply on this state. Pass None
to execute a null move.
fn revert_ply(&mut self, ply: Option<&Ply>) -> Result<(), String>
Reverts the given ply from the state. Pass None
to revert a null move.
fn check_resolution(&self) -> Option<Resolution>
Returns None
if the game has not reached a conclusion.
fn null_move_allowed(&self) -> bool
Returns true if the state is in a good place to allow the null move search optimization. This is optional to implement, returning a default of false
. Read more
fn execute_plies(&mut self, plies: &[Self::Ply]) -> Result<(), String>
Executes each ply in plies
on the result of the previous ply.
impl Debug for State
[src]
impl Eq for State
[src]
impl PartialEq for State
[src]
fn eq(&self, __arg_0: &State) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &State) -> bool
This method tests for !=
.
impl Clone for State
[src]
fn clone(&self) -> State
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &State)
Performs copy-assignment from source
. Read more
impl Hash for State
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more