games.battleship.utils¶
Battleship game utility functions.
- This module provides helper functions for the Battleship game, including:
Board visualization
Coordinate formatting
Game status checking
Functions¶
|
Calculate game statistics from move history. |
|
Check if all required ships have been placed. |
|
Format a list of coordinates for display. |
|
Format a list of ship types for display. |
|
Create a string representation of the Battleship board. |
Module Contents¶
- games.battleship.utils.calculate_game_stats(move_history)¶
Calculate game statistics from move history.
- games.battleship.utils.check_all_ships_placed(ship_placements)¶
Check if all required ships have been placed.
- games.battleship.utils.format_coordinates_list(coords_list)¶
Format a list of coordinates for display.
- games.battleship.utils.format_ship_types(ship_types)¶
Format a list of ship types for display.
- games.battleship.utils.visualize_board(board, is_opponent=False)¶
Create a string representation of the Battleship board.