示例#1
0
    def test_game_no_raise_player_A_starts(self):
        world = WorldTotalWatten()
        world.LOG.setLevel(DEBUG)

        world.init_world_to_state(-1, 1, 0, 0, [28, 29, 3, 15, 22],
                                  [19, 14, 7, 0, 11], [], 0, 0, 2, False,
                                  False, None, 18, 21, None, None)

        # [39, 44, 0, 46, 48, 3, 29, 46, 48, 14, 11, 15]
        world_copy = world.deepcopy()

        ######## MOVE ########
        valid_moves = world.get_valid_moves()

        outcome, next_player = world.act(0, self.agent)  # rank
        outcome, next_player = world.act(0, self.agent)  # suit
        outcome, next_player = world.act(0, self.agent)  # card
        outcome, next_player = world.act(1, self.agent)  # raise
        outcome, next_player = world.act(3, self.agent)  # accepted raise
        outcome, next_player = world.act(0, self.agent)  # card --
        outcome, next_player = world.act(1, self.agent)  # raise
        outcome, next_player = world.act(3, self.agent)  # accepted raise
        outcome, next_player = world.act(0, self.agent)  # card --
        outcome, next_player = world.act(0, self.agent)  # card
        outcome, next_player = world.act(0, self.agent)  # card
        outcome, next_player = world.act(0, self.agent)  # card
        world.get_valid_moves()
示例#2
0
    def test_get_valid_moves_last_move_accepted_raise(self):
        world = WorldTotalWatten()

        world.is_last_move_accepted_raise = True

        valid_moves = world.get_valid_moves()

        # after an accepted raise a player can't raise again
        self.assertNotIn(1, valid_moves)
示例#3
0
    def test_get_valid_moves_last_move_raise(self):
        world = WorldTotalWatten()

        world.is_last_move_raise = True

        valid_moves = world.get_valid_moves()

        # after a raise a player can only accept it or fold
        self.assertEqual([2, 3], valid_moves)
示例#4
0
    def test_get_valid_moves_normal(self):
        world = WorldTotalWatten()

        world.refresh()

        # opponent player declare the rank
        # valid moves: MAKE_BEST_MOVE + RAISE POINTS
        valid_moves = world.get_valid_moves()
        self.assertEqual([0, 1], valid_moves)
示例#5
0
    def test_get_valid_moves_last_move_raise_last_hand(self):
        world = WorldTotalWatten()

        world.is_last_move_raise = True
        world.is_last_hand_raise_valid = True

        valid_moves = world.get_valid_moves()

        # after a raise in last hand a player can only accept, fold, or fold and verify conditions for raise in last hand
        self.assertEqual([2, 3, 4], valid_moves)