diff options
Diffstat (limited to 'model/src/possible_moves.rs')
| -rw-r--r-- | model/src/possible_moves.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/model/src/possible_moves.rs b/model/src/possible_moves.rs index fc1f595..9dbb2b6 100644 --- a/model/src/possible_moves.rs +++ b/model/src/possible_moves.rs @@ -4,8 +4,9 @@ use std::alloc::{alloc, dealloc, handle_alloc_error, Layout}; use std::mem::MaybeUninit; use std::ptr::NonNull; -const POSSIBLE_MOVES_ITER_SIZE: usize = 98; +const POSSIBLE_MOVES_ITER_SIZE: usize = 42; +/// A struct containing the possible moves in a particular checkers position #[derive(Copy, Clone, Debug)] pub struct PossibleMoves { forward_left_movers: u32, @@ -14,9 +15,15 @@ pub struct PossibleMoves { backward_right_movers: u32, } +/// An iterator of possible checkers moves for a particular position pub struct PossibleMovesIter { + /// A pointer to an array of possibly uninitialized checkers moves moves: NonNull<[MaybeUninit<Move>; POSSIBLE_MOVES_ITER_SIZE]>, + + /// The current index into the moves array index: usize, + + // The number of initialized moves in the array length: usize, } |
