Example #1
0
 def __request_next_move(self):
     """
     Request the next move from the subprocess
     :return: A (flag,card) tuple
     """
     self.generator.send_go_play()
     return Play.from_tuple(self.__get_response_or_default((1, None)))
Example #2
0
 def compute_turn(self, board, are_flags_open, last_move):
     """
     Provide the current game state to the supprocess and then ask the
     subprocess for its next move. See Player.compute_turn for more information.
     :param board: The current game board state.
     :param are_flags_open: if there are flags open to play
     :param last_move: The last move taken by the opponent.
     :return: The next Play taken by the subprocess.
     """
     self.__send_game_state(board, last_move)
     return self.__request_next_move(
     ) if are_flags_open else Play.from_tuple((1, None))
Example #3
0
 def test_from_tuple(self):
     play = Play.from_tuple((2, TroopCard(number=3,color="color4")))
     self.assertEquals(play.flag, 2)
     self.assertEquals(play.card, TroopCard(number=3,color="color4"))