pub struct Board([bool; 33]);Expand description
A solitaire board represented as a densely packed array of 33 booleans.
Tuple Fields§
§0: [bool; 33]Implementations§
Trait Implementations§
Source§impl ArrayBoard for Board
impl ArrayBoard for Board
const ROW_START_IDX: [usize; 7]
Source§fn get_idx(&self, idx: usize) -> bool
fn get_idx(&self, idx: usize) -> bool
Gets the value of the board at the given index. Read more
Source§fn set_idx(&mut self, idx: usize, value: bool) -> bool
fn set_idx(&mut self, idx: usize, value: bool) -> bool
Sets the value of the board at the given index and returns the old
value. Read more
const ROW_LENGTH: [usize; 7] = _
Source§impl Board for Board
impl Board for Board
Source§fn get(&self, [x, y]: [isize; 2]) -> Option<bool>
fn get(&self, [x, y]: [isize; 2]) -> Option<bool>
Gets the value of the board at the given (x, y) location, where (0, 0) is
the top left corner. Returns None if the location is invalid.
Source§fn set(&mut self, idx: [isize; 2], value: bool) -> Option<bool>
fn set(&mut self, idx: [isize; 2], value: bool) -> Option<bool>
Sets the value of the board at the given (x, y) location, where (0, 0)
is the top left corner. Returns the old value, or None if the location
is invalid.
Source§fn get_legal_moves(&self) -> Vec<Self>
fn get_legal_moves(&self) -> Vec<Self>
Gets all legal moves from the current board state. A move is legal if it
consists of a marble jumping over an adjacent marble into an empty
space, and the jumped-over marble is removed.
Source§fn marble_count(&self) -> u32
fn marble_count(&self) -> u32
Counts the number of marbles currently on the board.
fn mirror_horizontal(&self) -> Self
fn mirror_vertical(&self) -> Self
fn transpose(&self) -> Self
Source§fn is_solved(&self) -> bool
fn is_solved(&self) -> bool
Checks if the board is in a solved state, meaning that there is only one
marble left.
Source§fn get_symmetries(&self) -> [Self; 8]
fn get_symmetries(&self) -> [Self; 8]
Returns an array of all 8 symmetries of the board, including the board
itself. The symmetries are generated by mirroring horizontally,
mirroring vertically, and transposing the board in all combinations.
impl Copy for Board
impl Eq for Board
impl StructuralPartialEq for Board
Auto Trait Implementations§
impl Freeze for Board
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnsafeUnpin for Board
impl UnwindSafe for Board
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