def __init__(self): card_types = (MakiCard(1), MakiCard(2), MakiCard(3), PuddingCard(), NigiriCard('egg'), NigiriCard('salmon'), NigiriCard('squid'), TempuraCard(), SashimiCard(), DumplingCard(), WasabiCard()) card_counts = (7, 7, 7, 8, 6, 6, 5, 10, 10, 15, 4) super().__init__(*self.create_card_list(card_types, card_counts))
def test_nigiri_scores(): cards = { 'a': [NigiriCard('egg')], 'b': [NigiriCard('squid')], 'c': [SashimiCard(), NigiriCard('salmon'), NigiriCard('egg')] } scores = get_score(cards) assert scores['a'] == 1 assert scores['b'] == 3 assert scores['c'] == 3
def test_simple_one_winner_one_round(): p1 = Player("bob") p2 = Player("sharon") d = Deck.create([NigiriCard('egg'), NigiriCard('salmon')], [19, 1]) g = Game(deck=d, agents=[p1, p2], cards_per_player=10, n_rounds=1) g.play_round() bob_log = g.gamelog[g.gamelog['player'] == 'bob'] bob_final_reward = bob_log['reward'].iloc[-1] sharon_log = g.gamelog[g.gamelog['player'] == 'sharon'] sharon_final_reward = sharon_log['reward'].iloc[-1] print(g.gamelog) assert g.gamelog.shape[0] == 22 assert (bob_final_reward == 10.) or (bob_final_reward == 11.) assert (sharon_final_reward == 10.) or (sharon_final_reward == 11.)
def test_wasabi_scores(): cards = { 'a': [WasabiCard(), WasabiCard(), NigiriCard('egg'), NigiriCard('egg')], 'b': [WasabiCard(), NigiriCard('squid')], 'c': [SashimiCard(), NigiriCard('salmon'), NigiriCard('egg'), WasabiCard()] } scores = get_score(cards) assert scores['a'] == 6 assert scores['b'] == 9 assert scores['c'] == 3
def simple_egg_score_test(): p1 = Player("bob") p2 = Player("sharon") d = Deck.create([NigiriCard('egg')], [1000]) g = Game(deck=d, agents=[p1, p2], cards_per_player=10) g.play_round() g.play_round() print(g.gamelog) assert g.gamelog.shape[0] == 42 assert g.gamelog['reward'][2] == 0.0 assert g.gamelog['reward'][3] == 0.0
def test_complicated_score(): cards = { 'a': [ SashimiCard(), MakiCard(2), MakiCard(1), NigiriCard('egg'), MakiCard(1), DumplingCard(), DumplingCard(), NigiriCard('salmon'), PuddingCard(), DumplingCard() ], 'b': [ DumplingCard(), NigiriCard('squid'), PuddingCard(), NigiriCard('salmon'), WasabiCard(), SashimiCard(), NigiriCard('salmon'), PuddingCard(), NigiriCard('salmon'), TempuraCard() ] } scores = get_score(cards, end_round=True) assert scores['a'] == 6 + 3 + 6 assert scores['b'] == 0 + 13 + 1