Struct magpie::othello::BoardDisplay
source · pub struct BoardDisplay<'a> { /* private fields */ }
Expand description
Helper struct to customize the printing of Othello boards.
Printing and thus visualizing the board is useful for both debugging. The output can be customized by choosing formatting options and whether or not legal moves should be shown for a specific player.
§Examples
use magpie::othello::{Format, Board, Stone};
let board = Board::standard();
println!("{}", board.display());
println!("{}", board.display().with_format(Format::Compact));
println!("{}", board.display().with_stone(Stone::Black));
println!(
"{}",
board
.display()
.with_stone(Stone::White)
.with_format(Format::Standard)
);
Implementations§
source§impl<'a> BoardDisplay<'a>
impl<'a> BoardDisplay<'a>
sourcepub fn with_stone(&self, stone: Stone) -> Self
pub fn with_stone(&self, stone: Stone) -> Self
Displays the board with the legal moves for the specified stone.
§Examples
use magpie::othello::{Board, Stone};
let board = Board::standard();
println!("{}", board.display().with_stone(Stone::Black));
sourcepub fn with_format(&self, display: Format) -> Self
pub fn with_format(&self, display: Format) -> Self
Displays the board with the specified formatting.
§Examples
use magpie::othello::{Format, Board};
let board = Board::standard();
println!("{}", board.display().with_format(Format::Compact));
Trait Implementations§
source§impl<'a> Clone for BoardDisplay<'a>
impl<'a> Clone for BoardDisplay<'a>
source§fn clone(&self) -> BoardDisplay<'a>
fn clone(&self) -> BoardDisplay<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a> Freeze for BoardDisplay<'a>
impl<'a> RefUnwindSafe for BoardDisplay<'a>
impl<'a> Send for BoardDisplay<'a>
impl<'a> Sync for BoardDisplay<'a>
impl<'a> Unpin for BoardDisplay<'a>
impl<'a> UnwindSafe for BoardDisplay<'a>
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