예제 #1
0
    def make_ai_move(game_id):
        """
            Makes a move for the AI.
        """
        GameAService.__LOGGER.debug("Making A Move For Game: %s", game_id)

        # Sleep for a bit so it looks like we're thinking
        time.sleep(randint(1, 15))

        game = GameAService.__get_game(game_id)
        game.take_ai_turn()
        GameAService.__set_game(game)

        PusherUtil.send_event(PusherUtil.REFRESH_GRID_EVENT, game_id)
예제 #2
0
    def make_move(game_id, player_id, card_id, sphere_id):
        """
            Makes a move given on the given game.
        """
        assert isinstance(player_id, str), type(player_id)
        assert isinstance(card_id, str), type(card_id)
        assert isinstance(sphere_id, str), type(sphere_id)
        assert player_id
        assert card_id
        assert sphere_id

        game = GameAService.__get_game(game_id)
        game.take_turn(player_id, card_id, sphere_id)
        GameAService.__set_game(game)

        PusherUtil.send_event(PusherUtil.REFRESH_GRID_EVENT, game_id)