summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike White <botahamec@outlook.com>2021-08-23 20:04:37 -0400
committerMike White <botahamec@outlook.com>2021-08-23 20:04:37 -0400
commitc078330c36f9760bcb50516df76923ef8f0141ee (patch)
tree1fa341ef519b78ea467228835292ac80224486db
parent1b7437fabde41a0a5720da33a589e6e07274e63d (diff)
Added documentation for the structures
-rw-r--r--model/src/possible_moves.rs9
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,
}