def play(self): """ The main driver of the Game. Manages the game until completion. :return: None """ # Report game instructions gh.report_legend() # Initialize ship coordinate for display! list_of_ships_coordinates = list() for ship in self.__ships: list_of_ships_coordinates.extend(ship.coordinates()) # print board to screen print( gh.board_to_string(self.__board_size, self.__hits, self.__bombs, self.__hit_ships, list_of_ships_coordinates)) # print the game board while self.__ships: self.__play_one_round() # When all ship were destroyed gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. completion. :return: None """ gh.report_legend() # prints game legend while len(self.ships) > 0: self.__play_one_round() gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. :return: None """ gh.report_legend() print( gh.board_to_string(self.__board_size, [], self.bombs, [], self.intact_cells)) while self.__game_status != self.GAME_STATUS_OVER: self.__play_one_round() gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. :return: None """ gh.report_legend() self.print_board() while True: if self.__play_one_round() == GAME_STATUS_ENDED: break gh.report_gameover() return None
def play(self): """ The main driver of the Game. Manages the game until completion. :return: None """ gh.report_legend() print( gh.board_to_string(self.__board_size, [], self.__bombs, [], self.not_hitted_coordinates())) # if there is no ships on the game then stop playing! while len(self.__ships) > 0: self.__play_one_round() gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. completion. :return: None """ gh.report_legend() print( gh.board_to_string(self.__board_size, [], self.__bombs, self.__hits, self.get_coordinates_from_ship_list())) while len(self.__ships) > 0: self.__play_one_round() gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. completion. :return: None """ gh.report_legend() all_ships_coordinates = [] for ship in self.__ships: all_ships_coordinates += ship.coordinates() print(gh.board_to_string(self.__board_size, [], self.__bomb_on_board, [], all_ships_coordinates)) while len(self.__ships) != 0: self.__play_one_round() gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. :return: None """ for ship in self.__ships: self.__not_hit_coordinates.extend(ship.coordinates()) gh.report_legend() gh.board_to_string(self.get_board_size(), [], {}, [], deepcopy(self.get_not_hit_coordinates())) ships_quantity = len(self.__ships) while self.__terminated_ships != ships_quantity: self.__play_one_round() return None
def play(self): """ The main driver of the Game. Manages the game until completion. completion. :return: None """ gh.report_legend() print( gh.board_to_string(self.board_size, [], {}, [], self.get_total_ships_coords())) while len(self.terminated_ships) < self.initial_ship_amount: self.__play_one_round() clear_last_bombs = [] for bomb in self.bombs_dict: for ship in self.ships_list: if bomb in ship.coordinates(): clear_last_bombs.append(bomb) for bomb in clear_last_bombs: del self.bombs_dict[bomb] self.ships_list = [] gh.report_gameover()
def play(self): """ The main driver of the Game. Manages the game until completion. completion. Initializes ship's orientation and coordinates. Plays rounds until all ships have been terminated. :return: None """ gh.report_legend() for ship in self.__ships: ship.set_orientation() ship_coords = [ship.coordinates() for ship in self.__ships] ship_coords = [i for lst in ship_coords for i in lst] print(gh.board_to_string(self.__board_size, [], {}, [], ship_coords)) while self.__ships: self.__play_one_round() gh.report_gameover()