:py:mod:`socha.api.networking.utils` ==================================== .. py:module:: socha.api.networking.utils Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: socha.api.networking.utils.map_board socha.api.networking.utils.map_card_to_string socha.api.networking.utils.map_string_to_card socha.api.networking.utils.handle_move socha.api.networking.utils.message_to_state .. py:function:: map_board(protocol_board: socha.api.protocol.protocol.Board) -> socha._socha.Board Converts a protocol Board to a usable game board for using in the logic. :param protocol_board: A Board object in protocol format :type protocol_board: Board :return: A Board object in the format used by the game logic :rtype: penguins.Board .. py:function:: map_card_to_string(card: socha._socha.Card) -> str .. py:function:: map_string_to_card(card: str) -> socha._socha.Card .. py:function:: handle_move(move_response: socha._socha.Move) -> socha.api.protocol.protocol.Data .. py:function:: message_to_state(message: socha.api.protocol.protocol.Room, second_last_move: socha._socha.Move) -> socha._socha.GameState Constructs a GameState from the provided message, ensuring to reflect the current state based on the ships' positions, teams, and other attributes. Args: message: The input message containing the current game state. second_last_move: the last_move object from the last game state before this game state Returns: GameState: The constructed game state from the message.