[−][src]Struct spacebattleship::game::simple::Game
Simplified game that uses a fixed set of ships and players.
Implementations
impl Game
[src]
pub fn current(&self) -> Player
[src]
Get the player whose turn it currently is.
pub fn winner(&self) -> Option<Player>
[src]
Get the status of the game. Returns None
if the game is in progress, otherwise
returns the winner.
pub fn iter_board<'a>(
&'a self,
player: Player
) -> impl 'a + Iterator<Item = impl 'a + Iterator<Item = CellRef<'a>>>
[src]
&'a self,
player: Player
) -> impl 'a + Iterator<Item = impl 'a + Iterator<Item = CellRef<'a>>>
Get an iterator over the specified player's board. The iterator's item is another iterator that iterates over a single row.
pub fn iter_ships<'a>(
&'a self,
player: Player
) -> impl 'a + Iterator<Item = ShipRef<'a>>
[src]
&'a self,
player: Player
) -> impl 'a + Iterator<Item = ShipRef<'a>>
Get an iterator over the specified player's ships.
pub fn get_coord(&self, player: Player, coord: Coordinate) -> Option<CellRef>
[src]
Get a reference to the cell with the specified coordinate in the specified player's board. Return None if the coord is out of bounds.
pub fn get_ship(&self, player: Player, ship: Ship) -> ShipRef
[src]
Get a reference to the specified ship from the specified player's board.
pub fn shoot(
&mut self,
target: Player,
coord: Coordinate
) -> Result<ShotOutcome, CannotShootReason>
[src]
&mut self,
target: Player,
coord: Coordinate
) -> Result<ShotOutcome, CannotShootReason>
Fire at the specified player on the specified coordinate.
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
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,