Constant draught::board::STD_HEIGHT [−][src]
pub const STD_HEIGHT: usize = 8;
diff --git a/4d68ea94c77e642d94c7.module.wasm b/4d68ea94c77e642d94c7.module.wasm deleted file mode 100644 index 7e7abe5..0000000 Binary files a/4d68ea94c77e642d94c7.module.wasm and /dev/null differ diff --git a/8728f958432289f02420.module.wasm b/8728f958432289f02420.module.wasm new file mode 100644 index 0000000..de5a0e4 Binary files /dev/null and b/8728f958432289f02420.module.wasm differ diff --git a/doc/draught/board/constant.STD_HEIGHT.html b/doc/draught/board/constant.STD_HEIGHT.html index 2d99cc7..ac032a7 100644 --- a/doc/draught/board/constant.STD_HEIGHT.html +++ b/doc/draught/board/constant.STD_HEIGHT.html @@ -1,5 +1,6 @@ -
pub const STD_HEIGHT: usize = 8;
pub const STD_HEIGHT: usize = 8;
Standard height of a checkers board is 8 squares
+pub const STD_WIDTH: usize = 8;
pub const STD_WIDTH: usize = 8;
Standard width of a checkers board is 8 squares
+#[repr(u8)]pub enum Moveable { +Enum draught::
board:: [−][src]enums:: Moveable #[repr(u8)]pub enum Moveable { Allowed, - Occupied, + UnoccupiedSrc, + OccupiedDest, OutOfBounds, + Unplayable, + WrongTeamSrc, + IllegalTrajectory, }
Variants
-Trait Implementations
impl Clone for Moveable
[src]
fn clone(&self) -> Moveable
[src]Returns a copy of the value. Read more
+Trait Implementations
impl Clone for Moveable
[src]
fn clone(&self) -> Moveable
[src]Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from
source
. Read more
impl Copy for Moveable
[src]
impl Debug for Moveable
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
impl Eq for Moveable
[src]
impl FromWasmAbi for Moveable
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the diff --git a/doc/draught/board/enums/index.html b/doc/draught/board/enums/index.html index ac0251f..0fbe376 100644 --- a/doc/draught/board/enums/index.html +++ b/doc/draught/board/enums/index.html @@ -1,6 +1,6 @@
draught::board::enums - Rust Module draught::
board:: [−][src]enums Enums
+\ No newline at end of file diff --git a/doc/draught/board/index.html b/doc/draught/board/index.html index 133b5ac..755295d 100644 --- a/doc/draught/board/index.html +++ b/doc/draught/board/index.html @@ -1,9 +1,16 @@ - Module draught::
board:: [−][src]enums Enums
Moveable SquareState Strength Team draught::board - Rust +draught::board - Rust Module draught::
board [−][src]Modules
++ Module draught::
board [−][src]Board module for components related to the checkers board and game structure
+Modules
enums iter Structs
Board Models a single state for a checkers board
-BrdIdx Direction Piece Square Constants
-
STD_HEIGHT STD_WIDTH BrdIdx Model a rank 2 tensor index to identify a board square by row and column
+Direction Model the standard diagonal movements by north west/east etc
+Piece Model a game piece by its team and strength (normal or kinged)
+Square Model board squares by a state and a possible occupying game piece
+Constants
+\ No newline at end of file diff --git a/doc/draught/board/sidebar-items.js b/doc/draught/board/sidebar-items.js index 310be41..d5969b8 100644 --- a/doc/draught/board/sidebar-items.js +++ b/doc/draught/board/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["STD_HEIGHT",""],["STD_WIDTH",""]],"mod":[["enums",""],["iter",""]],"struct":[["Board","Models a single state for a checkers board"],["BrdIdx",""],["Direction",""],["Piece",""],["Square",""]]}); \ No newline at end of file +initSidebarItems({"constant":[["STD_HEIGHT","Standard height of a checkers board is 8 squares"],["STD_WIDTH","Standard width of a checkers board is 8 squares"]],"mod":[["enums",""],["iter",""]],"struct":[["Board","Models a single state for a checkers board"],["BrdIdx","Model a rank 2 tensor index to identify a board square by row and column"],["Direction","Model the standard diagonal movements by north west/east etc"],["Piece","Model a game piece by its team and strength (normal or kinged)"],["Square","Model board squares by a state and a possible occupying game piece"]]}); \ No newline at end of file diff --git a/doc/draught/board/struct.Board.html b/doc/draught/board/struct.Board.html index b2b4908..6148ecd 100644 --- a/doc/draught/board/struct.Board.html +++ b/doc/draught/board/struct.Board.html @@ -1,39 +1,73 @@
STD_HEIGHT Standard height of a checkers board is 8 squares
+STD_WIDTH Standard width of a checkers board is 8 squares
+draught::board::Board - Rust -Struct draught::
board:: [−][src]Board pub struct Board { +Struct draught::
board:: [−][src]Board Models a single state for a checkers board
- Fields
cells: Vec<Square>
width: usize
height: usize
current_turn: Team
Implementations
impl Board
[src]
pub fn cell_mut(&mut self, idx: usize) -> &mut Square
[src]
pub fn diagonal_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>
[src]
pub fn filter_indices(
[src]
&self,
idx: BrdIdx,
player: Team,
indices: Vec<usize>
) -> Vec<usize>
pub fn player_diagonal_indices(
[src]
&self,
idx: BrdIdx,
player: Team
) -> Option<Vec<usize>>
pub fn jumpable_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>
[src]
pub fn player_jumpable_indices(
[src]
&self,
idx: BrdIdx,
player: Team
) -> Option<Vec<usize>>
impl Board
[src]
pub fn cell(&self, idx: usize) -> Square
[src]
pub fn grid_cell(&self, idx: BrdIdx) -> Square
[src]
pub fn cell_index(&self, row: usize, col: usize) -> usize
[src]
pub fn cell_idx(&self, idx: BrdIdx) -> usize
[src]
pub fn board_index(&self, idx: usize) -> BrdIdx
[src]
pub fn new(width: usize, height: usize) -> Board
[src]
pub fn init_game(board: Board) -> Board
[src]
pub fn current_turn(&self) -> Team
[src]
pub fn cells(&self) -> *const Square
[src]
pub fn num_cells(&self) -> usize
[src]
pub fn cell_state(&self, idx: usize) -> SquareState
[src]Trait Implementations
impl Clone for Board
[src]
fn clone(&self) -> Board
[src]Returns a copy of the value. Read more
+ Fieldscells: Vec<Square>
1D backing array of board squares for the 2D game board
+width: usize
height: usize
current_turn: Team
Implementations
impl Board
[src]
pub fn cell_mut(&mut self, idx: usize) -> &mut Square
[src]Get a mutable reference to a board square by 1D array index
+
pub fn diagonal_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>
[src]Get the 1D array indices for the diagonally adjacent squares of a given board square
+Returns
++
None
: If the given square is unplayableSome(Vec
+): A variable length vector of 1D indices for diagonally adjacent squares. +Vector may be between 1 and 4 items long depending on the location of the given square
pub fn adjacent_dir(&self, idx: BrdIdx) -> Option<Direction<Square>>
[src]Get a
+Direction
structure for the diagonally adjacent squares of a given board squareSimilar to the
+Board::diagonal_indices
function with differently formatted resultsReturns
++
None
: If the given square is unplayableSome(Direction
+): A Direction
structure for the diagonally adjacent squares.
pub fn filter_indices(
[src]
&self,
idx: BrdIdx,
player: Team,
indices: Vec<usize>
) -> Vec<usize>Filter an array of diagonal indices (Like those from
+Board::diagonal_indices
,Board::jumpable_indices
) for those that are legal for a team’s man, i.e. solely up or down the board
pub fn player_diagonal_indices(
[src]
&self,
idx: BrdIdx,
player: Team
) -> Option<Vec<usize>>
pub fn jumpable_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>
[src]Get the 1D array indices for the diagonally jumpable squares of a given board square
+Returns
++
None
: If the given square is unplayableSome(Vec
+): A variable length vector of 1D indices for diagonally jumpable squares. +Vector may be between 1 and 4 items long depending on the location of the given square
pub fn jumpable_dir(&self, idx: BrdIdx) -> Option<Direction<Square>>
[src]Get a
+Direction
structure for the diagonally jumpable squares of a given board squareSimilar to the
+Board::jumpable_indices
function with differently formatted resultsReturns
++
None
: If the given square is unplayableSome(Direction
+): A Direction
structure for the diagonally jumpable squares.
pub fn player_jumpable_indices(
[src]
&self,
idx: BrdIdx,
player: Team
) -> Option<Vec<usize>>
impl Board
[src]
pub fn cell(&self, idx: usize) -> Square
[src]Get a copy of a board square by 1D array index
+
pub fn grid_cell(&self, idx: BrdIdx) -> Square
[src]Get a copy of a board square by 2D
+BrdIdx
index
pub fn cell_index(&self, row: usize, col: usize) -> usize
[src]Transform a 2D row/column board index into a single 1D index for use with
+Board::cells
pub fn cell_idx(&self, idx: BrdIdx) -> usize
[src]Similar to
+Board::cell_index
but with aBrdIdx
instead of separate indices. Transform a 2D row/column board index into a single 1D index for use withBoard::cells
pub fn board_index(&self, idx: usize) -> BrdIdx
[src]Transform a 1D array index (for
+Board::cells
) into a 2D game board index (by row/col)
pub fn can_move(&self, from: BrdIdx, to: BrdIdx) -> Moveable
[src]
pub fn new(width: usize, height: usize) -> Board
[src]Iniitalise a game board without game pieces
+
pub fn init_game(board: Board) -> Board
[src]Reset the given board to a starting layout with 3 rows of opposing pieces
+
pub fn current_turn(&self) -> Team
[src]Get the
+Board::current_turn
parameter
pub fn cells(&self) -> *const Square
[src]Get a pointer to the backing array of board squares,
+Board::cells
pub fn num_cells(&self) -> usize
[src]Get the number of board squares
+
pub fn cell_state(&self, idx: usize) -> SquareState
[src]Get the state of a board square by 1D array index
+Trait Implementations
impl Clone for Board
[src]
fn clone(&self) -> Board
[src]Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from
-source
. Read more
impl Display for Board
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
-
impl From<Board> for JsValue
[src]
impl FromWasmAbi for Board
[src]
impl Display for Board
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
+
impl From<Board> for JsValue
[src]
impl FromWasmAbi for Board
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
-
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
-Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Board
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI +
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
+Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Board
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
-
fn into_abi(self) -> u32
[src]Convert
self
intoSelf::Abi
so that it can be sent across the wasm +
fn into_abi(self) -> u32
[src]Convert
-self
intoSelf::Abi
so that it can be sent across the wasm ABI boundary. Read more
impl OptionFromWasmAbi for Board
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be +
impl OptionFromWasmAbi for Board
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be deserialized as
-None
, and otherwise it will be passed toFromWasmAbi
. Read more
impl OptionIntoWasmAbi for Board
[src]
impl OptionIntoWasmAbi for Board
[src]
fn none() -> Self::Abi
[src]Returns an ABI instance indicating “none”, which JS will interpret as the
-None
branch of this option. Read more
impl RefFromWasmAbi for Board
[src]
impl RefFromWasmAbi for Board
[src]
type Abi = u32
The wasm ABI type references to
Self
are recovered from.
type Anchor = Ref<'static, Board>
The type that holds the reference to
-Self
for the duration of the invocation of the function that has an&Self
parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
-Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Board
[src]
type Abi = u32
Same as
+RefFromWasmAbi::Abi
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
+Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Board
[src]
type Abi = u32
Same as
RefFromWasmAbi::Abi
type Anchor = RefMut<'static, Board>
Same as
-RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
-RefFromWasmAbi::ref_from_abi
impl WasmDescribe for Board
[src]Auto Trait Implementations
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnwindSafe for Board
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]Gets the
+TypeId
ofself
. Read more
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
+RefFromWasmAbi::ref_from_abi
impl WasmDescribe for Board
[src]Auto Trait Implementations
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnwindSafe for Board
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]Performs the conversion.
diff --git a/doc/draught/board/struct.BrdIdx.html b/doc/draught/board/struct.BrdIdx.html index bab44b1..2d01763 100644 --- a/doc/draught/board/struct.BrdIdx.html +++ b/doc/draught/board/struct.BrdIdx.html @@ -1,39 +1,41 @@ -draught::board::BrdIdx - Rust +draught::board::BrdIdx - Rust -Struct draught::
board:: [−][src]BrdIdx pub struct BrdIdx { +Struct draught::
board:: [−][src]BrdIdx - Fields
row: usize
col: usize
Implementations
impl BrdIdx
[src]Trait Implementations
impl Clone for BrdIdx
[src]
fn clone(&self) -> BrdIdx
[src]Returns a copy of the value. Read more
+}Model a rank 2 tensor index to identify a board square by row and column
++ Fields
row: usize
col: usize
Implementations
impl BrdIdx
[src]Trait Implementations
impl Clone for BrdIdx
[src]
fn clone(&self) -> BrdIdx
[src]Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from
-source
. Read more
impl Copy for BrdIdx
[src]
impl Debug for BrdIdx
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
-
impl Eq for BrdIdx
[src]
impl From<BrdIdx> for JsValue
[src]
impl FromWasmAbi for BrdIdx
[src]
impl Copy for BrdIdx
[src]
impl Debug for BrdIdx
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
+
impl Display for BrdIdx
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
+
impl Eq for BrdIdx
[src]
impl From<BrdIdx> for JsValue
[src]
impl FromWasmAbi for BrdIdx
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
-
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
-Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for BrdIdx
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI +
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
+Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for BrdIdx
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
-
fn into_abi(self) -> u32
[src]Convert
self
intoSelf::Abi
so that it can be sent across the wasm +
fn into_abi(self) -> u32
[src]Convert
-self
intoSelf::Abi
so that it can be sent across the wasm ABI boundary. Read more
impl OptionFromWasmAbi for BrdIdx
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be +
impl OptionFromWasmAbi for BrdIdx
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be deserialized as
-None
, and otherwise it will be passed toFromWasmAbi
. Read more
impl OptionIntoWasmAbi for BrdIdx
[src]
impl OptionIntoWasmAbi for BrdIdx
[src]
fn none() -> Self::Abi
[src]Returns an ABI instance indicating “none”, which JS will interpret as the
-None
branch of this option. Read more
impl PartialEq<BrdIdx> for BrdIdx
[src]
fn eq(&self, other: &BrdIdx) -> bool
[src]This method tests for
self
andother
values to be equal, and is used +
impl PartialEq<BrdIdx> for BrdIdx
[src]
fn eq(&self, other: &BrdIdx) -> bool
[src]This method tests for
-self
andother
values to be equal, and is used by==
. Read more
fn ne(&self, other: &BrdIdx) -> bool
[src]This method tests for
-!=
.
impl RefFromWasmAbi for BrdIdx
[src]
type Abi = u32
The wasm ABI type references to
+Self
are recovered from.
fn ne(&self, other: &BrdIdx) -> bool
[src]This method tests for
+!=
.
impl RefFromWasmAbi for BrdIdx
[src]
type Abi = u32
The wasm ABI type references to
Self
are recovered from.
type Anchor = Ref<'static, BrdIdx>
The type that holds the reference to
-Self
for the duration of the invocation of the function that has an&Self
parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
-Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for BrdIdx
[src]
type Abi = u32
Same as
+RefFromWasmAbi::Abi
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
+Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for BrdIdx
[src]
type Abi = u32
Same as
RefFromWasmAbi::Abi
type Anchor = RefMut<'static, BrdIdx>
Same as
-RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
-RefFromWasmAbi::ref_from_abi
impl StructuralEq for BrdIdx
[src]
impl StructuralPartialEq for BrdIdx
[src]
impl WasmDescribe for BrdIdx
[src]Auto Trait Implementations
impl RefUnwindSafe for BrdIdx
impl Send for BrdIdx
impl Sync for BrdIdx
impl Unpin for BrdIdx
impl UnwindSafe for BrdIdx
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]Gets the
+TypeId
ofself
. Read more
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
+RefFromWasmAbi::ref_from_abi
impl StructuralEq for BrdIdx
[src]
impl StructuralPartialEq for BrdIdx
[src]
impl WasmDescribe for BrdIdx
[src]Auto Trait Implementations
impl RefUnwindSafe for BrdIdx
impl Send for BrdIdx
impl Sync for BrdIdx
impl Unpin for BrdIdx
impl UnwindSafe for BrdIdx
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]Performs the conversion.
@@ -45,6 +47,7 @@ return in the case ofErr
.pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (
toowned_clone_into
)recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
+
impl<T> ToString for T where
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]Performs the conversion.
impl<T, U> TryInto<U> for T where
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
diff --git a/doc/draught/board/struct.Direction.html b/doc/draught/board/struct.Direction.html index 674aa6a..93f569e 100644 --- a/doc/draught/board/struct.Direction.html +++ b/doc/draught/board/struct.Direction.html @@ -1,19 +1,27 @@ -draught::board::Direction - Rust +draught::board::Direction - Rust Struct draught::
board:: [−][src]Direction Struct draught::
board:: [−][src]Direction pub struct Direction<T: Clone + Copy> { nw: Option<T>, ne: Option<T>, se: Option<T>, sw: Option<T>, -}- Fields
nw: Option<T>
ne: Option<T>
se: Option<T>
sw: Option<T>
Implementations
impl<T: Clone + Copy> Direction<T>
[src]Trait Implementations
impl<T: Clone + Copy> Clone for Direction<T>
[src]
fn clone(&self) -> Direction<T>
[src]Returns a copy of the value. Read more
+}Model the standard diagonal movements by north west/east etc
+Used as an absolute measure, i.e. not relative to the team making a move
+Use options for when movements are blocked/unallowed contextually
++ Fields
nw: Option<T>
North West
+ne: Option<T>
North East
+se: Option<T>
South East
+sw: Option<T>
South West
+Implementations
impl<T: Clone + Copy> Direction<T>
[src]
pub fn empty() -> Direction<T>
[src]Create an empty direction full of
+Option::None
Trait Implementations
impl<T: Clone + Copy> Clone for Direction<T>
[src]
fn clone(&self) -> Direction<T>
[src]Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from
-source
. Read more
impl<T: Copy + Clone> Copy for Direction<T>
[src]
impl<T: Debug + Clone + Copy> Debug for Direction<T>
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
-
impl<T: Eq + Clone + Copy> Eq for Direction<T>
[src]
impl<T: PartialEq + Clone + Copy> PartialEq<Direction<T>> for Direction<T>
[src]
fn eq(&self, other: &Direction<T>) -> bool
[src]This method tests for
self
andother
values to be equal, and is used +
impl<T: Copy + Clone> Copy for Direction<T>
[src]
impl<T: Debug + Clone + Copy> Debug for Direction<T>
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
+
impl<T: Eq + Clone + Copy> Eq for Direction<T>
[src]
impl<T: PartialEq + Clone + Copy> PartialEq<Direction<T>> for Direction<T>
[src]
fn eq(&self, other: &Direction<T>) -> bool
[src]This method tests for
-self
andother
values to be equal, and is used by==
. Read more
fn ne(&self, other: &Direction<T>) -> bool
[src]This method tests for
-!=
.
impl<T: Clone + Copy> StructuralEq for Direction<T>
[src]
impl<T: Clone + Copy> StructuralPartialEq for Direction<T>
[src]Auto Trait Implementations
impl<T> RefUnwindSafe for Direction<T> where
T: RefUnwindSafe,
impl<T> Send for Direction<T> where
T: Send,
impl<T> Sync for Direction<T> where
T: Sync,
impl<T> Unpin for Direction<T> where
T: Unpin,
impl<T> UnwindSafe for Direction<T> where
T: UnwindSafe,Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]Gets the
+TypeId
ofself
. Read more
fn ne(&self, other: &Direction<T>) -> bool
[src]This method tests for
+!=
.
impl<T: Clone + Copy> StructuralEq for Direction<T>
[src]
impl<T: Clone + Copy> StructuralPartialEq for Direction<T>
[src]Auto Trait Implementations
impl<T> RefUnwindSafe for Direction<T> where
T: RefUnwindSafe,
impl<T> Send for Direction<T> where
T: Send,
impl<T> Sync for Direction<T> where
T: Sync,
impl<T> Unpin for Direction<T> where
T: Unpin,
impl<T> UnwindSafe for Direction<T> where
T: UnwindSafe,Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]Performs the conversion.
diff --git a/doc/draught/board/struct.Piece.html b/doc/draught/board/struct.Piece.html index 6810874..be0b904 100644 --- a/doc/draught/board/struct.Piece.html +++ b/doc/draught/board/struct.Piece.html @@ -1,39 +1,40 @@ -draught::board::Piece - Rust +draught::board::Piece - Rust Struct draught::
board:: [−][src]Piece Struct draught::
board:: [−][src]Piece - Fields
team: Team
strength: Strength
Implementations
impl Piece
[src]Trait Implementations
impl Clone for Piece
[src]
fn clone(&self) -> Piece
[src]Returns a copy of the value. Read more
+}Model a game piece by its team and strength (normal or kinged)
++ Fields
team: Team
strength: Strength
Implementations
impl Piece
[src]Trait Implementations
impl Clone for Piece
[src]
fn clone(&self) -> Piece
[src]Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from
-source
. Read more
impl Copy for Piece
[src]
impl Debug for Piece
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
-
impl Eq for Piece
[src]
impl From<Piece> for JsValue
[src]
impl FromWasmAbi for Piece
[src]
impl Copy for Piece
[src]
impl Debug for Piece
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
+
impl Eq for Piece
[src]
impl From<Piece> for JsValue
[src]
impl FromWasmAbi for Piece
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
-
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
-Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Piece
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI +
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
+Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Piece
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
-
fn into_abi(self) -> u32
[src]Convert
self
intoSelf::Abi
so that it can be sent across the wasm +
fn into_abi(self) -> u32
[src]Convert
-self
intoSelf::Abi
so that it can be sent across the wasm ABI boundary. Read more
impl OptionFromWasmAbi for Piece
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be +
impl OptionFromWasmAbi for Piece
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be deserialized as
-None
, and otherwise it will be passed toFromWasmAbi
. Read more
impl OptionIntoWasmAbi for Piece
[src]
impl OptionIntoWasmAbi for Piece
[src]
fn none() -> Self::Abi
[src]Returns an ABI instance indicating “none”, which JS will interpret as the
-None
branch of this option. Read more
impl PartialEq<Piece> for Piece
[src]
fn eq(&self, other: &Piece) -> bool
[src]This method tests for
self
andother
values to be equal, and is used +
impl PartialEq<Piece> for Piece
[src]
fn eq(&self, other: &Piece) -> bool
[src]This method tests for
-self
andother
values to be equal, and is used by==
. Read more
fn ne(&self, other: &Piece) -> bool
[src]This method tests for
-!=
.
impl RefFromWasmAbi for Piece
[src]
type Abi = u32
The wasm ABI type references to
+Self
are recovered from.
fn ne(&self, other: &Piece) -> bool
[src]This method tests for
+!=
.
impl RefFromWasmAbi for Piece
[src]
type Abi = u32
The wasm ABI type references to
Self
are recovered from.
type Anchor = Ref<'static, Piece>
The type that holds the reference to
-Self
for the duration of the invocation of the function that has an&Self
parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
-Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Piece
[src]
type Abi = u32
Same as
+RefFromWasmAbi::Abi
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
+Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Piece
[src]
type Abi = u32
Same as
RefFromWasmAbi::Abi
type Anchor = RefMut<'static, Piece>
Same as
-RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
-RefFromWasmAbi::ref_from_abi
impl StructuralEq for Piece
[src]
impl StructuralPartialEq for Piece
[src]
impl WasmDescribe for Piece
[src]Auto Trait Implementations
impl RefUnwindSafe for Piece
impl Send for Piece
impl Sync for Piece
impl Unpin for Piece
impl UnwindSafe for Piece
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]Gets the
+TypeId
ofself
. Read more
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
+RefFromWasmAbi::ref_from_abi
impl StructuralEq for Piece
[src]
impl StructuralPartialEq for Piece
[src]
impl WasmDescribe for Piece
[src]Auto Trait Implementations
impl RefUnwindSafe for Piece
impl Send for Piece
impl Sync for Piece
impl Unpin for Piece
impl UnwindSafe for Piece
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]Performs the conversion.
diff --git a/doc/draught/board/struct.Square.html b/doc/draught/board/struct.Square.html index a8acd2c..6911b5e 100644 --- a/doc/draught/board/struct.Square.html +++ b/doc/draught/board/struct.Square.html @@ -1,39 +1,42 @@ -draught::board::Square - Rust +draught::board::Square - Rust Struct draught::
board:: [−][src]Square Struct draught::
board:: [−][src]Square pub struct Square { occupant: Option<Piece>, state: SquareState, -}- Fields
occupant: Option<Piece>
state: SquareState
Implementations
impl Square
[src]Trait Implementations
impl Clone for Square
[src]
fn clone(&self) -> Square
[src]Returns a copy of the value. Read more
+}Model board squares by a state and a possible occupying game piece
++ Fields
occupant: Option<Piece>
Game piece if square is occupied
+state: SquareState
Description of whether the square is occupied or an unplayable, i.e. off-lattice square
+Implementations
impl Square
[src]Trait Implementations
impl Clone for Square
[src]
fn clone(&self) -> Square
[src]Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from
-source
. Read more
impl Copy for Square
[src]
impl Debug for Square
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
-
impl Eq for Square
[src]
impl From<Square> for JsValue
[src]
impl FromWasmAbi for Square
[src]
impl Copy for Square
[src]
impl Debug for Square
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]Formats the value using the given formatter. Read more
+
impl Eq for Square
[src]
impl From<Square> for JsValue
[src]
impl FromWasmAbi for Square
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
-
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
-Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Square
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI +
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
+Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Square
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
-
fn into_abi(self) -> u32
[src]Convert
self
intoSelf::Abi
so that it can be sent across the wasm +
fn into_abi(self) -> u32
[src]Convert
-self
intoSelf::Abi
so that it can be sent across the wasm ABI boundary. Read more
impl OptionFromWasmAbi for Square
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be +
impl OptionFromWasmAbi for Square
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be deserialized as
-None
, and otherwise it will be passed toFromWasmAbi
. Read more
impl OptionIntoWasmAbi for Square
[src]
impl OptionIntoWasmAbi for Square
[src]
fn none() -> Self::Abi
[src]Returns an ABI instance indicating “none”, which JS will interpret as the
-None
branch of this option. Read more
impl PartialEq<Square> for Square
[src]
fn eq(&self, other: &Square) -> bool
[src]This method tests for
self
andother
values to be equal, and is used +
impl PartialEq<Square> for Square
[src]
fn eq(&self, other: &Square) -> bool
[src]This method tests for
-self
andother
values to be equal, and is used by==
. Read more
fn ne(&self, other: &Square) -> bool
[src]This method tests for
-!=
.
impl RefFromWasmAbi for Square
[src]
type Abi = u32
The wasm ABI type references to
+Self
are recovered from.
fn ne(&self, other: &Square) -> bool
[src]This method tests for
+!=
.
impl RefFromWasmAbi for Square
[src]
type Abi = u32
The wasm ABI type references to
Self
are recovered from.
type Anchor = Ref<'static, Square>
The type that holds the reference to
-Self
for the duration of the invocation of the function that has an&Self
parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
-Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Square
[src]
type Abi = u32
Same as
+RefFromWasmAbi::Abi
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
+Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Square
[src]
type Abi = u32
Same as
RefFromWasmAbi::Abi
type Anchor = RefMut<'static, Square>
Same as
-RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
-RefFromWasmAbi::ref_from_abi
impl StructuralEq for Square
[src]
impl StructuralPartialEq for Square
[src]
impl WasmDescribe for Square
[src]Auto Trait Implementations
impl RefUnwindSafe for Square
impl Send for Square
impl Sync for Square
impl Unpin for Square
impl UnwindSafe for Square
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]Gets the
+TypeId
ofself
. Read more
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
+RefFromWasmAbi::ref_from_abi
impl StructuralEq for Square
[src]
impl StructuralPartialEq for Square
[src]
impl WasmDescribe for Square
[src]Auto Trait Implementations
impl RefUnwindSafe for Square
impl Send for Square
impl Sync for Square
impl Unpin for Square
impl UnwindSafe for Square
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]Performs the conversion.
diff --git a/doc/draught/fn.__wasm_bindgen_generated_init_game.html b/doc/draught/fn.__wasm_bindgen_generated_init_game.html index 92b31e8..31aad9e 100644 --- a/doc/draught/fn.__wasm_bindgen_generated_init_game.html +++ b/doc/draught/fn.__wasm_bindgen_generated_init_game.html @@ -1,5 +1,5 @@draught::__wasm_bindgen_generated_init_game - Rust + Function draught::
__wasm_bindgen_generated_init_game [−][src]pub extern "C" fn __wasm_bindgen_generated_init_game(
) -> <() as ReturnWasmAbi>::Abi\ No newline at end of file diff --git a/doc/draught/fn.init_game.html b/doc/draught/fn.init_game.html index e4f08b2..40172bd 100644 --- a/doc/draught/fn.init_game.html +++ b/doc/draught/fn.init_game.html @@ -1,5 +1,5 @@ Function draught::
__wasm_bindgen_generated_init_game [−][src]pub extern "C" fn __wasm_bindgen_generated_init_game(
) -> <() as ReturnWasmAbi>::Abidraught::init_game - Rust + Function draught::
init_game [−][src]pub fn init_game()\ No newline at end of file diff --git a/doc/draught/game/index.html b/doc/draught/game/index.html index 6f5d7e2..789b66a 100644 --- a/doc/draught/game/index.html +++ b/doc/draught/game/index.html @@ -1,6 +1,7 @@ Function draught::
init_game [−][src]pub fn init_game()draught::game - Rust + Module draught::
game [−][src]Structs
-
Game \ No newline at end of file diff --git a/doc/draught/game/sidebar-items.js b/doc/draught/game/sidebar-items.js index 14daea1..e820a46 100644 --- a/doc/draught/game/sidebar-items.js +++ b/doc/draught/game/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["Game",""]]}); \ No newline at end of file +initSidebarItems({"struct":[["Game","Root-level structure for managing the game as a collection of board states"]]}); \ No newline at end of file diff --git a/doc/draught/game/struct.Game.html b/doc/draught/game/struct.Game.html index a873865..1b3455e 100644 --- a/doc/draught/game/struct.Game.html +++ b/doc/draught/game/struct.Game.html @@ -1,34 +1,35 @@ - Module draught::
game [−][src]Structs
+
Game Root-level structure for managing the game as a collection of board states
+draught::game::Game - Rust +draught::game::Game - Rust Struct draught::
game:: [−][src]Game Struct draught::
game:: [−][src]Game - Fields
current: Board
previous_boards: Vec<Board>
tree: Arena<Board>
Trait Implementations
impl From<Game> for JsValue
[src]
impl FromWasmAbi for Game
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the +}
Root-level structure for managing the game as a collection of board states
++ Fields
current: Board
previous_boards: Vec<Board>
tree: Arena<Board>
Trait Implementations
impl From<Game> for JsValue
[src]
impl FromWasmAbi for Game
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
-
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
-Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Game
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI +
unsafe fn from_abi(js: u32) -> Self
[src]Recover a
+Self
fromSelf::Abi
. Read more
impl IntoWasmAbi for Game
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
-
fn into_abi(self) -> u32
[src]Convert
self
intoSelf::Abi
so that it can be sent across the wasm +
fn into_abi(self) -> u32
[src]Convert
-self
intoSelf::Abi
so that it can be sent across the wasm ABI boundary. Read more
impl OptionFromWasmAbi for Game
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be +
impl OptionFromWasmAbi for Game
[src]
fn is_none(abi: &Self::Abi) -> bool
[src]Tests whether the argument is a “none” instance. If so it will be deserialized as
-None
, and otherwise it will be passed toFromWasmAbi
. Read more
impl OptionIntoWasmAbi for Game
[src]
impl OptionIntoWasmAbi for Game
[src]
fn none() -> Self::Abi
[src]Returns an ABI instance indicating “none”, which JS will interpret as the
-None
branch of this option. Read more
impl RefFromWasmAbi for Game
[src]
impl RefFromWasmAbi for Game
[src]
type Abi = u32
The wasm ABI type references to
Self
are recovered from.
type Anchor = Ref<'static, Game>
The type that holds the reference to
-Self
for the duration of the invocation of the function that has an&Self
parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
-Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Game
[src]
type Abi = u32
Same as
+RefFromWasmAbi::Abi
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]Recover a
+Self::Anchor
fromSelf::Abi
. Read more
impl RefMutFromWasmAbi for Game
[src]
type Abi = u32
Same as
RefFromWasmAbi::Abi
type Anchor = RefMut<'static, Game>
Same as
-RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
-RefFromWasmAbi::ref_from_abi
impl WasmDescribe for Game
[src]Auto Trait Implementations
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnwindSafe for Game
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]Gets the
+TypeId
ofself
. Read more
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]Same as
+RefFromWasmAbi::ref_from_abi
impl WasmDescribe for Game
[src]Auto Trait Implementations
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnwindSafe for Game
Blanket Implementations
impl<T> Any for T where
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]Performs the conversion.
diff --git a/doc/draught/index.html b/doc/draught/index.html index a81b9df..fce1311 100644 --- a/doc/draught/index.html +++ b/doc/draught/index.html @@ -1,8 +1,13 @@ -draught - Rust +draught - Rust -Crate draught[−][src]
Modules
-
board game utils Macros
-
log Functions
+\ No newline at end of file diff --git a/doc/draught/macro.log.html b/doc/draught/macro.log.html index acebd0a..267fc0a 100644 --- a/doc/draught/macro.log.html +++ b/doc/draught/macro.log.html @@ -1,9 +1,10 @@ - Crate draught[−][src]
Draught
+An implementation of checkers/draughts in Rust WebAssembly with a minimax AI player
+Re-exports
+
pub use board::Board;
pub use game::Game;
Modules
+
board Board module for components related to the checkers board and game structure
+game utils Macros
+
log Wrap the
+web_sys
access to the browser console in a macro for easy loggingFunctions
__wasm_bindgen_generated_init_game init_game draught::log - Rust +draught::log - Rust Macro draught::
log [−][src]\ No newline at end of file diff --git a/doc/draught/sidebar-items.js b/doc/draught/sidebar-items.js index 7c2b1ab..a53c6a5 100644 --- a/doc/draught/sidebar-items.js +++ b/doc/draught/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["__wasm_bindgen_generated_init_game",""],["init_game",""]],"macro":[["log",""]],"mod":[["board",""],["game",""],["utils",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["__wasm_bindgen_generated_init_game",""],["init_game",""]],"macro":[["log","Wrap the [`web_sys`] access to the browser console in a macro for easy logging"]],"mod":[["board","Board module for components related to the checkers board and game structure"],["game",""],["utils",""]]}); \ No newline at end of file diff --git a/doc/implementors/core/fmt/trait.Display.js b/doc/implementors/core/fmt/trait.Display.js index 6a31ee2..4547dfc 100644 --- a/doc/implementors/core/fmt/trait.Display.js +++ b/doc/implementors/core/fmt/trait.Display.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl Display for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl Display for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl Display for Board","synthetic":false,"types":["draught::board::Board"]}]; +implementors["draught"] = [{"text":"impl Display for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl Display for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl Display for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl Display for Board","synthetic":false,"types":["draught::board::Board"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/search-index.js b/doc/search-index.js index d8adcb5..450a369 100644 --- a/doc/search-index.js +++ b/doc/search-index.js @@ -1,4 +1,4 @@ var searchIndex = JSON.parse('{\ -"draught":{"doc":"","t":[0,0,4,13,13,4,13,13,4,13,13,13,4,13,13,13,0,3,12,12,11,3,12,12,11,17,17,3,12,12,11,3,12,12,12,12,11,3,12,12,11,3,12,12,11,3,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,5,0,3,12,12,12,5,5,14,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["board","enums","Team","Black","White","Strength","Man","King","SquareState","Empty","Occupied","Unplayable","Moveable","Allowed","Occupied","OutOfBounds","iter","RowIndexIterator","board","row_cursor","new","RowSquareIterator","board","index_iter","new","STD_WIDTH","STD_HEIGHT","Piece","team","strength","new","Direction","nw","ne","se","sw","empty","Square","occupant","state","new","BrdIdx","row","col","from","Board","cells","width","height","current_turn","cell_mut","diagonal_indices","filter_indices","player_diagonal_indices","jumpable_indices","player_jumpable_indices","cell","grid_cell","cell_index","cell_idx","board_index","new","init_game","current_turn","cells","num_cells","cell_state","utils","set_panic_hook","game","Game","current","previous_boards","tree","init_game","__wasm_bindgen_generated_init_game","log","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","into_iter","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","into_iter","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","next","next","clone","clone","clone","clone","clone","clone","clone","clone","clone","eq","eq","eq","eq","eq","ne","eq","ne","eq","ne","eq","ne","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","ref_from_abi","ref_from_abi","ref_from_abi","ref_from_abi","ref_from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","describe","describe","describe","describe","describe","describe","describe","describe","describe","is_none","is_none","is_none","is_none","is_none","is_none","is_none","is_none","is_none","none","none","none","none","none","none","none","none","none","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi"],"q":["draught","draught::board","draught::board::enums","","","","","","","","","","","","","","draught::board","draught::board::iter","","","","","","","","draught::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught","draught::utils","draught","draught::game","","","","draught","","","draught::board::enums","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::board::iter","","","","","","","","","","","","","","","","","","draught::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::game","","","","","","","","","draught::board::iter","","draught::board::enums","","","","draught::board","","","","","draught::board::enums","","","","draught::board","","","","","","","","draught::board::enums","","","","draught::board","","","","draught::board::enums","","draught::board","","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board","","","","draught::game"],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Models a single state for a checkers board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get next item from the iterator","Get next item from the iterator","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,1,1,0,2,2,0,3,3,3,0,4,4,4,0,0,5,5,5,0,6,6,6,0,0,0,7,7,7,0,8,8,8,8,8,0,9,9,9,0,10,10,10,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,0,0,0,12,12,12,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,5,6,1,2,3,4,7,8,9,10,11,1,2,3,4,7,7,8,8,9,9,10,10,1,2,3,4,7,8,9,10,1,3,11,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,7,9,10,11,12],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["board",3]]],null,null,null,[[["board",3]]],null,null,null,null,null,[[["strength",4],["team",4]],["piece",3]],null,null,null,null,null,[[],["direction",3]],null,null,null,[[["piece",3],["squarestate",4],["option",4]],["square",3]],null,null,null,[[["usize",15]],["brdidx",3]],null,null,null,null,null,[[["usize",15]],["square",3]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["usize",15],["brdidx",3],["team",4],["vec",3]],[["usize",15],["vec",3]]],[[["brdidx",3],["team",4]],[["option",4],["vec",3]]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3],["team",4]],[["option",4],["vec",3]]],[[["usize",15]],["square",3]],[[["brdidx",3]],["square",3]],[[["usize",15]],["usize",15]],[[["brdidx",3]],["usize",15]],[[["usize",15]],["brdidx",3]],[[["usize",15]],["board",3]],[[["board",3]],["board",3]],[[],["team",4]],[[]],[[],["usize",15]],[[["usize",15]],["squarestate",4]],null,[[]],null,null,null,null,null,[[]],[[]],null,[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[],[["option",4],["vec",3]]],[[],[["vec",3],["option",4]]],[[],["team",4]],[[],["strength",4]],[[],["squarestate",4]],[[],["moveable",4]],[[],["piece",3]],[[],["direction",3]],[[],["square",3]],[[],["brdidx",3]],[[],["board",3]],[[["team",4]],["bool",15]],[[["strength",4]],["bool",15]],[[["squarestate",4]],["bool",15]],[[["moveable",4]],["bool",15]],[[["piece",3]],["bool",15]],[[["piece",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["square",3]],["bool",15]],[[["square",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]]],"p":[[4,"Team"],[4,"Strength"],[4,"SquareState"],[4,"Moveable"],[3,"RowIndexIterator"],[3,"RowSquareIterator"],[3,"Piece"],[3,"Direction"],[3,"Square"],[3,"BrdIdx"],[3,"Board"],[3,"Game"]]}\ +"draught":{"doc":"Draught","t":[0,0,4,13,13,4,13,13,4,13,13,13,4,13,13,13,13,13,13,13,0,3,12,12,11,3,12,12,11,17,17,3,12,12,11,3,12,12,12,12,11,3,12,12,11,3,12,12,11,3,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,5,0,3,12,12,12,5,5,14,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["board","enums","Team","Black","White","Strength","Man","King","SquareState","Empty","Occupied","Unplayable","Moveable","Allowed","UnoccupiedSrc","OccupiedDest","OutOfBounds","Unplayable","WrongTeamSrc","IllegalTrajectory","iter","RowIndexIterator","board","row_cursor","new","RowSquareIterator","board","index_iter","new","STD_WIDTH","STD_HEIGHT","Piece","team","strength","new","Direction","nw","ne","se","sw","empty","Square","occupant","state","new","BrdIdx","row","col","from","Board","cells","width","height","current_turn","cell_mut","diagonal_indices","adjacent_dir","filter_indices","player_diagonal_indices","jumpable_indices","jumpable_dir","player_jumpable_indices","cell","grid_cell","cell_index","cell_idx","board_index","can_move","new","init_game","current_turn","cells","num_cells","cell_state","utils","set_panic_hook","game","Game","current","previous_boards","tree","init_game","__wasm_bindgen_generated_init_game","log","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","into_iter","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","into_iter","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","return_abi","vzip","next","next","clone","clone","clone","clone","clone","clone","clone","clone","clone","eq","eq","eq","eq","eq","ne","eq","ne","eq","ne","eq","ne","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","ref_from_abi","ref_from_abi","ref_from_abi","ref_from_abi","ref_from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","from_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","into_abi","describe","describe","describe","describe","describe","describe","describe","describe","describe","is_none","is_none","is_none","is_none","is_none","is_none","is_none","is_none","is_none","none","none","none","none","none","none","none","none","none","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi"],"q":["draught","draught::board","draught::board::enums","","","","","","","","","","","","","","","","","","draught::board","draught::board::iter","","","","","","","","draught::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught","draught::utils","draught","draught::game","","","","draught","","","draught::board::enums","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::board::iter","","","","","","","","","","","","","","","","","","draught::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::game","","","","","","","","","draught::board::iter","","draught::board::enums","","","","draught::board","","","","","draught::board::enums","","","","draught::board","","","","","","","","draught::board::enums","","","","draught::board","","","","draught::board::enums","","draught::board","","","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board::enums","","","","draught::board","","","","draught::game","draught::board","","","","draught::game"],"d":["Board module for components related to the checkers board …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Standard width of a checkers board is 8 squares","Standard height of a checkers board is 8 squares","Model a game piece by its team and strength (normal or …","","","","Model the standard diagonal movements by north west/east …","North West ","North East","South East","South West","Create an empty direction full of [ Macro draught::
log [−][src]+macro_rules! log { ( $( $t:tt )* ) => { ... }; }Wrap the
web_sys
access to the browser console in a macro for easy loggingOption::None
]","Model board squares by a state and a possible occupying …","Game piece if square is occupied","Description of whether the square is occupied or an …","","Model a rank 2 tensor index to identify a board square by …","","","","Models a single state for a checkers board","1D backing array of board squares for the 2D game board","","","","Get a mutable reference to a board square by 1D array …","Get the 1D array indices for the diagonally adjacent …","Get a [Direction
] structure for the diagonally adjacent …","Filter an array of diagonal indices (Like those from […","","Get the 1D array indices for the diagonally jumpable …","Get a [Direction
] structure for the diagonally jumpable …","","Get a copy of a board square by 1D array index","Get a copy of a board square by 2D [BrdIdx
] index","Transform a 2D row/column board index into a single 1D …","Similar to [Board::cell_index
] but with a [BrdIdx
] …","Transform a 1D array index (for [Board::cells
]) into a 2D …","","Iniitalise a game board without game pieces","Reset the given board to a starting layout with 3 rows of …","Get the [Board::current_turn
] parameter","Get a pointer to the backing array of board squares, […","Get the number of board squares","Get the state of a board square by 1D array index","","","","Root-level structure for managing the game as a …","","","","","","Wrap the [web_sys
] access to the browser console in a …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get next item from the iterator","Get next item from the iterator","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,1,1,0,2,2,0,3,3,3,0,4,4,4,4,4,4,4,0,0,5,5,5,0,6,6,6,0,0,0,7,7,7,0,8,8,8,8,8,0,9,9,9,0,10,10,10,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,0,0,0,12,12,12,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,5,6,1,2,3,4,7,8,9,10,11,1,2,3,4,7,7,8,8,9,9,10,10,1,2,3,4,7,8,9,10,1,3,10,11,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,1,2,3,4,7,9,10,11,12,7,9,10,11,12],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["board",3]]],null,null,null,[[["board",3]]],null,null,null,null,null,[[["strength",4],["team",4]],["piece",3]],null,null,null,null,null,[[],["direction",3]],null,null,null,[[["squarestate",4],["piece",3],["option",4]],["square",3]],null,null,null,[[["usize",15]],["brdidx",3]],null,null,null,null,null,[[["usize",15]],["square",3]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],[["option",4],["direction",3]]],[[["usize",15],["brdidx",3],["vec",3],["team",4]],[["usize",15],["vec",3]]],[[["team",4],["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],[["option",4],["direction",3]]],[[["team",4],["brdidx",3]],[["option",4],["vec",3]]],[[["usize",15]],["square",3]],[[["brdidx",3]],["square",3]],[[["usize",15]],["usize",15]],[[["brdidx",3]],["usize",15]],[[["usize",15]],["brdidx",3]],[[["brdidx",3]],["moveable",4]],[[["usize",15]],["board",3]],[[["board",3]],["board",3]],[[],["team",4]],[[]],[[],["usize",15]],[[["usize",15]],["squarestate",4]],null,[[]],null,null,null,null,null,[[]],[[]],null,[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[],[["option",4],["vec",3]]],[[],[["vec",3],["option",4]]],[[],["team",4]],[[],["strength",4]],[[],["squarestate",4]],[[],["moveable",4]],[[],["piece",3]],[[],["direction",3]],[[],["square",3]],[[],["brdidx",3]],[[],["board",3]],[[["team",4]],["bool",15]],[[["strength",4]],["bool",15]],[[["squarestate",4]],["bool",15]],[[["moveable",4]],["bool",15]],[[["piece",3]],["bool",15]],[[["piece",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["square",3]],["bool",15]],[[["square",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]]],"p":[[4,"Team"],[4,"Strength"],[4,"SquareState"],[4,"Moveable"],[3,"RowIndexIterator"],[3,"RowSquareIterator"],[3,"Piece"],[3,"Direction"],[3,"Square"],[3,"BrdIdx"],[3,"Board"],[3,"Game"]]}\ }'); initSearch(searchIndex); \ No newline at end of file diff --git a/doc/src/draught/board/enums.rs.html b/doc/src/draught/board/enums.rs.html index 6b53299..c12007c 100644 --- a/doc/src/draught/board/enums.rs.html +++ b/doc/src/draught/board/enums.rs.html @@ -58,6 +58,10 @@ 55 56 57 +58 +59 +60 +61\ No newline at end of file diff --git a/doc/src/draught/board/mod.rs.html b/doc/src/draught/board/mod.rs.html index 4d94cd0..af2a9b6 100644 --- a/doc/src/draught/board/mod.rs.html +++ b/doc/src/draught/board/mod.rs.html @@ -545,7 +545,196 @@ 542 543 544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732extern crate wasm_bindgen; use wasm_bindgen::prelude::*; @@ -113,8 +117,12 @@ #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Moveable { Allowed = 0, - Occupied = 1, - OutOfBounds = 2, + UnoccupiedSrc = 1, + OccupiedDest = 2, + OutOfBounds = 3, + Unplayable = 4, + WrongTeamSrc = 5, + IllegalTrajectory = 6, }+//! Board module for components related to the checkers board and game structure pub mod enums; use enums::*; @@ -559,9 +748,12 @@ extern crate wasm_bindgen; use wasm_bindgen::prelude::*; +/// Standard width of a checkers board is 8 squares pub const STD_WIDTH: usize = 8; +/// Standard height of a checkers board is 8 squares pub const STD_HEIGHT: usize = 8; +/// Model a game piece by its team and strength (normal or kinged) #[wasm_bindgen] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Piece { @@ -577,15 +769,25 @@ } } +/// Model the standard diagonal movements by north west/east etc +/// +/// Used as an absolute measure, i.e. not relative to the team making a move +/// +/// Use options for when movements are blocked/unallowed contextually #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Direction<T: Clone + Copy> { + /// North West nw: Option<T>, + /// North East ne: Option<T>, + /// South East se: Option<T>, + /// South West sw: Option<T>, } impl<T: Clone + Copy> Direction<T> { + /// Create an empty direction full of [`Option::None`] pub fn empty() -> Direction<T> { Direction { nw: Option::None, @@ -596,10 +798,13 @@ } } +/// Model board squares by a state and a possible occupying game piece #[wasm_bindgen] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Square { + /// Game piece if square is occupied occupant: Option<Piece>, + /// Description of whether the square is occupied or an unplayable, i.e. off-lattice square state: SquareState } @@ -612,6 +817,7 @@ } } +/// Model a rank 2 tensor index to identify a board square by row and column #[wasm_bindgen] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct BrdIdx { @@ -628,6 +834,12 @@ } } +impl Display for BrdIdx { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "({}, {})", self.row, self.col) + } +} + /////////////// // BOARD /////////////// @@ -636,6 +848,7 @@ #[wasm_bindgen] #[derive(Clone)] pub struct Board { + /// 1D backing array of board squares for the 2D game board cells: Vec<Square>, width: usize, height: usize, @@ -644,10 +857,18 @@ } impl Board { + /// Get a mutable reference to a board square by 1D array index pub fn cell_mut(&mut self, idx: usize) -> &mut Square { &mut self.cells[idx] } + /// Get the 1D array indices for the diagonally adjacent squares of a given board square + /// + /// # Returns + /// [`None`]: If the given square is unplayable + /// + /// Some(Vec<usize>): A variable length vector of 1D indices for diagonally adjacent squares. + /// Vector may be between 1 and 4 items long depending on the location of the given square pub fn diagonal_indices(&self, idx: BrdIdx) -> Option<Vec<usize>> { if self.cell_state(self.cell_idx(idx)) == SquareState::Unplayable { return None; @@ -657,21 +878,18 @@ let width_idx = self.width - 1; let mut cells = Vec::with_capacity(4); - let mut dir = Direction::empty(); if idx.row > 0 { if idx.col > 0 { cells.push( self.cell_index(idx.row - 1, idx.col - 1) ); - dir.nw = Option::Some(self.cell(self.cell_index(idx.row - 1, idx.col - 1))); } if idx.col < width_idx { cells.push( self.cell_index(idx.row - 1, idx.col + 1) ); - dir.ne = Option::Some(self.cell(self.cell_index(idx.row - 1, idx.col + 1))); } } @@ -680,22 +898,61 @@ cells.push( self.cell_index(idx.row + 1, idx.col - 1) ); - dir.sw = Option::Some(self.cell(self.cell_index(idx.row + 1, idx.col - 1))); } if idx.col < width_idx { cells.push( self.cell_index(idx.row + 1, idx.col + 1) ); - dir.se = Option::Some(self.cell(self.cell_index(idx.row + 1, idx.col + 1))); } } cells.shrink_to_fit(); Some(cells) - // Some(dir) } + /// Get a [`Direction`] structure for the diagonally adjacent squares of a given board square + /// + /// Similar to the [`Board::diagonal_indices`] function with differently formatted results + /// + /// # Returns + /// [`None`]: If the given square is unplayable + /// + /// Some(Direction<Square>): A [`Direction`] structure for the diagonally adjacent squares. + pub fn adjacent_dir(&self, idx: BrdIdx) -> Option<Direction<Square>> { + if self.cell_state(self.cell_idx(idx)) == SquareState::Unplayable { + return None; + } + + let height_idx = self.height - 1; + let width_idx = self.width - 1; + + let mut dir = Direction::empty(); + + if idx.row > 0 { + if idx.col > 0 { + dir.nw = Option::Some(self.cell(self.cell_index(idx.row - 1, idx.col - 1))); + } + + if idx.col < width_idx { + dir.ne = Option::Some(self.cell(self.cell_index(idx.row - 1, idx.col + 1))); + } + } + + if idx.row < height_idx { + if idx.col > 0 { + dir.sw = Option::Some(self.cell(self.cell_index(idx.row + 1, idx.col - 1))); + } + + if idx.col < width_idx { + dir.se = Option::Some(self.cell(self.cell_index(idx.row + 1, idx.col + 1))); + } + } + + Some(dir) + } + + /// Filter an array of diagonal indices (Like those from [`Board::diagonal_indices`], [`Board::jumpable_indices`]) for those that are legal for a team's man, i.e. solely up or down the board pub fn filter_indices(&self, idx: BrdIdx, player: Team, indices: Vec<usize>) -> Vec<usize> { indices.into_iter().filter(|i| { match player { @@ -712,6 +969,13 @@ } } + /// Get the 1D array indices for the diagonally jumpable squares of a given board square + /// + /// # Returns + /// [`None`]: If the given square is unplayable + /// + /// Some(Vec<usize>): A variable length vector of 1D indices for diagonally jumpable squares. + /// Vector may be between 1 and 4 items long depending on the location of the given square pub fn jumpable_indices(&self, idx: BrdIdx) -> Option<Vec<usize>> { if self.cell_state(self.cell_idx(idx)) == SquareState::Unplayable { return None; @@ -754,6 +1018,47 @@ Some(cells) } + /// Get a [`Direction`] structure for the diagonally jumpable squares of a given board square + /// + /// Similar to the [`Board::jumpable_indices`] function with differently formatted results + /// + /// # Returns + /// [`None`]: If the given square is unplayable + /// + /// Some(Direction<Square>): A [`Direction`] structure for the diagonally jumpable squares. + pub fn jumpable_dir(&self, idx: BrdIdx) -> Option<Direction<Square>> { + if self.cell_state(self.cell_idx(idx)) == SquareState::Unplayable { + return None; + } + + let height_idx = self.height - 1; + let width_idx = self.width - 1; + + let mut dir = Direction::empty(); + + if idx.row > 1 { + if idx.col > 1 { + dir.nw = Option::Some(self.cell(self.cell_index(idx.row - 2, idx.col - 2))); + } + + if idx.col < width_idx - 1 { + dir.ne = Option::Some(self.cell(self.cell_index(idx.row - 2, idx.col + 2))); + } + } + + if idx.row < height_idx - 1 { + if idx.col > 1 { + dir.sw = Option::Some(self.cell(self.cell_index(idx.row + 2, idx.col - 2))); + } + + if idx.col < width_idx - 1 { + dir.se = Option::Some(self.cell(self.cell_index(idx.row + 2, idx.col + 2))); + } + } + + Some(dir) + } + pub fn player_jumpable_indices(&self, idx: BrdIdx, player: Team) -> Option<Vec<usize>> { match self.jumpable_indices(idx) { Some(x) => Some(self.filter_indices(idx, player, x)), @@ -764,32 +1069,98 @@ #[wasm_bindgen] impl Board { + /// Get a copy of a board square by 1D array index pub fn cell(&self, idx: usize) -> Square { self.cells[idx] } + /// Get a copy of a board square by 2D [`BrdIdx`] index pub fn grid_cell(&self, idx: BrdIdx) -> Square { self.cell(self.cell_idx(idx)) } + /// Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`] pub fn cell_index(&self, row: usize, col: usize) -> usize { (row * self.width) + col } + /// Similar to [`Board::cell_index`] but with a [`BrdIdx`] instead of separate indices. Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`] pub fn cell_idx(&self, idx: BrdIdx) -> usize { self.cell_index(idx.row, idx.col) } + /// Transform a 1D array index (for [`Board::cells`]) into a 2D game board index (by row/col) pub fn board_index(&self, idx: usize) -> BrdIdx { let row = idx / self.width; let col = idx - (row * self.width); BrdIdx::from(row, col) } - // pub fn can_move(&self, from: BrdIdx, to: BrdIdx) -> bool { - // let diagonals = self.diagonal_indices(from); - // } + pub fn can_move(&self, from: BrdIdx, to: BrdIdx) -> Moveable { + if from.row > self.height - 1 || from.col > self.width - 1 { + return Moveable::OutOfBounds; + } + + let from_square = self.cell(self.cell_idx(from)); + + match from_square.state { + Empty => return Moveable::UnoccupiedSrc, + Unplayable => return Moveable::Unplayable, + Occupied => { + + // if its not the current teams piece then error + match from_square.occupant { + None => panic!("Square is apparently occupied, but no occupant was found from: {}, to: {}, square: {:?}", from, to, from_square), + Some(x) => { + + // piece in the source square is not for the current turn's player + if x.team != self.current_turn { + return Moveable::WrongTeamSrc; + } + + // TODO: refactor to a IsMove()/IsJump() to check whether the move has a legal trajectory + match x.strength { + Man => { + match self.current_turn { + Black => { + + }, + White => { + + }, + }; + }, + King => { + match self.current_turn { + Black => { + + }, + White => { + + }, + }; + }, + }; + + // let diagonal = self.adjacent_dir(from); + // let allowable_squares = Vec::with_capacity(4); + + let jumpable = self.jumpable_dir(from); + } + } + }, + } + + // let is_adjacent = match self.current_turn { + // Team::Black => diagonal.nw, + // Team::White => {}, + // } + + Moveable::Allowed + } + + /// Iniitalise a game board without game pieces pub fn new(width: usize, height: usize) -> Board { let total_cells = width * height; @@ -818,6 +1189,7 @@ } } + /// Reset the given board to a starting layout with 3 rows of opposing pieces pub fn init_game(board: Board) -> Board { let mut new_board = board.clone(); for (idx, row) in RowSquareIterator::new(&board).enumerate() { @@ -850,18 +1222,22 @@ new_board } + /// Get the [`Board::current_turn`] parameter pub fn current_turn(&self) -> Team { self.current_turn } + /// Get a pointer to the backing array of board squares, [`Board::cells`] pub fn cells(&self) -> *const Square { self.cells.as_ptr() } + /// Get the number of board squares pub fn num_cells(&self) -> usize { self.cells.len() } + /// Get the state of a board square by 1D array index pub fn cell_state(&self, idx: usize) -> SquareState { self.cell(idx).state } @@ -1072,11 +1448,11 @@ assert_eq!(Some(vec![42]), board.jumpable_indices(BrdIdx::from(7, 0))); } - #[wasm_bindgen_test] - fn init_game() { - let board = Board::init_game(Board::new(8, 8)); - log!("{}", board); - } + // #[wasm_bindgen_test] + // fn init_game() { + // let board = Board::init_game(Board::new(8, 8)); + // log!("{}", board); + // } #[wasm_bindgen_test] fn black_diagonal_indices() { diff --git a/doc/src/draught/game.rs.html b/doc/src/draught/game.rs.html index f7c12e0..d271142 100644 --- a/doc/src/draught/game.rs.html +++ b/doc/src/draught/game.rs.html @@ -13,6 +13,7 @@ 10 11 12 +13use crate::board::Board; use indextree::Arena; @@ -20,6 +21,7 @@ extern crate wasm_bindgen; use wasm_bindgen::prelude::*; +/// Root-level structure for managing the game as a collection of board states #[wasm_bindgen] pub struct Game { current: Board, diff --git a/doc/src/draught/lib.rs.html b/doc/src/draught/lib.rs.html index df33c6e..11823f5 100644 --- a/doc/src/draught/lib.rs.html +++ b/doc/src/draught/lib.rs.html @@ -29,7 +29,19 @@ 26 27 28 +29 +30 +31 +32 +33 +34 +35 +36+//! Draught +//! +//! An implementation of checkers/draughts in Rust WebAssembly with a minimax AI player + pub mod board; pub mod utils; pub mod game; @@ -37,12 +49,16 @@ extern crate wasm_bindgen; use wasm_bindgen::prelude::*; +pub use board::Board; +pub use game::Game; + // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. // #[cfg(feature = "wee_alloc")] // #[global_allocator] // static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +/// Wrap the [`web_sys`] access to the browser console in a macro for easy logging #[macro_export] macro_rules! log { ( $( $t:tt )* ) => { diff --git a/index_js.bootstrap.js b/index_js.bootstrap.js index 38c813a..bebefe9 100644 --- a/index_js.bootstrap.js +++ b/index_js.bootstrap.js @@ -15,7 +15,7 @@ /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__) => {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"init_game\": () => (/* binding */ init_game),\n/* harmony export */ \"Team\": () => (/* binding */ Team),\n/* harmony export */ \"Strength\": () => (/* binding */ Strength),\n/* harmony export */ \"SquareState\": () => (/* binding */ SquareState),\n/* harmony export */ \"Moveable\": () => (/* binding */ Moveable),\n/* harmony export */ \"Board\": () => (/* binding */ Board),\n/* harmony export */ \"BrdIdx\": () => (/* binding */ BrdIdx),\n/* harmony export */ \"Game\": () => (/* binding */ Game),\n/* harmony export */ \"Piece\": () => (/* binding */ Piece),\n/* harmony export */ \"Square\": () => (/* binding */ Square),\n/* harmony export */ \"__wbindgen_string_new\": () => (/* binding */ __wbindgen_string_new),\n/* harmony export */ \"__wbindgen_object_drop_ref\": () => (/* binding */ __wbindgen_object_drop_ref),\n/* harmony export */ \"__wbg_log_9a99fb1af846153b\": () => (/* binding */ __wbg_log_9a99fb1af846153b),\n/* harmony export */ \"__wbg_new_59cb74e423758ede\": () => (/* binding */ __wbg_new_59cb74e423758ede),\n/* harmony export */ \"__wbg_stack_558ba5917b466edd\": () => (/* binding */ __wbg_stack_558ba5917b466edd),\n/* harmony export */ \"__wbg_error_4bb6c2a97407129a\": () => (/* binding */ __wbg_error_4bb6c2a97407129a),\n/* harmony export */ \"__wbindgen_throw\": () => (/* binding */ __wbindgen_throw)\n/* harmony export */ });\n/* harmony import */ var _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./draught_bg.wasm */ \"../pkg/draught_bg.wasm\");\n/* module decorator */ module = __webpack_require__.hmd(module);\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__]);\n_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? await __webpack_async_dependencies__ : __webpack_async_dependencies__)[0];\n\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n return instance.ptr;\n}\n/**\n*/\nfunction init_game() {\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.init_game();\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n/**\n*/\nconst Team = Object.freeze({ Black:0,\"0\":\"Black\",White:1,\"1\":\"White\", });\n/**\n*/\nconst Strength = Object.freeze({ Man:0,\"0\":\"Man\",King:1,\"1\":\"King\", });\n/**\n*/\nconst SquareState = Object.freeze({ Empty:0,\"0\":\"Empty\",Occupied:1,\"1\":\"Occupied\",Unplayable:2,\"2\":\"Unplayable\", });\n/**\n*/\nconst Moveable = Object.freeze({ Allowed:0,\"0\":\"Allowed\",Occupied:1,\"1\":\"Occupied\",OutOfBounds:2,\"2\":\"OutOfBounds\", });\n/**\n* Models a single state for a checkers board\n*/\nclass Board {\n\n static __wrap(ptr) {\n const obj = Object.create(Board.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_board_free(ptr);\n }\n /**\n * @param {number} idx\n * @returns {Square}\n */\n cell(idx) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell(this.ptr, idx);\n return Square.__wrap(ret);\n }\n /**\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n grid_cell(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_grid_cell(this.ptr, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * @param {number} row\n * @param {number} col\n * @returns {number}\n */\n cell_index(row, col) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell_index(this.ptr, row, col);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} idx\n * @returns {number}\n */\n cell_idx(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell_idx(this.ptr, ptr0);\n return ret >>> 0;\n }\n /**\n * @param {number} idx\n * @returns {BrdIdx}\n */\n board_index(idx) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_board_index(this.ptr, idx);\n return BrdIdx.__wrap(ret);\n }\n /**\n * @param {number} width\n * @param {number} height\n * @returns {Board}\n */\n static new(width, height) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_new(width, height);\n return Board.__wrap(ret);\n }\n /**\n * @param {Board} board\n * @returns {Board}\n */\n static init_game(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_init_game(ptr0);\n return Board.__wrap(ret);\n }\n /**\n * @returns {number}\n */\n current_turn() {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * @returns {number}\n */\n cells() {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cells(this.ptr);\n return ret;\n }\n /**\n * @returns {number}\n */\n num_cells() {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_num_cells(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} idx\n * @returns {number}\n */\n cell_state(idx) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell_state(this.ptr, idx);\n return ret >>> 0;\n }\n}\n/**\n*/\nclass BrdIdx {\n\n static __wrap(ptr) {\n const obj = Object.create(BrdIdx.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_brdidx_free(ptr);\n }\n /**\n * @param {number} row\n * @param {number} col\n * @returns {BrdIdx}\n */\n static from(row, col) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.brdidx_from(row, col);\n return BrdIdx.__wrap(ret);\n }\n}\n/**\n*/\nclass Game {\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_game_free(ptr);\n }\n}\n/**\n*/\nclass Piece {\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_piece_free(ptr);\n }\n}\n/**\n*/\nclass Square {\n\n static __wrap(ptr) {\n const obj = Object.create(Square.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_square_free(ptr);\n }\n}\n\nfunction __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nfunction __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nfunction __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nfunction __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nfunction __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_malloc, _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nfunction __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_free(arg0, arg1);\n }\n};\n\nfunction __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n\n});\n\n//# sourceURL=webpack://draught/../pkg/draught_bg.js?"); +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__) => {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"init_game\": () => (/* binding */ init_game),\n/* harmony export */ \"Team\": () => (/* binding */ Team),\n/* harmony export */ \"Strength\": () => (/* binding */ Strength),\n/* harmony export */ \"SquareState\": () => (/* binding */ SquareState),\n/* harmony export */ \"Moveable\": () => (/* binding */ Moveable),\n/* harmony export */ \"Board\": () => (/* binding */ Board),\n/* harmony export */ \"BrdIdx\": () => (/* binding */ BrdIdx),\n/* harmony export */ \"Game\": () => (/* binding */ Game),\n/* harmony export */ \"Piece\": () => (/* binding */ Piece),\n/* harmony export */ \"Square\": () => (/* binding */ Square),\n/* harmony export */ \"__wbindgen_string_new\": () => (/* binding */ __wbindgen_string_new),\n/* harmony export */ \"__wbindgen_object_drop_ref\": () => (/* binding */ __wbindgen_object_drop_ref),\n/* harmony export */ \"__wbg_log_9a99fb1af846153b\": () => (/* binding */ __wbg_log_9a99fb1af846153b),\n/* harmony export */ \"__wbg_new_59cb74e423758ede\": () => (/* binding */ __wbg_new_59cb74e423758ede),\n/* harmony export */ \"__wbg_stack_558ba5917b466edd\": () => (/* binding */ __wbg_stack_558ba5917b466edd),\n/* harmony export */ \"__wbg_error_4bb6c2a97407129a\": () => (/* binding */ __wbg_error_4bb6c2a97407129a),\n/* harmony export */ \"__wbindgen_throw\": () => (/* binding */ __wbindgen_throw)\n/* harmony export */ });\n/* harmony import */ var _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./draught_bg.wasm */ \"../pkg/draught_bg.wasm\");\n/* module decorator */ module = __webpack_require__.hmd(module);\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__]);\n_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? await __webpack_async_dependencies__ : __webpack_async_dependencies__)[0];\n\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n return instance.ptr;\n}\n/**\n*/\nfunction init_game() {\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.init_game();\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(_draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n/**\n*/\nconst Team = Object.freeze({ Black:0,\"0\":\"Black\",White:1,\"1\":\"White\", });\n/**\n*/\nconst Strength = Object.freeze({ Man:0,\"0\":\"Man\",King:1,\"1\":\"King\", });\n/**\n*/\nconst SquareState = Object.freeze({ Empty:0,\"0\":\"Empty\",Occupied:1,\"1\":\"Occupied\",Unplayable:2,\"2\":\"Unplayable\", });\n/**\n*/\nconst Moveable = Object.freeze({ Allowed:0,\"0\":\"Allowed\",UnoccupiedSrc:1,\"1\":\"UnoccupiedSrc\",OccupiedDest:2,\"2\":\"OccupiedDest\",OutOfBounds:3,\"3\":\"OutOfBounds\",Unplayable:4,\"4\":\"Unplayable\",WrongTeamSrc:5,\"5\":\"WrongTeamSrc\",IllegalTrajectory:6,\"6\":\"IllegalTrajectory\", });\n/**\n* Models a single state for a checkers board\n*/\nclass Board {\n\n static __wrap(ptr) {\n const obj = Object.create(Board.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_board_free(ptr);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @returns {Square}\n */\n cell(idx) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell(this.ptr, idx);\n return Square.__wrap(ret);\n }\n /**\n * Get a copy of a board square by 2D [`BrdIdx`] index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n grid_cell(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_grid_cell(this.ptr, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {number} row\n * @param {number} col\n * @returns {number}\n */\n cell_index(row, col) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell_index(this.ptr, row, col);\n return ret >>> 0;\n }\n /**\n * Similar to [`Board::cell_index`] but with a [`BrdIdx`] instead of separate indices. Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {BrdIdx} idx\n * @returns {number}\n */\n cell_idx(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell_idx(this.ptr, ptr0);\n return ret >>> 0;\n }\n /**\n * Transform a 1D array index (for [`Board::cells`]) into a 2D game board index (by row/col)\n * @param {number} idx\n * @returns {BrdIdx}\n */\n board_index(idx) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_board_index(this.ptr, idx);\n return BrdIdx.__wrap(ret);\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n can_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_can_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Iniitalise a game board without game pieces\n * @param {number} width\n * @param {number} height\n * @returns {Board}\n */\n static new(width, height) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_new(width, height);\n return Board.__wrap(ret);\n }\n /**\n * Reset the given board to a starting layout with 3 rows of opposing pieces\n * @param {Board} board\n * @returns {Board}\n */\n static init_game(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_init_game(ptr0);\n return Board.__wrap(ret);\n }\n /**\n * Get the [`Board::current_turn`] parameter\n * @returns {number}\n */\n current_turn() {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get a pointer to the backing array of board squares, [`Board::cells`]\n * @returns {number}\n */\n cells() {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cells(this.ptr);\n return ret;\n }\n /**\n * Get the number of board squares\n * @returns {number}\n */\n num_cells() {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_num_cells(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the state of a board square by 1D array index\n * @param {number} idx\n * @returns {number}\n */\n cell_state(idx) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.board_cell_state(this.ptr, idx);\n return ret >>> 0;\n }\n}\n/**\n* Model a rank 2 tensor index to identify a board square by row and column\n*/\nclass BrdIdx {\n\n static __wrap(ptr) {\n const obj = Object.create(BrdIdx.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_brdidx_free(ptr);\n }\n /**\n * @param {number} row\n * @param {number} col\n * @returns {BrdIdx}\n */\n static from(row, col) {\n var ret = _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.brdidx_from(row, col);\n return BrdIdx.__wrap(ret);\n }\n}\n/**\n* Root-level structure for managing the game as a collection of board states\n*/\nclass Game {\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_game_free(ptr);\n }\n}\n/**\n* Model a game piece by its team and strength (normal or kinged)\n*/\nclass Piece {\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_piece_free(ptr);\n }\n}\n/**\n* Model board squares by a state and a possible occupying game piece\n*/\nclass Square {\n\n static __wrap(ptr) {\n const obj = Object.create(Square.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_square_free(ptr);\n }\n}\n\nfunction __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nfunction __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nfunction __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nfunction __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nfunction __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_malloc, _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nfunction __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n _draught_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_free(arg0, arg1);\n }\n};\n\nfunction __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n\n});\n\n//# sourceURL=webpack://draught/../pkg/draught_bg.js?"); /***/ }), @@ -26,7 +26,7 @@ eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__ /***/ ((module, exports, __webpack_require__) => { "use strict"; -eval("var __webpack_instantiate__ = ([WEBPACK_IMPORTED_MODULE_0]) => {\n\treturn __webpack_require__.v(exports, module.id, \"4d68ea94c77e642d94c7\", {\n\t\t\"./draught_bg.js\": {\n\t\t\t\"__wbindgen_string_new\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_string_new,\n\t\t\t\"__wbindgen_object_drop_ref\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_object_drop_ref,\n\t\t\t\"__wbg_log_9a99fb1af846153b\": WEBPACK_IMPORTED_MODULE_0.__wbg_log_9a99fb1af846153b,\n\t\t\t\"__wbg_new_59cb74e423758ede\": WEBPACK_IMPORTED_MODULE_0.__wbg_new_59cb74e423758ede,\n\t\t\t\"__wbg_stack_558ba5917b466edd\": WEBPACK_IMPORTED_MODULE_0.__wbg_stack_558ba5917b466edd,\n\t\t\t\"__wbg_error_4bb6c2a97407129a\": WEBPACK_IMPORTED_MODULE_0.__wbg_error_4bb6c2a97407129a,\n\t\t\t\"__wbindgen_throw\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_throw\n\t\t}\n\t});\n}\n__webpack_require__.a(module, (__webpack_handle_async_dependencies__) => {\n\t/* harmony import */ var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__(/*! ./draught_bg.js */ \"../pkg/draught_bg.js\");\n\tvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([WEBPACK_IMPORTED_MODULE_0]);\n\treturn __webpack_async_dependencies__.then ? __webpack_async_dependencies__.then(__webpack_instantiate__) : __webpack_instantiate__(__webpack_async_dependencies__);\n}, 1);\n\n//# sourceURL=webpack://draught/../pkg/draught_bg.wasm?"); +eval("var __webpack_instantiate__ = ([WEBPACK_IMPORTED_MODULE_0]) => {\n\treturn __webpack_require__.v(exports, module.id, \"8728f958432289f02420\", {\n\t\t\"./draught_bg.js\": {\n\t\t\t\"__wbindgen_string_new\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_string_new,\n\t\t\t\"__wbindgen_object_drop_ref\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_object_drop_ref,\n\t\t\t\"__wbg_log_9a99fb1af846153b\": WEBPACK_IMPORTED_MODULE_0.__wbg_log_9a99fb1af846153b,\n\t\t\t\"__wbg_new_59cb74e423758ede\": WEBPACK_IMPORTED_MODULE_0.__wbg_new_59cb74e423758ede,\n\t\t\t\"__wbg_stack_558ba5917b466edd\": WEBPACK_IMPORTED_MODULE_0.__wbg_stack_558ba5917b466edd,\n\t\t\t\"__wbg_error_4bb6c2a97407129a\": WEBPACK_IMPORTED_MODULE_0.__wbg_error_4bb6c2a97407129a,\n\t\t\t\"__wbindgen_throw\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_throw\n\t\t}\n\t});\n}\n__webpack_require__.a(module, (__webpack_handle_async_dependencies__) => {\n\t/* harmony import */ var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__(/*! ./draught_bg.js */ \"../pkg/draught_bg.js\");\n\tvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([WEBPACK_IMPORTED_MODULE_0]);\n\treturn __webpack_async_dependencies__.then ? __webpack_async_dependencies__.then(__webpack_instantiate__) : __webpack_instantiate__(__webpack_async_dependencies__);\n}, 1);\n\n//# sourceURL=webpack://draught/../pkg/draught_bg.wasm?"); /***/ }),