pub struct TicTacToeBoard { /* private fields */ }
Expand description
An implementation of the Board
trait for the game of Tic-Tac-Toe.
The board is represented by a 9-element array, where each element corresponds to a cell.
A move is represented by a u8
from 0 to 8.
Trait Implementations§
Source§impl Board for TicTacToeBoard
impl Board for TicTacToeBoard
Source§type Move = u8
type Move = u8
The type representing a move in the game. This could be a simple
u8
for a board position
or a more complex struct for games with intricate actions.Source§fn get_current_player(&self) -> Player
fn get_current_player(&self) -> Player
Returns the player whose turn it is to make a move.
Source§fn get_outcome(&self) -> GameOutcome
fn get_outcome(&self) -> GameOutcome
Returns the current outcome of the game.
Source§fn get_available_moves(&self) -> Vec<Self::Move>
fn get_available_moves(&self) -> Vec<Self::Move>
Returns a list of all legal moves available from the current state.
Source§fn perform_move(&mut self, b_move: &Self::Move)
fn perform_move(&mut self, b_move: &Self::Move)
Applies a given move to the board, modifying its state.
Source§impl Clone for TicTacToeBoard
impl Clone for TicTacToeBoard
Auto Trait Implementations§
impl Freeze for TicTacToeBoard
impl RefUnwindSafe for TicTacToeBoard
impl Send for TicTacToeBoard
impl Sync for TicTacToeBoard
impl Unpin for TicTacToeBoard
impl UnwindSafe for TicTacToeBoard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more