[−][src]Struct spacebattleship::game::uniform::Game
Handles gameplay.
Implementations
impl<P: PlayerId, I: ShipId, D: Dimensions> Game<P, I, D>
[src]
pub fn current(&self) -> &P
[src]
Get the ID of the player whose turn it is.
pub fn winner(&self) -> Option<&P>
[src]
Get the status of the game. Returns None
if the game is in progress, otherwise
returns the winner.
pub fn get_board<Q: ?Sized>(&self, pid: &Q) -> Option<&Board<I, D>> where
P: Borrow<Q>,
Q: Eq + Hash,
[src]
P: Borrow<Q>,
Q: Eq + Hash,
Get a reference to the board for the specified player.
pub fn iter_boards(&self) -> impl Iterator<Item = (&P, &Board<I, D>)>
[src]
Iterate the player ids and boards in turn-order.
pub fn shoot(
&mut self,
target: P,
coord: D::Coordinate
) -> Result<ShotOutcome<I>, ShotError<P, D::Coordinate>>
[src]
&mut self,
target: P,
coord: D::Coordinate
) -> Result<ShotOutcome<I>, ShotError<P, D::Coordinate>>
Fire a shot at the specified player, returning the result of the shot or an error if the shot was invalid.
Auto Trait Implementations
impl<P, I, D> RefUnwindSafe for Game<P, I, D> where
D: RefUnwindSafe,
I: RefUnwindSafe,
P: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
D: RefUnwindSafe,
I: RefUnwindSafe,
P: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
impl<P, I, D> Send for Game<P, I, D> where
D: Send,
I: Send,
P: Send,
<D as Dimensions>::Coordinate: Send,
D: Send,
I: Send,
P: Send,
<D as Dimensions>::Coordinate: Send,
impl<P, I, D> Sync for Game<P, I, D> where
D: Sync,
I: Sync,
P: Sync,
<D as Dimensions>::Coordinate: Sync,
D: Sync,
I: Sync,
P: Sync,
<D as Dimensions>::Coordinate: Sync,
impl<P, I, D> Unpin for Game<P, I, D> where
D: Unpin,
I: Unpin,
P: Unpin,
<D as Dimensions>::Coordinate: Unpin,
D: Unpin,
I: Unpin,
P: Unpin,
<D as Dimensions>::Coordinate: Unpin,
impl<P, I, D> UnwindSafe for Game<P, I, D> where
D: UnwindSafe,
I: UnwindSafe,
P: UnwindSafe,
<D as Dimensions>::Coordinate: UnwindSafe,
D: UnwindSafe,
I: UnwindSafe,
P: UnwindSafe,
<D as Dimensions>::Coordinate: UnwindSafe,
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>,