pub fn select_space(&mut self, pos: &[u8; 2]) -> Result<(), &'static str> {
        let ref mut opponent = self.players[self.not_turn()];

        opponent.select_space(pos)?;

        // If it's an error, no ship was at the position; and if it's false, the
        // ship wasn't sunk
        if opponent.sink_ship_if_all_hit(pos) == Ok(true) {
            self.state = match opponent.all_ships_sunk() {
                true => GameState::Complete,
                false => GameState::Active,
            };
        }

        Ok(())
    }
/// Selects a space on the inactive player's grid if it's unchecked.
///
/// # Errors
///
/// Returns an error if the inactive player's space at `pos` was already
/// checked.
Selects a space on the inactive player's grid if it's unchecked.
Selects a space on the inactive player ' s grid if it ' s unchecked .
pub fn select_space(&mut self, pos: &[u8; 2]) -> Result<(), &'static str> {
        let ref mut opponent = self.players[self.not_turn()];
        opponent.select_space(pos)?;
        // If it's an error, no ship was at the position; and if it's false, the
        // ship wasn't sunk
        if opponent.sink_ship_if_all_hit(pos) == Ok(true) {
            self.state = match opponent.all_ships_sunk() {
                true => GameState::Complete,
                false => GameState::Active,
            };
        }
        Ok(())
    }
pub fn select_space ( & mut self , pos : & [ u8 ; 2 ] ) -> Result < ( ) , & ' static str > { let ref mut opponent = self . players [ self . not_turn ( ) ] ; opponent . select_space ( pos ) ? ; // If it's an error, no ship was at the position; and if it's false, the // ship wasn't sunk if opponent . sink_ship_if_all_hit ( pos ) == Ok ( true ) { self . state = match opponent . all_ships_sunk ( ) { true => GameState :: Complete , false => GameState :: Active , } ; } Ok ( ( ) ) }
Selects a space on the inactive player's grid if it's unchecked.
Selects a space on the inactive player ' s grid if it ' s unchecked .
&mut self
pos
&[u8; 2]
&mut self
pos
&[u8; 2]
errors
Returns an error if the inactive player's space at `pos` was already
checked.
Returns an error if the inactive player ' s space at ` pos ` was already checked .