Exemple #1
0
 def place_ships(self, player: Player) -> None:
     """Guide player in placing ships on board."""
     for ship in player.ship_board.ships:
         built = False
         while not built:
             if isinstance(player, Human):
                 os.system('clear')
                 print(f'*** Building {ship} ***')
                 player.show_ship_board()
                 print(f'Ship Length: {len(ship)}')
             bow = player.choose_coordinate()
             direction = player.choose_direction()
             try:
                 built = player.add_ship(ship, bow, direction)
             except ValueError as err:
                 self.log.debug(f'Unable to add ship: {err}')