pub struct Board {
pub size: u16,
// some fields omitted
}
A Hex board of a given size, with pieces placed. The maximum size is 26, due to the limitations of
the standard Hex coordinate system.
The size of the board: both width and length. The size should be no larger than 26 due to the
limitations of the Hex coordinate system. It's a u16 because, when mapping coordinates to
numbers, it will be converted to a u16 enough to just make that the case here.
Initializes a blank board with given size less than or equal to 26.
Places the piece at the given spot if the placement is valid (there are no other pieces and
the coordinate is within range), modifying the board's state and returning true. Otherwise,
does not modify the board state and returns false.
Returns a HexCell
value describing the piece at the given location: Empty
if no piece is
there, Black
if Black has a piece, or White
if White has a piece. If the coordinate is out
of bounds, returns Empty
.
Returns the current game status. This is updated automatically as the game progresses, so this
function has basically no runtime cost.
Returns the "default value" for a type. Read more
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static