/// Moves the player's placement ship in the given direction.
///
/// # Errors
///
/// Returns an error if the player does not have a placement ship, or if the ship could not be
/// moved in `direction` without going out of bounds.
Moves the player's placement ship in the given direction.
Moves the player ' s placement ship in the given direction .
pub fn move_placement_ship(&mut self, direction: Direction) -> Result<(), &'static str> {
        let index = self.ships.len() - 1;
        let old_head = self.ships[index].pos()[0];
        let new_head = self
            .movement(&old_head, direction)
            .ok_or("movement not possible without going out of bounds")?;
        let ship_pos = self
            .get_ship_position(
                new_head,
                self.ships[index].dir(),
                self.ships[index].len() as u8,
            )
            .ok_or("movement not possible without going out of bounds")?;
        self.ships[index].set_pos(ship_pos)?;
        Ok(())
    }
pub fn move_placement_ship ( & mut self , direction : Direction ) -> Result < ( ) , & ' static str > { let index = self . ships . len ( ) - 1 ; let old_head = self . ships [ index ] . pos ( ) [ 0 ] ; let new_head = self . movement ( & old_head , direction ) . ok_or ( " " ) ? ; let ship_pos = self . get_ship_position ( new_head , self . ships [ index ] . dir ( ) , self . ships [ index ] . len ( ) as u8 , ) . ok_or ( " " ) ? ; self . ships [ index ] . set_pos ( ship_pos ) ? ; Ok ( ( ) ) }
Moves the player's placement ship in the given direction.
Moves the player ' s placement ship in the given direction .
&mut self
direction
Direction
errors
Returns an error if the player does not have a placement ship, or if the ship could not be
moved in `direction` without going out of bounds.
Returns an error if the player does not have a placement ship or if the ship could not be moved in ` direction ` without going out of bounds .