示例#1
0
def test_after_turn_hands_exchange_two_player():
    p1 = Player("bob")
    p2 = Player("sharon")
    game = Game(deck=StandardDeck(), agents=[p1, p2], cards_per_player=10)
    p1_hand_before, p2_hand_before = p1.hand, p2.hand
    game.play_turn()
    assert len(p1.hand) == 9
    assert len(p2.hand) == 9
    assert all([(_ in p2_hand_before) for _ in p1.hand])
    assert all([(_ in p1_hand_before) for _ in p2.hand])
示例#2
0
def test_after_turn_hands_exchange_three_player():
    p1 = Player("bob")
    p2 = Player("sharon")
    p3 = Player("alice")
    game = Game(deck=StandardDeck(), agents=[p1, p2, p3], cards_per_player=8)
    p1_hand_before, p2_hand_before, p3_hand_before = p1.hand, p2.hand, p3.hand
    game.play_turn()
    assert len(p1.hand) == 7
    assert len(p2.hand) == 7
    assert len(p3.hand) == 7
    assert all([(_ in p3_hand_before) for _ in p1.hand])
    assert all([(_ in p2_hand_before) for _ in p3.hand])
    assert all([(_ in p1_hand_before) for _ in p2.hand])
示例#3
0
def test_certain_cards_carry_no_rewards_within_rounds():
    p1 = Player("bob")
    p2 = Player("sharon")
    # create a deck with no cards that are worth points during a round
    d = Deck.create([PuddingCard(), WasabiCard(), MakiCard(3)], [8, 4, 4 * 7])
    g = Game(deck=d, agents=[p1, p2], cards_per_player=5)
    g.play_turn()
    assert g.gamelog.shape[0] == 4
    assert g.gamelog['reward'][0] == 0.0
    assert g.gamelog['reward'][1] == 0.0
    g.play_turn()
    g.play_turn()
    g.play_turn()
    assert g.gamelog['reward'].iloc[-1] == 0.0