diff --git a/tests/games.py b/tests/games.py index f428edb17..d08178be2 100644 --- a/tests/games.py +++ b/tests/games.py @@ -113,27 +113,20 @@ def create_mixed_behav_game_efg() -> gbt.Game: return read_from_file("mixed_behavior_game.efg") -def create_1_card_poker_efg() -> gbt.Game: +def create_stripped_down_poker_efg() -> gbt.Game: """ Returns ------- Game - One-card two-player poker game, as used in the user guide - """ - return read_from_file("poker.efg") - + Stripped-Down Poker: A Classroom Game with Signaling and Bluffing + Reiley et al (2008) -def create_myerson_2_card_poker_efg() -> gbt.Game: - """ - Returns - ------- - Game - Simplied "stripped down" version of Myerson 2-card poker: - Two-player extensive poker game with a chance move with two moves, - then player 1 can raise or fold; after raising player 2 is in an infoset with two nodes - and can choose to meet or pass + Two-player extensive-form poker game between Fred and Alice + Chance deals King or Queen to Fred + Fred can then Bet or Fold; after raising Alice is in an infoset with two nodes + and can choose to Call or Fold """ - return read_from_file("myerson_2_card_poker.efg") + return read_from_file("stripped_down_poker.efg") def create_kuhn_poker_efg() -> gbt.Game: diff --git a/tests/test_actions.py b/tests/test_actions.py index 971a65cbb..72cb506a5 100644 --- a/tests/test_actions.py +++ b/tests/test_actions.py @@ -7,7 +7,7 @@ @pytest.mark.parametrize( "game,label", - [(games.create_myerson_2_card_poker_efg(), "random label")] + [(games.create_stripped_down_poker_efg(), "random label")] ) def test_set_action_label(game: gbt.Game, label: str): game.root.infoset.actions[0].label = label @@ -16,9 +16,9 @@ def test_set_action_label(game: gbt.Game, label: str): @pytest.mark.parametrize( "game,inprobs,outprobs", - [(games.create_myerson_2_card_poker_efg(), + [(games.create_stripped_down_poker_efg(), [0.75, 0.25], [0.75, 0.25]), - (games.create_myerson_2_card_poker_efg(), + (games.create_stripped_down_poker_efg(), ["16/17", "1/17"], [gbt.Rational("16/17"), gbt.Rational("1/17")])] ) def test_set_chance_valid_probability(game: gbt.Game, inprobs: list, outprobs: list): @@ -29,9 +29,9 @@ def test_set_chance_valid_probability(game: gbt.Game, inprobs: list, outprobs: l @pytest.mark.parametrize( "game,inprobs", - [(games.create_myerson_2_card_poker_efg(), [0.75, -0.10]), - (games.create_myerson_2_card_poker_efg(), [0.75, 0.40]), - (games.create_myerson_2_card_poker_efg(), ["foo", "bar"])] + [(games.create_stripped_down_poker_efg(), [0.75, -0.10]), + (games.create_stripped_down_poker_efg(), [0.75, 0.40]), + (games.create_stripped_down_poker_efg(), ["foo", "bar"])] ) def test_set_chance_improper_probability(game: gbt.Game, inprobs: list): with pytest.raises(ValueError): @@ -40,8 +40,8 @@ def test_set_chance_improper_probability(game: gbt.Game, inprobs: list): @pytest.mark.parametrize( "game,inprobs", - [(games.create_myerson_2_card_poker_efg(), [0.25, 0.75, 0.25]), - (games.create_myerson_2_card_poker_efg(), [1.00])] + [(games.create_stripped_down_poker_efg(), [0.25, 0.75, 0.25]), + (games.create_stripped_down_poker_efg(), [1.00])] ) def test_set_chance_bad_dimension(game: gbt.Game, inprobs: list): with pytest.raises(IndexError): @@ -50,7 +50,7 @@ def test_set_chance_bad_dimension(game: gbt.Game, inprobs: list): @pytest.mark.parametrize( "game", - [games.create_myerson_2_card_poker_efg()] + [games.create_stripped_down_poker_efg()] ) def test_set_chance_personal(game: gbt.Game): with pytest.raises(gbt.UndefinedOperationError): @@ -59,7 +59,7 @@ def test_set_chance_personal(game: gbt.Game): @pytest.mark.parametrize( "game", - [games.create_myerson_2_card_poker_efg()] + [games.create_stripped_down_poker_efg()] ) def test_action_precedes(game: gbt.Game): child = game.root.children[0] @@ -69,7 +69,7 @@ def test_action_precedes(game: gbt.Game): @pytest.mark.parametrize( "game", - [games.create_myerson_2_card_poker_efg()] + [games.create_stripped_down_poker_efg()] ) def test_action_precedes_nonnode(game: gbt.Game): with pytest.raises(TypeError): @@ -78,7 +78,7 @@ def test_action_precedes_nonnode(game: gbt.Game): @pytest.mark.parametrize( "game", - [games.create_myerson_2_card_poker_efg()] + [games.create_stripped_down_poker_efg()] ) def test_action_delete_personal(game: gbt.Game): node = game.players[0].infosets[0].members[0] @@ -90,7 +90,7 @@ def test_action_delete_personal(game: gbt.Game): @pytest.mark.parametrize( "game", - [games.create_myerson_2_card_poker_efg()] + [games.create_stripped_down_poker_efg()] ) def test_action_delete_last(game: gbt.Game): node = game.players[0].infosets[0].members[0] @@ -103,7 +103,7 @@ def test_action_delete_last(game: gbt.Game): @pytest.mark.parametrize( "game", [games.read_from_file("chance_root_3_moves_only_one_nonzero_prob.efg"), - games.create_myerson_2_card_poker_efg(), + games.create_stripped_down_poker_efg(), games.read_from_file("chance_root_5_moves_no_nonterm_player_nodes.efg")] ) def test_action_delete_chance(game: gbt.Game): diff --git a/tests/test_behav.py b/tests/test_behav.py index 4514997be..dbf096167 100644 --- a/tests/test_behav.py +++ b/tests/test_behav.py @@ -28,10 +28,10 @@ def _set_action_probs(profile: gbt.MixedBehaviorProfile, probs: list, rational_f (games.create_mixed_behav_game_efg(), 0, "3", True), (games.create_mixed_behav_game_efg(), 1, "3", True), (games.create_mixed_behav_game_efg(), 2, "13/4", True), - (games.create_myerson_2_card_poker_efg(), 0, -1.25, False), - (games.create_myerson_2_card_poker_efg(), 1, 1.25, True), - (games.create_myerson_2_card_poker_efg(), 0, "-5/4", True), - (games.create_myerson_2_card_poker_efg(), 1, "5/4", True) + (games.create_stripped_down_poker_efg(), 0, -0.25, False), + (games.create_stripped_down_poker_efg(), 1, 0.25, True), + (games.create_stripped_down_poker_efg(), 0, "-1/4", True), + (games.create_stripped_down_poker_efg(), 1, "1/4", True) ] ) def test_payoff_reference(game: gbt.Game, player_idx: int, payoff: typing.Union[str, float], @@ -49,10 +49,10 @@ def test_payoff_reference(game: gbt.Game, player_idx: int, payoff: typing.Union[ (games.create_mixed_behav_game_efg(), "Player 1", "3", True), (games.create_mixed_behav_game_efg(), "Player 2", "3", True), (games.create_mixed_behav_game_efg(), "Player 3", "13/4", True), - (games.create_myerson_2_card_poker_efg(), "Player 1", -1.25, False), - (games.create_myerson_2_card_poker_efg(), "Player 2", 1.25, False), - (games.create_myerson_2_card_poker_efg(), "Player 1", "-5/4", True), - (games.create_myerson_2_card_poker_efg(), "Player 2", "5/4", True), + (games.create_stripped_down_poker_efg(), "Fred", -0.25, False), + (games.create_stripped_down_poker_efg(), "Alice", 0.25, False), + (games.create_stripped_down_poker_efg(), "Fred", "-1/4", True), + (games.create_stripped_down_poker_efg(), "Alice", "1/4", True), ] ) def test_payoff_by_label_reference(game: gbt.Game, label: str, payoff: typing.Union[str, float], @@ -66,8 +66,8 @@ def test_payoff_by_label_reference(game: gbt.Game, label: str, payoff: typing.Un "game,rational_flag", [(games.create_mixed_behav_game_efg(), False), (games.create_mixed_behav_game_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), - (games.create_myerson_2_card_poker_efg(), True), + (games.create_stripped_down_poker_efg(), False), + (games.create_stripped_down_poker_efg(), True), ] ) def test_is_defined_at(game: gbt.Game, rational_flag: bool): @@ -85,12 +85,12 @@ def test_is_defined_at(game: gbt.Game, rational_flag: bool): (games.create_mixed_behav_game_efg(), "Infoset 1:1", True), (games.create_mixed_behav_game_efg(), "Infoset 2:1", True), (games.create_mixed_behav_game_efg(), "Infoset 3:1", True), - (games.create_myerson_2_card_poker_efg(), "(1,1)", False), - (games.create_myerson_2_card_poker_efg(), "(1,2)", False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", False), - (games.create_myerson_2_card_poker_efg(), "(1,1)", True), - (games.create_myerson_2_card_poker_efg(), "(1,2)", True), - (games.create_myerson_2_card_poker_efg(), "(2,1)", True), + (games.create_stripped_down_poker_efg(), "(1,1)", False), + (games.create_stripped_down_poker_efg(), "(1,2)", False), + (games.create_stripped_down_poker_efg(), "(2,1)", False), + (games.create_stripped_down_poker_efg(), "(1,1)", True), + (games.create_stripped_down_poker_efg(), "(1,2)", True), + (games.create_stripped_down_poker_efg(), "(2,1)", True), ] ) def test_is_defined_at_by_label(game: gbt.Game, label: str, rational_flag: bool): @@ -113,18 +113,18 @@ def test_is_defined_at_by_label(game: gbt.Game, label: str, rational_flag: bool) (games.create_mixed_behav_game_efg(), 1, 0, 1, "1/2", True), (games.create_mixed_behav_game_efg(), 2, 0, 0, "1/2", True), (games.create_mixed_behav_game_efg(), 2, 0, 1, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 0, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 0, 1, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 1, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 1, 1, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 1, 0, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 1, 0, 1, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 0, 0, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 0, 1, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 1, 0, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 1, 1, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 1, 0, 0, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 1, 0, 1, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 0, 0, 0.5, False), + (games.create_stripped_down_poker_efg(), 0, 0, 1, 0.5, False), + (games.create_stripped_down_poker_efg(), 0, 1, 0, 0.5, False), + (games.create_stripped_down_poker_efg(), 0, 1, 1, 0.5, False), + (games.create_stripped_down_poker_efg(), 1, 0, 0, 0.5, False), + (games.create_stripped_down_poker_efg(), 1, 0, 1, 0.5, False), + (games.create_stripped_down_poker_efg(), 0, 0, 0, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 0, 1, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 1, 0, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 1, 1, "1/2", True), + (games.create_stripped_down_poker_efg(), 1, 0, 0, "1/2", True), + (games.create_stripped_down_poker_efg(), 1, 0, 1, "1/2", True), ] ) def test_profile_indexing_by_player_infoset_action_idx_reference(game: gbt.Game, player_idx: int, @@ -152,10 +152,8 @@ def test_profile_indexing_by_player_infoset_action_idx_reference(game: gbt.Game, (games.create_mixed_behav_game_efg(), "D2", "1/2", True), (games.create_mixed_behav_game_efg(), "U3", "1/2", True), (games.create_mixed_behav_game_efg(), "D3", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "MEET", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "PASS", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "MEET", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "PASS", "1/2", True), + (games.create_stripped_down_poker_efg(), "Call", 0.5, False), + (games.create_stripped_down_poker_efg(), "Call", "1/2", True), ] ) def test_profile_indexing_by_action_label_reference(game: gbt.Game, action_label: str, @@ -171,14 +169,14 @@ def test_profile_indexing_by_action_label_reference(game: gbt.Game, action_label "game,action_label,rational_flag,error", [(games.create_mixed_behav_game_efg(), "U4", True, KeyError), (games.create_mixed_behav_game_efg(), "U4", False, KeyError), - (games.create_myerson_2_card_poker_efg(), "RAISE", True, ValueError), - (games.create_myerson_2_card_poker_efg(), "RAISE", False, ValueError), - (games.create_myerson_2_card_poker_efg(), "FOLD", True, ValueError), - (games.create_myerson_2_card_poker_efg(), "FOLD", False, ValueError), - (games.create_myerson_2_card_poker_efg(), "RAISEFOLD", True, KeyError), - (games.create_myerson_2_card_poker_efg(), "RAISEFOLD", False, KeyError), - (games.create_myerson_2_card_poker_efg(), "MISSING", True, KeyError), - (games.create_myerson_2_card_poker_efg(), "MISSING", False, KeyError), + (games.create_stripped_down_poker_efg(), "Bet", True, ValueError), + (games.create_stripped_down_poker_efg(), "Bet", False, ValueError), + (games.create_stripped_down_poker_efg(), "Fold", True, ValueError), + (games.create_stripped_down_poker_efg(), "Fold", False, ValueError), + (games.create_stripped_down_poker_efg(), "BetFold", True, KeyError), + (games.create_stripped_down_poker_efg(), "BetFold", False, KeyError), + (games.create_stripped_down_poker_efg(), "MISSING", True, KeyError), + (games.create_stripped_down_poker_efg(), "MISSING", False, KeyError), ] ) def test_profile_indexing_by_invalid_action_label(game: gbt.Game, action_label: str, @@ -214,14 +212,14 @@ def test_profile_indexing_by_invalid_infoset_label(rational_flag: bool): (games.create_mixed_behav_game_efg(), "Infoset 1:1", "D1", 0.5, False), (games.create_mixed_behav_game_efg(), "Infoset 1:1", "U1", "1/2", True), (games.create_mixed_behav_game_efg(), "Infoset 1:1", "D1", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "(1,1)", "RAISE", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(1,1)", "FOLD", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(1,2)", "RAISE", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(1,2)", "FOLD", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", "MEET", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", "PASS", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", "MEET", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "(2,1)", "PASS", "1/2", True), + (games.create_stripped_down_poker_efg(), "(1,1)", "Bet", 0.5, False), + (games.create_stripped_down_poker_efg(), "(1,1)", "Fold", 0.5, False), + (games.create_stripped_down_poker_efg(), "(1,2)", "Bet", 0.5, False), + (games.create_stripped_down_poker_efg(), "(1,2)", "Fold", 0.5, False), + (games.create_stripped_down_poker_efg(), "(2,1)", "Call", 0.5, False), + (games.create_stripped_down_poker_efg(), "(2,1)", "Fold", 0.5, False), + (games.create_stripped_down_poker_efg(), "(2,1)", "Call", "1/2", True), + (games.create_stripped_down_poker_efg(), "(2,1)", "Fold", "1/2", True), ] ) def test_profile_indexing_by_infoset_and_action_labels_reference(game: gbt.Game, @@ -243,14 +241,14 @@ def test_profile_indexing_by_infoset_and_action_labels_reference(game: gbt.Game, (games.create_mixed_behav_game_efg(), "Player 1", "Infoset 1:1", "D1", 0.5, False), (games.create_mixed_behav_game_efg(), "Player 1", "Infoset 1:1", "U1", "1/2", True), (games.create_mixed_behav_game_efg(), "Player 1", "Infoset 1:1", "D1", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "Player 1", "(1,1)", "RAISE", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "Player 1", "(1,1)", "FOLD", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "Player 1", "(1,2)", "RAISE", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "Player 1", "(1,2)", "FOLD", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "Player 2", "(2,1)", "MEET", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "Player 2", "(2,1)", "PASS", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "Player 2", "(2,1)", "MEET", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "Player 2", "(2,1)", "PASS", "1/2", True), + (games.create_stripped_down_poker_efg(), "Fred", "(1,1)", "Bet", 0.5, False), + (games.create_stripped_down_poker_efg(), "Fred", "(1,1)", "Fold", 0.5, False), + (games.create_stripped_down_poker_efg(), "Fred", "(1,2)", "Bet", 0.5, False), + (games.create_stripped_down_poker_efg(), "Fred", "(1,2)", "Fold", 0.5, False), + (games.create_stripped_down_poker_efg(), "Alice", "(2,1)", "Call", 0.5, False), + (games.create_stripped_down_poker_efg(), "Alice", "(2,1)", "Fold", 0.5, False), + (games.create_stripped_down_poker_efg(), "Alice", "(2,1)", "Call", "1/2", True), + (games.create_stripped_down_poker_efg(), "Alice", "(2,1)", "Fold", "1/2", True), ] ) def test_profile_indexing_by_player_infoset_action_labels_reference(game: gbt.Game, @@ -273,8 +271,8 @@ def test_profile_indexing_by_player_infoset_action_labels_reference(game: gbt.Ga (games.create_mixed_behav_game_efg(), "1:1", "U2", False), (games.create_mixed_behav_game_efg(), "1:1", "U4", True), # U4 isn't in the game (games.create_mixed_behav_game_efg(), "1:1", "U4", False), - (games.create_myerson_2_card_poker_efg(), "(1,1)", "MEET", True), # MEET at different iset - (games.create_myerson_2_card_poker_efg(), "(1,1)", "MEET", False), + (games.create_stripped_down_poker_efg(), "(1,1)", "MEET", True), # MEET at different iset + (games.create_stripped_down_poker_efg(), "(1,1)", "MEET", False), ] ) def test_profile_indexing_by_invalid_infoset_or_action_label(game: gbt.Game, infoset_label: str, @@ -292,12 +290,12 @@ def test_profile_indexing_by_invalid_infoset_or_action_label(game: gbt.Game, inf (games.create_mixed_behav_game_efg(), 0, 0, ["1/2", "1/2"], True), (games.create_mixed_behav_game_efg(), 1, 0, ["1/2", "1/2"], True), (games.create_mixed_behav_game_efg(), 2, 0, ["1/2", "1/2"], True), - (games.create_myerson_2_card_poker_efg(), 0, 0, [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), 0, 1, [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), 1, 0, [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), 0, 0, ["1/2", "1/2"], True), - (games.create_myerson_2_card_poker_efg(), 0, 1, ["1/2", "1/2"], True), - (games.create_myerson_2_card_poker_efg(), 1, 0, ["1/2", "1/2"], True), + (games.create_stripped_down_poker_efg(), 0, 0, [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), 0, 1, [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), 1, 0, [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), 0, 0, ["1/2", "1/2"], True), + (games.create_stripped_down_poker_efg(), 0, 1, ["1/2", "1/2"], True), + (games.create_stripped_down_poker_efg(), 1, 0, ["1/2", "1/2"], True), ] ) def test_profile_indexing_by_player_and_infoset_idx_reference(game: gbt.Game, @@ -318,12 +316,12 @@ def test_profile_indexing_by_player_and_infoset_idx_reference(game: gbt.Game, (games.create_mixed_behav_game_efg(), 0, "Infoset 1:1", ["1/2", "1/2"], True), (games.create_mixed_behav_game_efg(), 1, "Infoset 2:1", ["1/2", "1/2"], True), (games.create_mixed_behav_game_efg(), 2, "Infoset 3:1", ["1/2", "1/2"], True), - (games.create_myerson_2_card_poker_efg(), 0, "(1,1)", [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), 0, "(1,2)", [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), 1, "(2,1)", [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), 0, "(1,1)", ["1/2", "1/2"], True), - (games.create_myerson_2_card_poker_efg(), 0, "(1,2)", ["1/2", "1/2"], True), - (games.create_myerson_2_card_poker_efg(), 1, "(2,1)", ["1/2", "1/2"], True), + (games.create_stripped_down_poker_efg(), 0, "(1,1)", [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), 0, "(1,2)", [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), 1, "(2,1)", [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), 0, "(1,1)", ["1/2", "1/2"], True), + (games.create_stripped_down_poker_efg(), 0, "(1,2)", ["1/2", "1/2"], True), + (games.create_stripped_down_poker_efg(), 1, "(2,1)", ["1/2", "1/2"], True), ] ) def test_profile_indexing_by_player_idx_infoset_label_reference(game: gbt.Game, player_idx: int, @@ -340,8 +338,8 @@ def test_profile_indexing_by_player_idx_infoset_label_reference(game: gbt.Game, "game,player_label,infoset_label,rational_flag", [(games.create_mixed_behav_game_efg(), "Player 1", "1:1", True), # correct: "Infoset 1:1" (games.create_mixed_behav_game_efg(), "Player 1", "1:1", False), - (games.create_myerson_2_card_poker_efg(), "Player 1", "(2,1)", True), # wrong player - (games.create_myerson_2_card_poker_efg(), "Player 1", "(2,1)", False), + (games.create_stripped_down_poker_efg(), "Player 1", "(2,1)", True), # wrong player + (games.create_stripped_down_poker_efg(), "Player 1", "(2,1)", False), ] ) def test_profile_indexing_by_player_and_invalid_infoset_label(game: gbt.Game, @@ -357,8 +355,8 @@ def test_profile_indexing_by_player_and_invalid_infoset_label(game: gbt.Game, "game,player_label,action_label,rational_flag", [(games.create_mixed_behav_game_efg(), "Player 1", "U2", True), (games.create_mixed_behav_game_efg(), "Player 1", "U2", False), - (games.create_myerson_2_card_poker_efg(), "Player 1", "MEET", True), - (games.create_myerson_2_card_poker_efg(), "Player 1", "MEET", False), + (games.create_stripped_down_poker_efg(), "Player 1", "MEET", True), + (games.create_stripped_down_poker_efg(), "Player 1", "MEET", False), ] ) def test_profile_indexing_by_player_and_invalid_action_label(game: gbt.Game, @@ -378,10 +376,10 @@ def test_profile_indexing_by_player_and_invalid_action_label(game: gbt.Game, (games.create_mixed_behav_game_efg(), 0, [["1/2", "1/2"]], True), (games.create_mixed_behav_game_efg(), 1, [["1/2", "1/2"]], True), (games.create_mixed_behav_game_efg(), 2, [["1/2", "1/2"]], True), - (games.create_myerson_2_card_poker_efg(), 0, [[0.5, 0.5], [0.5, 0.5]], False), - (games.create_myerson_2_card_poker_efg(), 1, [[0.5, 0.5]], False), - (games.create_myerson_2_card_poker_efg(), 0, [["1/2", "1/2"], ["1/2", "1/2"]], True), - (games.create_myerson_2_card_poker_efg(), 1, [["1/2", "1/2"]], True), + (games.create_stripped_down_poker_efg(), 0, [[0.5, 0.5], [0.5, 0.5]], False), + (games.create_stripped_down_poker_efg(), 1, [[0.5, 0.5]], False), + (games.create_stripped_down_poker_efg(), 0, [["1/2", "1/2"], ["1/2", "1/2"]], True), + (games.create_stripped_down_poker_efg(), 1, [["1/2", "1/2"]], True), ] ) def test_profile_indexing_by_player_idx_reference(game: gbt.Game, player_idx: int, @@ -402,11 +400,11 @@ def test_profile_indexing_by_player_idx_reference(game: gbt.Game, player_idx: in (games.create_mixed_behav_game_efg(), "Player 1", [["1/2", "1/2"]], True), (games.create_mixed_behav_game_efg(), "Player 2", [["1/2", "1/2"]], True), (games.create_mixed_behav_game_efg(), "Player 3", [["1/2", "1/2"]], True), - (games.create_myerson_2_card_poker_efg(), "Player 1", [[0.5, 0.5], [0.5, 0.5]], False), - (games.create_myerson_2_card_poker_efg(), "Player 2", [[0.5, 0.5]], False), - (games.create_myerson_2_card_poker_efg(), "Player 1", [["1/2", "1/2"], ["1/2", "1/2"]], + (games.create_stripped_down_poker_efg(), "Fred", [[0.5, 0.5], [0.5, 0.5]], False), + (games.create_stripped_down_poker_efg(), "Alice", [[0.5, 0.5]], False), + (games.create_stripped_down_poker_efg(), "Fred", [["1/2", "1/2"], ["1/2", "1/2"]], True), - (games.create_myerson_2_card_poker_efg(), "Player 2", [["1/2", "1/2"]], True), + (games.create_stripped_down_poker_efg(), "Alice", [["1/2", "1/2"]], True), ] ) def test_profile_indexing_by_player_label_reference(game: gbt.Game, player_label: str, @@ -431,18 +429,18 @@ def test_profile_indexing_by_player_label_reference(game: gbt.Game, player_label (games.create_mixed_behav_game_efg(), 3, "9/13", True), (games.create_mixed_behav_game_efg(), 4, "1/98", True), (games.create_mixed_behav_game_efg(), 5, "97/98", True), - (games.create_myerson_2_card_poker_efg(), 0, 0.1, False), - (games.create_myerson_2_card_poker_efg(), 1, 0.2, False), - (games.create_myerson_2_card_poker_efg(), 2, 0.3, False), - (games.create_myerson_2_card_poker_efg(), 3, 0.4, False), - (games.create_myerson_2_card_poker_efg(), 4, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 5, 0.6, False), - (games.create_myerson_2_card_poker_efg(), 0, "1/10", True), - (games.create_myerson_2_card_poker_efg(), 1, "2/10", True), - (games.create_myerson_2_card_poker_efg(), 2, "3/10", True), - (games.create_myerson_2_card_poker_efg(), 3, "4/10", True), - (games.create_myerson_2_card_poker_efg(), 4, "5/10", True), - (games.create_myerson_2_card_poker_efg(), 5, "6/10", True), + (games.create_stripped_down_poker_efg(), 0, 0.1, False), + (games.create_stripped_down_poker_efg(), 1, 0.2, False), + (games.create_stripped_down_poker_efg(), 2, 0.3, False), + (games.create_stripped_down_poker_efg(), 3, 0.4, False), + (games.create_stripped_down_poker_efg(), 4, 0.5, False), + (games.create_stripped_down_poker_efg(), 5, 0.6, False), + (games.create_stripped_down_poker_efg(), 0, "1/10", True), + (games.create_stripped_down_poker_efg(), 1, "2/10", True), + (games.create_stripped_down_poker_efg(), 2, "3/10", True), + (games.create_stripped_down_poker_efg(), 3, "4/10", True), + (games.create_stripped_down_poker_efg(), 4, "5/10", True), + (games.create_stripped_down_poker_efg(), 5, "6/10", True), ] ) def test_set_probabilities_action(game: gbt.Game, action_idx: int, prob: typing.Union[str, float], @@ -469,10 +467,8 @@ def test_set_probabilities_action(game: gbt.Game, action_idx: int, prob: typing. (games.create_mixed_behav_game_efg(), "D2", "9/13", True), (games.create_mixed_behav_game_efg(), "U3", "1/98", True), (games.create_mixed_behav_game_efg(), "D3", "97/98", True), - (games.create_myerson_2_card_poker_efg(), "MEET", 0.3, False), - (games.create_myerson_2_card_poker_efg(), "PASS", 0.4, False), - (games.create_myerson_2_card_poker_efg(), "MEET", "3/10", True), - (games.create_myerson_2_card_poker_efg(), "PASS", "4/10", True), + (games.create_stripped_down_poker_efg(), "Call", 0.3, False), + (games.create_stripped_down_poker_efg(), "Call", "3/10", True), ] ) def test_set_probabilities_action_by_label(game: gbt.Game, label: str, @@ -491,12 +487,12 @@ def test_set_probabilities_action_by_label(game: gbt.Game, label: str, (games.create_mixed_behav_game_efg(), 0, 0, ["7/9", "2/9"], True), (games.create_mixed_behav_game_efg(), 1, 0, ["4/13", "9/13"], True), (games.create_mixed_behav_game_efg(), 2, 0, ["1/98", "97/98"], True), - (games.create_myerson_2_card_poker_efg(), 0, 0, [0.1, 0.9], False), - (games.create_myerson_2_card_poker_efg(), 0, 1, [0.2, 0.8], False), - (games.create_myerson_2_card_poker_efg(), 1, 0, [0.3, 0.7], False), - (games.create_myerson_2_card_poker_efg(), 0, 0, ["1/10", "9/10"], True), - (games.create_myerson_2_card_poker_efg(), 0, 1, ["2/10", "8/10"], True), - (games.create_myerson_2_card_poker_efg(), 1, 0, ["3/10", "7/10"], True), + (games.create_stripped_down_poker_efg(), 0, 0, [0.1, 0.9], False), + (games.create_stripped_down_poker_efg(), 0, 1, [0.2, 0.8], False), + (games.create_stripped_down_poker_efg(), 1, 0, [0.3, 0.7], False), + (games.create_stripped_down_poker_efg(), 0, 0, ["1/10", "9/10"], True), + (games.create_stripped_down_poker_efg(), 0, 1, ["2/10", "8/10"], True), + (games.create_stripped_down_poker_efg(), 1, 0, ["3/10", "7/10"], True), ] ) def test_set_probabilities_infoset(game: gbt.Game, player_idx: int, infoset_idx: int, probs: list, @@ -517,12 +513,12 @@ def test_set_probabilities_infoset(game: gbt.Game, player_idx: int, infoset_idx: (games.create_mixed_behav_game_efg(), "Infoset 1:1", ["7/9", "2/9"], True), (games.create_mixed_behav_game_efg(), "Infoset 2:1", ["4/13", "9/13"], True), (games.create_mixed_behav_game_efg(), "Infoset 3:1", ["1/98", "97/98"], True), - (games.create_myerson_2_card_poker_efg(), "(1,1)", [0.1, 0.9], False), - (games.create_myerson_2_card_poker_efg(), "(1,2)", [0.2, 0.8], False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", [0.3, 0.7], False), - (games.create_myerson_2_card_poker_efg(), "(1,1)", ["1/10", "9/10"], True), - (games.create_myerson_2_card_poker_efg(), "(1,2)", ["2/10", "8/10"], True), - (games.create_myerson_2_card_poker_efg(), "(2,1)", ["3/10", "7/10"], True), + (games.create_stripped_down_poker_efg(), "(1,1)", [0.1, 0.9], False), + (games.create_stripped_down_poker_efg(), "(1,2)", [0.2, 0.8], False), + (games.create_stripped_down_poker_efg(), "(2,1)", [0.3, 0.7], False), + (games.create_stripped_down_poker_efg(), "(1,1)", ["1/10", "9/10"], True), + (games.create_stripped_down_poker_efg(), "(1,2)", ["2/10", "8/10"], True), + (games.create_stripped_down_poker_efg(), "(2,1)", ["3/10", "7/10"], True), ] ) def test_set_probabilities_infoset_by_label(game: gbt.Game, infoset_label: str, probs: list, @@ -542,10 +538,10 @@ def test_set_probabilities_infoset_by_label(game: gbt.Game, infoset_label: str, (games.create_mixed_behav_game_efg(), 0, [["7/9", "2/9"]], True), (games.create_mixed_behav_game_efg(), 1, [["4/13", "9/13"]], True), (games.create_mixed_behav_game_efg(), 2, [["1/98", "97/98"]], True), - (games.create_myerson_2_card_poker_efg(), 0, [[0.1, 0.9], [0.5, 0.5]], False), - (games.create_myerson_2_card_poker_efg(), 1, [[0.6, 0.4]], False), - (games.create_myerson_2_card_poker_efg(), 0, [["1/3", "2/3"], ["1/2", "1/2"]], True), - (games.create_myerson_2_card_poker_efg(), 1, [["2/3", "1/3"]], True), + (games.create_stripped_down_poker_efg(), 0, [[0.1, 0.9], [0.5, 0.5]], False), + (games.create_stripped_down_poker_efg(), 1, [[0.6, 0.4]], False), + (games.create_stripped_down_poker_efg(), 0, [["1/3", "2/3"], ["1/2", "1/2"]], True), + (games.create_stripped_down_poker_efg(), 1, [["2/3", "1/3"]], True), ] ) def test_set_probabilities_player(game: gbt.Game, player_idx: int, behav_data: list, @@ -566,11 +562,11 @@ def test_set_probabilities_player(game: gbt.Game, player_idx: int, behav_data: l (games.create_mixed_behav_game_efg(), "Player 1", [["7/9", "2/9"]], True), (games.create_mixed_behav_game_efg(), "Player 2", [["4/13", "9/13"]], True), (games.create_mixed_behav_game_efg(), "Player 3", [["1/98", "97/98"]], True), - (games.create_myerson_2_card_poker_efg(), "Player 1", [[0.1, 0.9], [0.5, 0.5]], False), - (games.create_myerson_2_card_poker_efg(), "Player 2", [[0.6, 0.4]], False), - (games.create_myerson_2_card_poker_efg(), "Player 1", [["1/3", "2/3"], ["1/2", "1/2"]], + (games.create_stripped_down_poker_efg(), "Fred", [[0.1, 0.9], [0.5, 0.5]], False), + (games.create_stripped_down_poker_efg(), "Alice", [[0.6, 0.4]], False), + (games.create_stripped_down_poker_efg(), "Fred", [["1/3", "2/3"], ["1/2", "1/2"]], True), - (games.create_myerson_2_card_poker_efg(), "Player 2", [["2/3", "1/3"]], True), + (games.create_stripped_down_poker_efg(), "Alice", [["2/3", "1/3"]], True), ] ) def test_set_probabilities_player_by_label(game: gbt.Game, player_label: str, behav_data: list, @@ -614,28 +610,28 @@ def test_set_probabilities_player_by_label(game: gbt.Game, player_label: str, be (games.create_mixed_behav_game_efg(), 12, 0.25, False), (games.create_mixed_behav_game_efg(), 13, 0.125, False), (games.create_mixed_behav_game_efg(), 14, 0.125, False), - (games.create_myerson_2_card_poker_efg(), 0, "1", True), - (games.create_myerson_2_card_poker_efg(), 1, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 2, "1/4", True), - (games.create_myerson_2_card_poker_efg(), 3, "1/8", True), - (games.create_myerson_2_card_poker_efg(), 4, "1/8", True), - (games.create_myerson_2_card_poker_efg(), 5, "1/4", True), - (games.create_myerson_2_card_poker_efg(), 6, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 7, "1/4", True), - (games.create_myerson_2_card_poker_efg(), 8, "1/8", True), - (games.create_myerson_2_card_poker_efg(), 9, "1/8", True), - (games.create_myerson_2_card_poker_efg(), 10, "1/4", True), - (games.create_myerson_2_card_poker_efg(), 0, 1.0, False), - (games.create_myerson_2_card_poker_efg(), 1, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 2, 0.25, False), - (games.create_myerson_2_card_poker_efg(), 3, 0.125, False), - (games.create_myerson_2_card_poker_efg(), 4, 0.125, False), - (games.create_myerson_2_card_poker_efg(), 5, 0.25, False), - (games.create_myerson_2_card_poker_efg(), 6, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 7, 0.25, False), - (games.create_myerson_2_card_poker_efg(), 8, 0.125, False), - (games.create_myerson_2_card_poker_efg(), 9, 0.125, False), - (games.create_myerson_2_card_poker_efg(), 10, 0.25, False)] + (games.create_stripped_down_poker_efg(), 0, "1", True), + (games.create_stripped_down_poker_efg(), 1, "1/2", True), + (games.create_stripped_down_poker_efg(), 2, "1/4", True), + (games.create_stripped_down_poker_efg(), 3, "1/8", True), + (games.create_stripped_down_poker_efg(), 4, "1/8", True), + (games.create_stripped_down_poker_efg(), 5, "1/4", True), + (games.create_stripped_down_poker_efg(), 6, "1/2", True), + (games.create_stripped_down_poker_efg(), 7, "1/4", True), + (games.create_stripped_down_poker_efg(), 8, "1/8", True), + (games.create_stripped_down_poker_efg(), 9, "1/8", True), + (games.create_stripped_down_poker_efg(), 10, "1/4", True), + (games.create_stripped_down_poker_efg(), 0, 1.0, False), + (games.create_stripped_down_poker_efg(), 1, 0.5, False), + (games.create_stripped_down_poker_efg(), 2, 0.25, False), + (games.create_stripped_down_poker_efg(), 3, 0.125, False), + (games.create_stripped_down_poker_efg(), 4, 0.125, False), + (games.create_stripped_down_poker_efg(), 5, 0.25, False), + (games.create_stripped_down_poker_efg(), 6, 0.5, False), + (games.create_stripped_down_poker_efg(), 7, 0.25, False), + (games.create_stripped_down_poker_efg(), 8, 0.125, False), + (games.create_stripped_down_poker_efg(), 9, 0.125, False), + (games.create_stripped_down_poker_efg(), 10, 0.25, False)] ) def test_realiz_prob_nodes_reference(game: gbt.Game, node_idx: int, realiz_prob: typing.Union[str, float], rational_flag: bool): @@ -653,12 +649,12 @@ def test_realiz_prob_nodes_reference(game: gbt.Game, node_idx: int, (games.create_mixed_behav_game_efg(), 0, 0, "1", True), (games.create_mixed_behav_game_efg(), 1, 0, "1", True), (games.create_mixed_behav_game_efg(), 2, 0, "1", True), - (games.create_myerson_2_card_poker_efg(), 0, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 1, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 1, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 0, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 1, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 1, 0, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 0, 0.5, False), + (games.create_stripped_down_poker_efg(), 0, 1, 0.5, False), + (games.create_stripped_down_poker_efg(), 1, 0, 0.5, False), + (games.create_stripped_down_poker_efg(), 0, 0, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 1, "1/2", True), + (games.create_stripped_down_poker_efg(), 1, 0, "1/2", True), ] ) def test_infoset_prob_reference(game: gbt.Game, player_idx: int, infoset_idx: int, @@ -676,12 +672,12 @@ def test_infoset_prob_reference(game: gbt.Game, player_idx: int, infoset_idx: in (games.create_mixed_behav_game_efg(), "Infoset 1:1", "1", True), (games.create_mixed_behav_game_efg(), "Infoset 2:1", "1", True), (games.create_mixed_behav_game_efg(), "Infoset 3:1", "1", True), - (games.create_myerson_2_card_poker_efg(), "(1,1)", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(1,2)", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(1,1)", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "(1,2)", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "(2,1)", "1/2", True), + (games.create_stripped_down_poker_efg(), "(1,1)", 0.5, False), + (games.create_stripped_down_poker_efg(), "(1,2)", 0.5, False), + (games.create_stripped_down_poker_efg(), "(2,1)", 0.5, False), + (games.create_stripped_down_poker_efg(), "(1,1)", "1/2", True), + (games.create_stripped_down_poker_efg(), "(1,2)", "1/2", True), + (games.create_stripped_down_poker_efg(), "(2,1)", "1/2", True), ] ) def test_infoset_prob_by_label_reference(game: gbt.Game, label: str, @@ -698,12 +694,12 @@ def test_infoset_prob_by_label_reference(game: gbt.Game, label: str, (games.create_mixed_behav_game_efg(), 0, 0, "3", True), (games.create_mixed_behav_game_efg(), 1, 0, "3", True), (games.create_mixed_behav_game_efg(), 2, 0, "13/4", True), - (games.create_myerson_2_card_poker_efg(), 0, 0, -0.75, False), - (games.create_myerson_2_card_poker_efg(), 0, 1, -1.75, False), - (games.create_myerson_2_card_poker_efg(), 1, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 0, "-3/4", True), - (games.create_myerson_2_card_poker_efg(), 0, 1, "-7/4", True), - (games.create_myerson_2_card_poker_efg(), 1, 0, "1/2", True), + (games.create_stripped_down_poker_efg(), 0, 0, 0.25, False), + (games.create_stripped_down_poker_efg(), 0, 1, -0.75, False), + (games.create_stripped_down_poker_efg(), 1, 0, -0.5, False), + (games.create_stripped_down_poker_efg(), 0, 0, "1/4", True), + (games.create_stripped_down_poker_efg(), 0, 1, "-3/4", True), + (games.create_stripped_down_poker_efg(), 1, 0, "-1/2", True), ] ) def test_infoset_payoff_reference(game: gbt.Game, player_idx: int, infoset_idx: int, @@ -721,12 +717,12 @@ def test_infoset_payoff_reference(game: gbt.Game, player_idx: int, infoset_idx: (games.create_mixed_behav_game_efg(), "Infoset 1:1", "3", True), (games.create_mixed_behav_game_efg(), "Infoset 2:1", "3", True), (games.create_mixed_behav_game_efg(), "Infoset 3:1", "13/4", True), - (games.create_myerson_2_card_poker_efg(), "(1,1)", -0.75, False), - (games.create_myerson_2_card_poker_efg(), "(1,2)", -1.75, False), - (games.create_myerson_2_card_poker_efg(), "(2,1)", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "(1,1)", "-3/4", True), - (games.create_myerson_2_card_poker_efg(), "(1,2)", "-7/4", True), - (games.create_myerson_2_card_poker_efg(), "(2,1)", "1/2", True), + (games.create_stripped_down_poker_efg(), "(1,1)", 0.25, False), + (games.create_stripped_down_poker_efg(), "(1,2)", -0.75, False), + (games.create_stripped_down_poker_efg(), "(2,1)", -0.5, False), + (games.create_stripped_down_poker_efg(), "(1,1)", "1/4", True), + (games.create_stripped_down_poker_efg(), "(1,2)", "-3/4", True), + (games.create_stripped_down_poker_efg(), "(2,1)", "-1/2", True), ] ) def test_infoset_payoff_by_label_reference(game: gbt.Game, label: str, @@ -750,18 +746,18 @@ def test_infoset_payoff_by_label_reference(game: gbt.Game, label: str, (games.create_mixed_behav_game_efg(), 1, 0, 1, "3/1", True), (games.create_mixed_behav_game_efg(), 2, 0, 0, "7/2", True), (games.create_mixed_behav_game_efg(), 2, 0, 1, "3/1", True), - (games.create_myerson_2_card_poker_efg(), 0, 0, 0, 0.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 0, 1, -2, False), - (games.create_myerson_2_card_poker_efg(), 0, 1, 0, -1.5, False), - (games.create_myerson_2_card_poker_efg(), 0, 1, 1, -2, False), - (games.create_myerson_2_card_poker_efg(), 1, 0, 0, 1, False), - (games.create_myerson_2_card_poker_efg(), 1, 0, 1, 0, False), - (games.create_myerson_2_card_poker_efg(), 0, 0, 0, "1/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 0, 1, "-2", True), - (games.create_myerson_2_card_poker_efg(), 0, 1, 0, "-3/2", True), - (games.create_myerson_2_card_poker_efg(), 0, 1, 1, "-2", True), - (games.create_myerson_2_card_poker_efg(), 1, 0, 0, "1", True), - (games.create_myerson_2_card_poker_efg(), 1, 0, 1, "0", True), + (games.create_stripped_down_poker_efg(), 0, 0, 0, 1.5, False), + (games.create_stripped_down_poker_efg(), 0, 0, 1, -1, False), + (games.create_stripped_down_poker_efg(), 0, 1, 0, -0.5, False), + (games.create_stripped_down_poker_efg(), 0, 1, 1, -1, False), + (games.create_stripped_down_poker_efg(), 1, 0, 0, 0, False), + (games.create_stripped_down_poker_efg(), 1, 0, 1, -1, False), + (games.create_stripped_down_poker_efg(), 0, 0, 0, "3/2", True), + (games.create_stripped_down_poker_efg(), 0, 0, 1, -1, True), + (games.create_stripped_down_poker_efg(), 0, 1, 0, "-1/2", True), + (games.create_stripped_down_poker_efg(), 0, 1, 1, -1, True), + (games.create_stripped_down_poker_efg(), 1, 0, 0, 0, True), + (games.create_stripped_down_poker_efg(), 1, 0, 1, -1, True), ] ) def test_action_payoff_reference(game: gbt.Game, player_idx: int, infoset_idx: int, @@ -786,10 +782,8 @@ def test_action_payoff_reference(game: gbt.Game, player_idx: int, infoset_idx: i (games.create_mixed_behav_game_efg(), "D2", "3", True), (games.create_mixed_behav_game_efg(), "U3", "7/2", True), (games.create_mixed_behav_game_efg(), "D3", "3", True), - (games.create_myerson_2_card_poker_efg(), "MEET", 1, False), - (games.create_myerson_2_card_poker_efg(), "PASS", 0, False), - (games.create_myerson_2_card_poker_efg(), "MEET", "1", True), - (games.create_myerson_2_card_poker_efg(), "PASS", "0", True), + (games.create_stripped_down_poker_efg(), "Call", 0, False), + (games.create_stripped_down_poker_efg(), "Call", "0", True), ] ) def test_action_value_by_label_reference(game: gbt.Game, label: str, @@ -802,8 +796,8 @@ def test_action_value_by_label_reference(game: gbt.Game, label: str, "game,rational_flag", [(games.create_mixed_behav_game_efg(), False), (games.create_mixed_behav_game_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), - (games.create_myerson_2_card_poker_efg(), True), + (games.create_stripped_down_poker_efg(), False), + (games.create_stripped_down_poker_efg(), True), ] ) def test_regret_consistency(game: gbt.Game, rational_flag: bool): @@ -851,16 +845,16 @@ def test_regret_consistency(game: gbt.Game, rational_flag: bool): (games.create_mixed_behav_game_efg(), 2, 0, 1, ["2/5", "3/5", "1/2", "1/2", "1/3", "2/3"], True, ZERO, 0), # uniform - (games.create_myerson_2_card_poker_efg(), 0, 0, 0, None, False, TOL, 0), - (games.create_myerson_2_card_poker_efg(), 0, 0, 1, None, False, TOL, 2.5), # 1.5 - (-1) - (games.create_myerson_2_card_poker_efg(), 0, 1, 0, None, False, TOL, 0), - (games.create_myerson_2_card_poker_efg(), 0, 1, 1, None, False, TOL, 0.5), # -0.5 - (-1) - (games.create_myerson_2_card_poker_efg(), 1, 0, 0, None, False, TOL, 0), - (games.create_myerson_2_card_poker_efg(), 1, 0, 1, None, False, TOL, 1), # -0 - (-1) + (games.create_stripped_down_poker_efg(), 0, 0, 0, None, False, TOL, 0), + (games.create_stripped_down_poker_efg(), 0, 0, 1, None, False, TOL, 2.5), # 1.5 - (-1) + (games.create_stripped_down_poker_efg(), 0, 1, 0, None, False, TOL, 0), + (games.create_stripped_down_poker_efg(), 0, 1, 1, None, False, TOL, 0.5), # -0.5 - (-1) + (games.create_stripped_down_poker_efg(), 1, 0, 0, None, False, TOL, 0), + (games.create_stripped_down_poker_efg(), 1, 0, 1, None, False, TOL, 1), # -0 - (-1) # mixed Nash equilibrium - (games.create_myerson_2_card_poker_efg(), 0, 0, 0, ["1", "0", "1/3", "2/3", "2/3", "1/3"], + (games.create_stripped_down_poker_efg(), 0, 0, 0, ["1", "0", "1/3", "2/3", "2/3", "1/3"], True, ZERO, 0), - (games.create_myerson_2_card_poker_efg(), 0, 0, 1, ["1", "0", "1/3", "2/3", "2/3", "1/3"], + (games.create_stripped_down_poker_efg(), 0, 0, 1, ["1", "0", "1/3", "2/3", "2/3", "1/3"], True, ZERO, "8/3"), # (2/3*2 + 1/3*1) - (-1) ] ) @@ -880,8 +874,8 @@ def test_regret_reference(game: gbt.Game, player_idx: int, infoset_idx: int, act "game,rational_flag", [(games.create_mixed_behav_game_efg(), False), (games.create_mixed_behav_game_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), - (games.create_myerson_2_card_poker_efg(), True), + (games.create_stripped_down_poker_efg(), False), + (games.create_stripped_down_poker_efg(), True), ] ) def test_martingale_property_of_node_value(game: gbt.Game, rational_flag: bool): @@ -905,8 +899,8 @@ def test_martingale_property_of_node_value(game: gbt.Game, rational_flag: bool): "game,rational_flag", [(games.create_mixed_behav_game_efg(), False), (games.create_mixed_behav_game_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), - (games.create_myerson_2_card_poker_efg(), True)] + (games.create_stripped_down_poker_efg(), False), + (games.create_stripped_down_poker_efg(), True)] ) def test_node_value_consistency(game: gbt.Game, rational_flag: bool): """Test that the profile's node value at the root for each player matches the profile's payoff @@ -937,14 +931,14 @@ def test_node_value_consistency(game: gbt.Game, rational_flag: bool): (games.create_mixed_behav_game_efg(), [0.0, 1.0, 0.0, 1.0, 0.0, 1.0], False, 29.0), (games.create_mixed_behav_game_efg(), ["0", "1", "0", "1", "0", "1"], True, "29"), # uniform (non-Nash): - (games.create_myerson_2_card_poker_efg(), None, True, "15/8"), - (games.create_myerson_2_card_poker_efg(), None, False, 1.875), + (games.create_stripped_down_poker_efg(), None, True, "15/8"), + (games.create_stripped_down_poker_efg(), None, False, 1.875), # mixed Nash equilibrium (only rational tested): - (games.create_myerson_2_card_poker_efg(), ["1", "0", "1/3", "2/3", "2/3", "1/3"], True, 0), + (games.create_stripped_down_poker_efg(), ["1", "0", "1/3", "2/3", "2/3", "1/3"], True, 0), # non-Nash pure profile: # Raise at 1:1, Raise at 1:2, Meet at 2:1 - (games.create_myerson_2_card_poker_efg(), ["1", "0", "1", "0", "1", "0"], True, 1), - (games.create_myerson_2_card_poker_efg(), [1.0, 0.0, 1.0, 0.0, 1.0, 0.0], False, 1.0), + (games.create_stripped_down_poker_efg(), ["1", "0", "1", "0", "1", "0"], True, 1), + (games.create_stripped_down_poker_efg(), [1.0, 0.0, 1.0, 0.0, 1.0, 0.0], False, 1.0), ] ) def test_liap_value_reference(game: gbt.Game, action_probs: typing.Union[None, list], @@ -977,17 +971,17 @@ def test_liap_value_reference(game: gbt.Game, action_probs: typing.Union[None, l "8/25", True), (games.create_mixed_behav_game_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], 2, 1, "12/25", True), - (games.create_myerson_2_card_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], + (games.create_stripped_down_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], 0, 0, "1", True), - (games.create_myerson_2_card_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], + (games.create_stripped_down_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], 1, 0, "1", True), - (games.create_myerson_2_card_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], + (games.create_stripped_down_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], 2, 0, "2/3", True), - (games.create_myerson_2_card_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], + (games.create_stripped_down_poker_efg(), ZERO, ["4/5", "1/5", "2/5", "3/5", "0", "1"], 2, 1, "1/3", True), - (games.create_myerson_2_card_poker_efg(), ZERO, ["1", "0", "2/5", "3/5", "0", "1"], + (games.create_stripped_down_poker_efg(), ZERO, ["1", "0", "2/5", "3/5", "0", "1"], 2, 0, "5/7", True), - (games.create_myerson_2_card_poker_efg(), ZERO, ["1", "0", "2/5", "3/5", "0", "1"], + (games.create_stripped_down_poker_efg(), ZERO, ["1", "0", "2/5", "3/5", "0", "1"], 2, 1, "2/7", True), ] ) @@ -1003,8 +997,8 @@ def test_node_belief_reference(game: gbt.Game, tol: typing.Union[gbt.Rational, f @pytest.mark.parametrize( "game,rational_flag", - [(games.create_myerson_2_card_poker_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), + [(games.create_stripped_down_poker_efg(), True), + (games.create_stripped_down_poker_efg(), False), ] ) def test_payoff_value_error_with_chance_player(game: gbt.Game, rational_flag: bool): @@ -1016,8 +1010,8 @@ def test_payoff_value_error_with_chance_player(game: gbt.Game, rational_flag: bo @pytest.mark.parametrize( "game,rational_flag", - [(games.create_myerson_2_card_poker_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), + [(games.create_stripped_down_poker_efg(), True), + (games.create_stripped_down_poker_efg(), False), ] ) def test_infoset_value_error_with_chance_player_infoset(game: gbt.Game, rational_flag: bool): @@ -1029,8 +1023,8 @@ def test_infoset_value_error_with_chance_player_infoset(game: gbt.Game, rational @pytest.mark.parametrize( "game,rational_flag", - [(games.create_myerson_2_card_poker_efg(), True), - (games.create_myerson_2_card_poker_efg(), False), + [(games.create_stripped_down_poker_efg(), True), + (games.create_stripped_down_poker_efg(), False), ] ) def test_action_value_error_with_chance_player_action(game: gbt.Game, rational_flag: bool): @@ -1083,9 +1077,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.belief(y), lambda x: x.nodes), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.belief(y), lambda x: x.nodes), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.belief(y), lambda x: x.nodes), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.belief(y), lambda x: x.nodes), ###################################################################################### # realiz_prob (at nodes) @@ -1093,9 +1087,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.realiz_prob(y), lambda x: x.nodes), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.realiz_prob(y), lambda x: x.nodes), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.realiz_prob(y), lambda x: x.nodes), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.realiz_prob(y), lambda x: x.nodes), ###################################################################################### # infoset_prob @@ -1103,9 +1097,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.infoset_prob(y), lambda x: x.infosets), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.infoset_prob(y), lambda x: x.infosets), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.infoset_prob(y), lambda x: x.infosets), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.infoset_prob(y), lambda x: x.infosets), ###################################################################################### # infoset_value @@ -1113,9 +1107,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.infoset_value(y), lambda x: x.infosets), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.infoset_value(y), lambda x: x.infosets), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.infoset_value(y), lambda x: x.infosets), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.infoset_value(y), lambda x: x.infosets), ###################################################################################### # action_value @@ -1123,9 +1117,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.action_value(y), lambda x: x.actions), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.action_value(y), lambda x: x.actions), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.action_value(y), lambda x: x.actions), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.action_value(y), lambda x: x.actions), ###################################################################################### # regret (for actions) @@ -1133,9 +1127,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.action_regret(y), lambda x: x.actions), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.action_regret(y), lambda x: x.actions), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.action_regret(y), lambda x: x.actions), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.action_regret(y), lambda x: x.actions), ###################################################################################### # node_value @@ -1145,10 +1139,10 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.node_value(player=y[0], node=y[1]), lambda x: list(product(x.players, x.nodes))), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.node_value(player=y[0], node=y[1]), lambda x: list(product(x.players, x.nodes))), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.node_value(player=y[0], node=y[1]), lambda x: list(product(x.players, x.nodes))), ###################################################################################### @@ -1157,9 +1151,9 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: lambda x, y: x.liap_value(), lambda x: [1]), (games.create_mixed_behav_game_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.liap_value(), lambda x: [1]), - (games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + (games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda x, y: x.liap_value(), lambda x: [1]), - (games.create_myerson_2_card_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, + (games.create_stripped_down_poker_efg(), PROBS_1A_rat, PROBS_2A_rat, True, lambda x, y: x.liap_value(), lambda x: [1]), ] ) @@ -1176,10 +1170,10 @@ def test_profile_order_consistency(game: gbt.Game, "game,rational_flag,data", [(games.create_mixed_behav_game_efg(), True, [[[0, 1]], [[0, 1]], [[1, 0]]]), (games.create_mixed_behav_game_efg(), True, [[["1/5", "4/5"]], [["1/4", "3/4"]], [[1, 0]]]), - (games.create_myerson_2_card_poker_efg(), True, [[[1/5, 4/5], [3/5, 2/5]], [[1/4, 3/4]]]), + (games.create_stripped_down_poker_efg(), True, [[[1/5, 4/5], [3/5, 2/5]], [[1/4, 3/4]]]), (games.create_mixed_behav_game_efg(), False, [[[0, 1]], [[1, 0]], [[1, 0]]]), (games.create_mixed_behav_game_efg(), False, [[[1/5, 4/5]], [[1/4, 3/4]], [[1, 0]]]), - (games.create_myerson_2_card_poker_efg(), False, [[[1/5, 4/5], [3/5, 2/5]], [[1/4, 3/4]]]) + (games.create_stripped_down_poker_efg(), False, [[[1/5, 4/5], [3/5, 2/5]], [[1/4, 3/4]]]) ] ) def test_specific_profile(game: gbt.Game, rational_flag: bool, data: list): @@ -1197,7 +1191,7 @@ def test_specific_profile(game: gbt.Game, rational_flag: bool, data: list): [[[0, 1, 0]], [[1, 0]], [["1/2", "1/2"]]]), (games.create_mixed_behav_game_efg(), True, [[[0, 1]], [[1, 0]], [[1, 0]], [[0, 1]]]), - (games.create_myerson_2_card_poker_efg(), True, + (games.create_stripped_down_poker_efg(), True, [[["1/5", "4/5"], ["3/5", "2/5"]], [["1/4", "3/4"], ["1/4", "3/4"]]]), (games.create_el_farol_bar_game_efg(), True, [[4/9, 5/9], [0], [1/2, 1/2], [11/12, 1/12], [1/2, 1/2]]), @@ -1207,7 +1201,7 @@ def test_specific_profile(game: gbt.Game, rational_flag: bool, data: list): [[[0, 1, 0]], [[1, 0]], [[1, 0]]]), (games.create_mixed_behav_game_efg(), False, [[[0, 1]], [[1, 0]], [[1, 0]], [[0, 1]]]), - (games.create_myerson_2_card_poker_efg(), False, + (games.create_stripped_down_poker_efg(), False, [[[1/5, 4/5], [3/5, 2/5]], [[1/4, 3/4], [1/4, 3/4]]]), (games.create_el_farol_bar_game_efg(), False, [[4/9, 5/9], [0], [1/2, 1/2], [11/12, 1/12], [1/2, 1/2]]), diff --git a/tests/test_extensive.py b/tests/test_extensive.py index 25a47b8eb..416621732 100644 --- a/tests/test_extensive.py +++ b/tests/test_extensive.py @@ -54,7 +54,7 @@ def test_game_add_players_nolabel(): ("e01.efg", True), ("e02.efg", True), ("cent3.efg", True), - ("poker.efg", True), + ("stripped_down_poker.efg", True), ("basic_extensive_game.efg", True), # Games with perfect recall from generated games (game_input is a gbt.Game object) @@ -283,13 +283,13 @@ def test_outcome_index_exception_label(): ), ], ), - # Stripped down "Myerson" 2-card poker; 2 player zero-sum game with chance at the root + # Stripped-down poker; 2 player zero-sum game with chance at the root ( - games.create_myerson_2_card_poker_efg(), + games.create_stripped_down_poker_efg(), [["11", "12", "21", "22"], ["1", "2"]], [ - np.array([[-1, 0], ["-1/2", -1], ["-5/2", -1], [-2, -2]]), - np.array([[1, 0], ["1/2", 1], ["5/2", 1], [2, 2]]), + np.array([[0, 1], ["1/2", 0], ["-3/2", 0], [-1, -1]]), + np.array([[0, -1], ["-1/2", 0], ["3/2", 0], [1, 1]]), ], ), # Nature playing at the root, 2 players, no reduction, non-generic payoffs diff --git a/tests/test_games/myerson_2_card_poker.efg b/tests/test_games/myerson_2_card_poker.efg deleted file mode 100644 index f0b1707b2..000000000 --- a/tests/test_games/myerson_2_card_poker.efg +++ /dev/null @@ -1,14 +0,0 @@ -EFG 2 R "" { "Player 1" "Player 2" } -"" - -c "" 1 "(0,1)" { "RED" 0.500000 "BLACK" 0.500000 } 1 "Outcome 3" { -1, 1 } -p "" 1 1 "(1,1)" { "RAISE" "FOLD" } 0 -p "" 2 1 "(2,1)" { "MEET" "PASS" } 0 -t "" 2 "Outcome 2" { 2, -2 } -t "" 3 "Outcome 1" { 1, -1 } -t "" 1 "Outcome 3" { -1, 1 } -p "" 1 2 "(1,2)" { "RAISE" "FOLD" } 0 -p "" 2 1 "(2,1)" { "MEET" "PASS" } 0 -t "" 4 "Outcome 4" { -2, 2 } -t "" 3 "Outcome 1" { 1, -1 } -t "" 1 "Outcome 3" { -1, 1 } diff --git a/tests/test_games/poker.efg b/tests/test_games/poker.efg deleted file mode 100644 index b55de5be1..000000000 --- a/tests/test_games/poker.efg +++ /dev/null @@ -1,14 +0,0 @@ -EFG 2 R "A simple Poker game" { "Fred" "Alice" } -"This is a simple game of one-card poker from Myerson (1991)." - -c "" 1 "" { "Red" 1/2 "Black" 1/2 } 0 -p "" 1 1 "" { "Raise" "Fold" } 0 -p "" 2 1 "" { "Meet" "Pass" } 0 -t "" 1 "Win Big" { 2, -2 } -t "" 2 "Win" { 1, -1 } -t "" 2 "Win" { 1, -1 } -p "" 1 2 "" { "Raise" "Fold" } 0 -p "" 2 1 "" { "Meet" "Pass" } 0 -t "" 3 "Lose Big" { -2, 2 } -t "" 2 "Win" { 1, -1 } -t "" 4 "Lose" { -1, 1 } diff --git a/tests/test_games/stripped_down_poker.efg b/tests/test_games/stripped_down_poker.efg new file mode 100644 index 000000000..9c7eb66ec --- /dev/null +++ b/tests/test_games/stripped_down_poker.efg @@ -0,0 +1,14 @@ +EFG 2 R "A simple Poker game" { "Fred" "Alice" } +"Stripped-Down Poker: a simple game of one-card poker from Reiley et al (2008)." + +c "" 1 "(0,1)" { "King" 1/2 "Queen" 1/2 } 0 +p "" 1 1 "(1,1)" { "Bet" "Fold" } 0 +p "" 2 1 "(2,1)" { "Call" "Fold" } 0 +t "" 1 "Win Big" { 2, -2 } +t "" 2 "Win" { 1, -1 } +t "" 4 "Lose" { -1, 1 } +p "" 1 2 "(1,2)" { "Bet" "Fold" } 0 +p "" 2 1 "(2,1)" { "Call" "Fold" } 0 +t "" 3 "Lose Big" { -2, 2 } +t "" 2 "Win" { 1, -1 } +t "" 4 "Lose" { -1, 1 } diff --git a/tests/test_mixed.py b/tests/test_mixed.py index 43dd8a09b..b37763d74 100644 --- a/tests/test_mixed.py +++ b/tests/test_mixed.py @@ -107,13 +107,13 @@ def test_normalize(game, profile_data, expected_data, rational_flag): (games.create_coord_4x4_nfg(outcome_version=True), "1-1", 0.25, False), (games.create_coord_4x4_nfg(outcome_version=True), "1-1", "1/4", True), ############################################################################### - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), "11", 0.25, False), - (games.create_myerson_2_card_poker_efg(), "12", 0.15, False), - (games.create_myerson_2_card_poker_efg(), "21", 0.99, False), - (games.create_myerson_2_card_poker_efg(), "11", "1/4", True), - (games.create_myerson_2_card_poker_efg(), "12", "3/4", True), - (games.create_myerson_2_card_poker_efg(), "21", "7/9", True), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), "11", 0.25, False), + (games.create_stripped_down_poker_efg(), "12", 0.15, False), + (games.create_stripped_down_poker_efg(), "21", 0.99, False), + (games.create_stripped_down_poker_efg(), "11", "1/4", True), + (games.create_stripped_down_poker_efg(), "12", "3/4", True), + (games.create_stripped_down_poker_efg(), "21", "7/9", True), ], ) def test_set_and_get_probability_by_strategy_label(game: gbt.Game, strategy_label: str, @@ -137,11 +137,11 @@ def test_set_and_get_probability_by_strategy_label(game: gbt.Game, strategy_labe (games.create_coord_4x4_nfg(), P1, False, [0.25, 0, 0, 0.75]), (games.create_coord_4x4_nfg(), P1, True, ["1/4", 0, 0, "3/4"]), ############################################################################## - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), P1, False, [0.25, 0.75, 0, 0]), - (games.create_myerson_2_card_poker_efg(), P2, False, [1, 0]), - (games.create_myerson_2_card_poker_efg(), P1, True, ["1/4", "3/4", 0, 0]), - (games.create_myerson_2_card_poker_efg(), P2, True, [1, 0]), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), "Fred", False, [0.25, 0.75, 0, 0]), + (games.create_stripped_down_poker_efg(), "Alice", False, [1, 0]), + (games.create_stripped_down_poker_efg(), "Fred", True, ["1/4", "3/4", 0, 0]), + (games.create_stripped_down_poker_efg(), "Alice", True, [1, 0]), ], ) def test_set_and_get_probabilities_by_player_label(game: gbt.Game, player_label: str, @@ -156,21 +156,21 @@ def test_set_and_get_probabilities_by_player_label(game: gbt.Game, player_label: "game,player_label,strategy_label,prob,rational_flag", [ ############################################################################## - # myerson 2 card poker efg + # stripped-down poker efg # Player 1 - (games.create_myerson_2_card_poker_efg(), P1, "11", 0.25, False), - (games.create_myerson_2_card_poker_efg(), P1, "12", 0.25, False), - (games.create_myerson_2_card_poker_efg(), P1, "21", 0.25, False), - (games.create_myerson_2_card_poker_efg(), P1, "22", 0.25, False), - (games.create_myerson_2_card_poker_efg(), P1, "11", "1/4", True), - (games.create_myerson_2_card_poker_efg(), P1, "12", "1/4", True), - (games.create_myerson_2_card_poker_efg(), P1, "21", "1/4", True), - (games.create_myerson_2_card_poker_efg(), P1, "22", "1/4", True), + (games.create_stripped_down_poker_efg(), "Fred", "11", 0.25, False), + (games.create_stripped_down_poker_efg(), "Fred", "12", 0.25, False), + (games.create_stripped_down_poker_efg(), "Fred", "21", 0.25, False), + (games.create_stripped_down_poker_efg(), "Fred", "22", 0.25, False), + (games.create_stripped_down_poker_efg(), "Fred", "11", "1/4", True), + (games.create_stripped_down_poker_efg(), "Fred", "12", "1/4", True), + (games.create_stripped_down_poker_efg(), "Fred", "21", "1/4", True), + (games.create_stripped_down_poker_efg(), "Fred", "22", "1/4", True), # Player 2 - (games.create_myerson_2_card_poker_efg(), P2, "1", 0.5, False), - (games.create_myerson_2_card_poker_efg(), P2, "2", 0.5, False), - (games.create_myerson_2_card_poker_efg(), P2, "1", "1/2", True), - (games.create_myerson_2_card_poker_efg(), P2, "2", "1/2", True), + (games.create_stripped_down_poker_efg(), "Alice", "1", 0.5, False), + (games.create_stripped_down_poker_efg(), "Alice", "2", 0.5, False), + (games.create_stripped_down_poker_efg(), "Alice", "1", "1/2", True), + (games.create_stripped_down_poker_efg(), "Alice", "2", "1/2", True), ############################################################################## # coordination 4x4 nfg outcome version with strategy labels (games.create_coord_4x4_nfg(outcome_version=True), P1, "1-1", "1/4", True), @@ -190,13 +190,13 @@ def test_profile_indexing_by_player_and_strategy_label_reference(game: gbt.Game, "game,player_label,strategy_label,rational_flag", [ ############################################################################## - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), P2, "11", True), - (games.create_myerson_2_card_poker_efg(), P2, "11", False), - (games.create_myerson_2_card_poker_efg(), P1, "1", True), - (games.create_myerson_2_card_poker_efg(), P1, "1", False), - (games.create_myerson_2_card_poker_efg(), P1, "2", True), - (games.create_myerson_2_card_poker_efg(), P1, "2", False), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), "Alice", "11", True), + (games.create_stripped_down_poker_efg(), "Alice", "11", False), + (games.create_stripped_down_poker_efg(), "Fred", "1", True), + (games.create_stripped_down_poker_efg(), "Fred", "1", False), + (games.create_stripped_down_poker_efg(), "Fred", "2", True), + (games.create_stripped_down_poker_efg(), "Fred", "2", False), ############################################################################## # coordination 4x4 nfg outcome version with strategy labels (games.create_coord_4x4_nfg(outcome_version=True), P1, "2-1", True), @@ -216,8 +216,8 @@ def test_profile_indexing_by_player_and_invalid_strategy_label(game: gbt.Game, "game,strategy_label,rational_flag,error,message", [ ############################################################################## - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), "13", True, KeyError, "player or strategy"), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), "13", True, KeyError, "player or strategy"), ############################################################################## # coordination 4x4 nfg payoff version (default strategy labels created with duplicates) (games.create_coord_4x4_nfg(), "1", True, ValueError, "multiple strategies"), @@ -249,21 +249,21 @@ def test_profile_indexing_by_player_and_duplicate_strategy_label(): "game,strategy_label,prob,rational_flag", [ ########################################################################### - # myerson 2 card poker efg + # stripped-down poker efg # Player 1 - (games.create_myerson_2_card_poker_efg(), "11", 0.25, False), - (games.create_myerson_2_card_poker_efg(), "12", 0.25, False), - (games.create_myerson_2_card_poker_efg(), "21", 0.25, False), - (games.create_myerson_2_card_poker_efg(), "22", 0.25, False), - (games.create_myerson_2_card_poker_efg(), "11", "1/4", True), - (games.create_myerson_2_card_poker_efg(), "12", "1/4", True), - (games.create_myerson_2_card_poker_efg(), "21", "1/4", True), - (games.create_myerson_2_card_poker_efg(), "22", "1/4", True), + (games.create_stripped_down_poker_efg(), "11", 0.25, False), + (games.create_stripped_down_poker_efg(), "12", 0.25, False), + (games.create_stripped_down_poker_efg(), "21", 0.25, False), + (games.create_stripped_down_poker_efg(), "22", 0.25, False), + (games.create_stripped_down_poker_efg(), "11", "1/4", True), + (games.create_stripped_down_poker_efg(), "12", "1/4", True), + (games.create_stripped_down_poker_efg(), "21", "1/4", True), + (games.create_stripped_down_poker_efg(), "22", "1/4", True), # Player 2 - (games.create_myerson_2_card_poker_efg(), "1", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "2", 0.5, False), - (games.create_myerson_2_card_poker_efg(), "1", "1/2", True), - (games.create_myerson_2_card_poker_efg(), "2", "1/2", True), + (games.create_stripped_down_poker_efg(), "1", 0.5, False), + (games.create_stripped_down_poker_efg(), "2", 0.5, False), + (games.create_stripped_down_poker_efg(), "1", "1/2", True), + (games.create_stripped_down_poker_efg(), "2", "1/2", True), ############################################################################ # coordination 4x4 nfg outcome version with strategy labels # Player 1 @@ -294,11 +294,11 @@ def test_profile_indexing_by_strategy_label_reference(game: gbt.Game, strategy_l (games.create_mixed_behav_game_efg(), P2, ["1/2", "1/2"], True), (games.create_mixed_behav_game_efg(), P3, ["1/2", "1/2"], True), ############################################################################ - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), P1, [0.25, 0.25, 0.25, 0.25], False), - (games.create_myerson_2_card_poker_efg(), P2, [0.5, 0.5], False), - (games.create_myerson_2_card_poker_efg(), P1, ["1/4", "1/4", "1/4", "1/4"], True), - (games.create_myerson_2_card_poker_efg(), P2, ["1/2", "1/2"], True), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), "Fred", [0.25, 0.25, 0.25, 0.25], False), + (games.create_stripped_down_poker_efg(), "Alice", [0.5, 0.5], False), + (games.create_stripped_down_poker_efg(), "Fred", ["1/4", "1/4", "1/4", "1/4"], True), + (games.create_stripped_down_poker_efg(), "Alice", ["1/2", "1/2"], True), ############################################################################ # coordination 4x4 nfg (games.create_coord_4x4_nfg(), P1, [0.25, 0.25, 0.25, 0.25], False), @@ -337,25 +337,25 @@ def test_profile_indexing_by_player_label_reference(game: gbt.Game, player_label (games.create_coord_4x4_nfg(), False, [[1, 0, 0, 0], [0, 1, 0, 0]], P2, 0), (games.create_coord_4x4_nfg(), True, [[1, 0, 0, 0], [0, 1, 0, 0]], P2, 0), ######################################################################### - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), False, None, P1, -1.25), - (games.create_myerson_2_card_poker_efg(), False, None, P2, 1.25), - (games.create_myerson_2_card_poker_efg(), True, None, P1, "-5/4"), - (games.create_myerson_2_card_poker_efg(), True, None, P2, "5/4"), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), False, None, "Fred", -0.25), + (games.create_stripped_down_poker_efg(), False, None, "Alice", 0.25), + (games.create_stripped_down_poker_efg(), True, None, "Fred", "-1/4"), + (games.create_stripped_down_poker_efg(), True, None, "Alice", "1/4"), # Raise/Raise for player 1 - (games.create_myerson_2_card_poker_efg(), False, [[1, 0, 0, 0], [1, 0]], P1, -1), - (games.create_myerson_2_card_poker_efg(), False, [[1, 0, 0, 0], [1, 0]], P2, 1), - (games.create_myerson_2_card_poker_efg(), True, [[1, 0, 0, 0], [1, 0]], P1, -1), - (games.create_myerson_2_card_poker_efg(), True, [[1, 0, 0, 0], [1, 0]], P2, 1), + (games.create_stripped_down_poker_efg(), False, [[1, 0, 0, 0], [1, 0]], "Fred", 0), + (games.create_stripped_down_poker_efg(), False, [[1, 0, 0, 0], [1, 0]], "Alice", 0), + (games.create_stripped_down_poker_efg(), True, [[1, 0, 0, 0], [1, 0]], "Fred", 0), + (games.create_stripped_down_poker_efg(), True, [[1, 0, 0, 0], [1, 0]], "Alice", 0), # Fold/Fold for player 1 (player 2's strategy is payoff-irrelevant) - (games.create_myerson_2_card_poker_efg(), False, [[0, 0, 0, 1], [1, 0]], P1, -2), - (games.create_myerson_2_card_poker_efg(), False, [[0, 0, 0, 1], [1, 0]], P2, 2), - (games.create_myerson_2_card_poker_efg(), True, [[0, 0, 0, 1], [1, 0]], P1, -2), - (games.create_myerson_2_card_poker_efg(), True, [[0, 0, 0, 1], [1, 0]], P2, 2), - (games.create_myerson_2_card_poker_efg(), False, [[0, 0, 0, 1], [0.5, 0.5]], P1, -2), - (games.create_myerson_2_card_poker_efg(), False, [[0, 0, 0, 1], [0.5, 0.5]], P2, 2), - (games.create_myerson_2_card_poker_efg(), True, [[0, 0, 0, 1], ["1/2", "1/2"]], P1, -2), - (games.create_myerson_2_card_poker_efg(), True, [[0, 0, 0, 1], ["1/2", "1/2"]], P2, 2), + (games.create_stripped_down_poker_efg(), False, [[0, 0, 0, 1], [1, 0]], "Fred", -1), + (games.create_stripped_down_poker_efg(), False, [[0, 0, 0, 1], [1, 0]], "Alice", 1), + (games.create_stripped_down_poker_efg(), True, [[0, 0, 0, 1], [1, 0]], "Fred", -1), + (games.create_stripped_down_poker_efg(), True, [[0, 0, 0, 1], [1, 0]], "Alice", 1), + (games.create_stripped_down_poker_efg(), False, [[0, 0, 0, 1], [0.5, 0.5]], "Fred", -1), + (games.create_stripped_down_poker_efg(), False, [[0, 0, 0, 1], [0.5, 0.5]], "Alice", 1), + (games.create_stripped_down_poker_efg(), True, [[0, 0, 0, 1], ["1/2", "1/2"]], "Fred", -1), + (games.create_stripped_down_poker_efg(), True, [[0, 0, 0, 1], ["1/2", "1/2"]], "Alice", 1), ######################################################################### (games.create_mixed_behav_game_efg(), False, None, P1, 3.0), (games.create_mixed_behav_game_efg(), False, None, P2, 3.0), @@ -384,15 +384,15 @@ def test_payoff_by_label_reference(game: gbt.Game, rational_flag: bool, profile_ (games.create_coord_4x4_nfg(outcome_version=True), False, "1-1", 0.25), (games.create_coord_4x4_nfg(outcome_version=True), True, "1-1", "1/4"), ############################################################################## - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), False, "11", -0.5), # Raise/Raise - (games.create_myerson_2_card_poker_efg(), False, "12", -0.75), # Raise Red/Fold Black - (games.create_myerson_2_card_poker_efg(), False, "21", -1.75), # Fold Red/Raise Black - (games.create_myerson_2_card_poker_efg(), False, "22", -2), # Fold/Fold - (games.create_myerson_2_card_poker_efg(), True, "11", "-1/2"), - (games.create_myerson_2_card_poker_efg(), True, "12", "-3/4"), - (games.create_myerson_2_card_poker_efg(), True, "21", "-7/4"), - (games.create_myerson_2_card_poker_efg(), True, "22", -2), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), False, "11", 0.5), # Bet/Bet + (games.create_stripped_down_poker_efg(), False, "12", 0.25), # Bet King/Fold Queen + (games.create_stripped_down_poker_efg(), False, "21", -0.75), # Fold King/Bet Queen + (games.create_stripped_down_poker_efg(), False, "22", -1), # Fold/Fold + (games.create_stripped_down_poker_efg(), True, "11", "1/2"), + (games.create_stripped_down_poker_efg(), True, "12", "1/4"), + (games.create_stripped_down_poker_efg(), True, "21", "-3/4"), + (games.create_stripped_down_poker_efg(), True, "22", -1), ] ) def test_strategy_value_by_label_reference(game: gbt.Game, rational_flag: bool, label: str, @@ -483,8 +483,8 @@ def test_payoffs_reference(game: gbt.Game, profile_data: list, rational_flag: bo (games.create_2x2x2_nfg(), None, True, (["1/2", "1/2"], [2, 2], ["1/2", "1/2"])), (games.create_2x2x2_nfg(), [[1, 0], [1, 0], [1, 0]], True, ([0, 1], [0, 4], [0, 1])), ############################################################################### - # myerson 2 card poker efg - (games.create_myerson_2_card_poker_efg(), None, False, [(-0.5, -0.75, -1.75, -2), (1.5, 1)]), + # stripped-down poker efg + (games.create_stripped_down_poker_efg(), None, False, [(0.5, 0.25, -0.75, -1), (0.5, 0)]), ] ) def test_strategy_value_reference(game: gbt.Game, profile_data: list, rational_flag: bool, @@ -821,11 +821,11 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: pytest.param(games.create_2x2x2_nfg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, player: profile.payoff(player), lambda game: game.players, id="payoffs_2x2x2_rat"), - # Myerson 2-card poker efg - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + # stripped-down poker + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda profile, player: profile.payoff(player), lambda game: game.players, id="payoffs_poker_doub"), - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, player: profile.payoff(player), lambda game: game.players, id="payoffs_poker_rat"), ################################################################################# @@ -844,11 +844,11 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: pytest.param(games.create_2x2x2_nfg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, strategy: profile.strategy_regret(strategy), lambda game: game.strategies, id="regret_2x2x2_rat"), - # Myerson 2-card poker efg - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + # stripped-down poker + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda profile, strategy: profile.strategy_regret(strategy), lambda game: game.strategies, id="regret_poker_doub"), - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, strategy: profile.strategy_regret(strategy), lambda game: game.strategies, id="regret_poker_rat"), ################################################################################# @@ -867,11 +867,11 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: pytest.param(games.create_2x2x2_nfg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, strategy: profile.strategy_value(strategy), lambda game: game.strategies, id="strat_value_2x2x2_rat"), - # Myerson 2-card poker efg - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + # stripped-down poker + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda profile, strategy: profile.strategy_value(strategy), lambda game: game.strategies, id="strat_value_poker_doub"), - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, strategy: profile.strategy_value(strategy), lambda game: game.strategies, id="strat_value_poker_rat"), ################################################################################# @@ -898,13 +898,13 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: other=strat_pair[1]), lambda game: list(product(game.strategies, game.strategies)), id="strat_value_deriv_2x2x2_rat"), - # Myerson 2-card poker efg - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + # stripped-down poker + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda profile, strat_pair: profile.strategy_value_deriv(strategy=strat_pair[0], other=strat_pair[1]), lambda game: list(product(game.strategies, game.strategies)), id="strat_value_deriv_poker_doub"), - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, strat_pair: profile.strategy_value_deriv(strategy=strat_pair[0], other=strat_pair[1]), lambda game: list(product(game.strategies, game.strategies)), @@ -925,11 +925,11 @@ def _get_and_check_answers(game: gbt.Game, action_probs1: tuple, action_probs2: pytest.param(games.create_2x2x2_nfg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, y: profile.liap_value(), lambda x: [1], id="liap_value_2x2x2_rat"), - # Myerson 2-card poker efg - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, + # stripped-down poker + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_doub, PROBS_2B_doub, False, lambda profile, y: profile.liap_value(), lambda x: [1], id="liap_value_poker_doub"), - pytest.param(games.create_myerson_2_card_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, + pytest.param(games.create_stripped_down_poker_efg(), PROBS_1B_rat, PROBS_2B_rat, True, lambda profile, y: profile.liap_value(), lambda x: [1], id="liap_value_poker_rat"), ] diff --git a/tests/test_nash.py b/tests/test_nash.py index 4d35c57d8..7fbf7c02b 100644 --- a/tests/test_nash.py +++ b/tests/test_nash.py @@ -19,20 +19,20 @@ def test_enumpure_strategy(): """Test calls of enumeration of pure strategies.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") assert len(gbt.nash.enumpure_solve(game, use_strategic=True).equilibria) == 0 def test_enumpure_agent(): """Test calls of enumeration of pure agent strategies.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") assert len(gbt.nash.enumpure_solve(game, use_strategic=False).equilibria) == 0 def test_enummixed_double(): """Test calls of enumeration of mixed strategy equilibria for 2-player games, floating-point. """ - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.enummixed_solve(game, rational=False) assert len(result.equilibria) == 1 # For floating-point results are not exact, so we skip testing exact values for now @@ -44,8 +44,7 @@ def test_enummixed_double(): "game,mixed_strategy_prof_data", [ # Zero-sum games - (games.create_1_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]]), - (games.create_myerson_2_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]]), + (games.create_stripped_down_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]]), # Non-zero-sum games (games.create_one_shot_trust_efg(), [[[0, 1], ["1/2", "1/2"]], [[0, 1], [0, 1]]]), @@ -91,12 +90,7 @@ def test_enummixed_rational(game: gbt.Game, mixed_strategy_prof_data: list): [ # 2-player zero-sum games ( - games.create_1_card_poker_efg(), - [[[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]], - None, - ), - ( - games.create_myerson_2_card_poker_efg(), + games.create_stripped_down_poker_efg(), [[[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]], None, ), @@ -240,7 +234,7 @@ def are_the_same(game, found, candidate): def test_lcp_strategy_double(): """Test calls of LCP for mixed strategy equilibria, floating-point.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.lcp_solve(game, use_strategic=True, rational=False) assert len(result.equilibria) == 1 # For floating-point results are not exact, so we skip testing exact values for now @@ -252,8 +246,7 @@ def test_lcp_strategy_double(): "game,mixed_strategy_prof_data,stop_after", [ # Zero-sum games - (games.create_1_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None), - (games.create_myerson_2_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None), + (games.create_stripped_down_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None), (games.create_kuhn_poker_efg(), [games.kuhn_poker_lcp_first_mixed_strategy_prof()], 1), # Non-zero-sum games (games.create_one_shot_trust_efg(), [[[0, 1], ["1/2", "1/2"]]], None), @@ -311,7 +304,7 @@ def test_lcp_strategy_rational(game: gbt.Game, mixed_strategy_prof_data: list, def test_lcp_behavior_double(): """Test calls of LCP for mixed behavior equilibria, floating-point.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.lcp_solve(game, use_strategic=False, rational=False) assert len(result.equilibria) == 1 # For floating-point results are not exact, so we skip testing exact values for now @@ -323,8 +316,7 @@ def test_lcp_behavior_double(): "game,mixed_behav_prof_data", [ # Zero-sum games (also tested with lp solve) - (games.create_1_card_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]), - (games.create_myerson_2_card_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]), + (games.create_stripped_down_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]), ( games.create_kuhn_poker_efg(), [ @@ -380,7 +372,7 @@ def test_lcp_behavior_rational(game: gbt.Game, mixed_behav_prof_data: list): def test_lp_strategy_double(): """Test calls of LP for mixed strategy equilibria, floating-point.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.lp_solve(game, use_strategic=True, rational=False) assert len(result.equilibria) == 1 # For floating-point results are not exact, so we skip testing exact values for now @@ -390,7 +382,7 @@ def test_lp_strategy_double(): @pytest.mark.nash_lp_strategy def test_lp_strategy_rational(): """Test calls of LP for mixed strategy equilibria, rational precision.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.lp_solve(game, use_strategic=True, rational=True) assert len(result.equilibria) == 1 expected = game.mixed_strategy_profile( @@ -405,7 +397,7 @@ def test_lp_strategy_rational(): def test_lp_behavior_double(): """Test calls of LP for mixed behavior equilibria, floating-point.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.lp_solve(game, use_strategic=False, rational=False) assert len(result.equilibria) == 1 # For floating-point results are not exact, so we skip testing exact values for now @@ -420,9 +412,8 @@ def test_lp_behavior_double(): games.create_two_player_perfect_info_win_lose_efg(), [[[0, 1], [1, 0]], [[1, 0], [1, 0]]], ), - (games.create_1_card_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]), ( - games.create_myerson_2_card_poker_efg(), + games.create_stripped_down_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]], ), ( @@ -456,47 +447,47 @@ def test_lp_behavior_rational(game: gbt.Game, mixed_behav_prof_data: list): def test_liap_strategy(): """Test calls of liap for mixed strategy equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") _ = gbt.nash.liap_solve(game.mixed_strategy_profile()) def test_liap_behavior(): """Test calls of liap for mixed behavior equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") _ = gbt.nash.liap_solve(game.mixed_behavior_profile()) def test_simpdiv_strategy(): """Test calls of simplicial subdivision for mixed strategy equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.simpdiv_solve(game.mixed_strategy_profile(rational=True)) assert len(result.equilibria) == 1 def test_ipa_strategy(): """Test calls of IPA for mixed strategy equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.ipa_solve(game) assert len(result.equilibria) == 1 def test_gnm_strategy(): """Test calls of GNM for mixed strategy equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.gnm_solve(game) assert len(result.equilibria) == 1 def test_logit_strategy(): """Test calls of logit for mixed strategy equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.logit_solve(game, use_strategic=True) assert len(result.equilibria) == 1 def test_logit_behavior(): """Test calls of logit for behavior equilibria.""" - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") result = gbt.nash.logit_solve(game, use_strategic=False) assert len(result.equilibria) == 1 diff --git a/tests/test_node.py b/tests/test_node.py index 8636a7559..e11524522 100644 --- a/tests/test_node.py +++ b/tests/test_node.py @@ -791,26 +791,26 @@ def test_node_plays(): def test_node_children_action_label(): - game = games.read_from_file("poker.efg") - assert game.root.children["Red"] == game.root.children[0] - assert game.root.children["Black"].children["Fold"] == game.root.children[1].children[1] + game = games.read_from_file("stripped_down_poker.efg") + assert game.root.children["King"] == game.root.children[0] + assert game.root.children["Queen"].children["Fold"] == game.root.children[1].children[1] def test_node_children_action(): - game = games.read_from_file("poker.efg") - assert game.root.children[game.root.infoset.actions["Red"]] == game.root.children[0] + game = games.read_from_file("stripped_down_poker.efg") + assert game.root.children[game.root.infoset.actions["King"]] == game.root.children[0] def test_node_children_nonexistent_action(): - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") with pytest.raises(ValueError): - _ = game.root.children["Green"] + _ = game.root.children["Jack"] def test_node_children_other_infoset_action(): - game = games.read_from_file("poker.efg") + game = games.read_from_file("stripped_down_poker.efg") with pytest.raises(ValueError): - _ = game.root.children[game.root.children[0].infoset.actions["Raise"]] + _ = game.root.children[game.root.children[0].infoset.actions["Bet"]] @pytest.mark.parametrize( @@ -821,7 +821,7 @@ def test_node_children_other_infoset_action(): pytest.param(games.read_from_file("cent3.efg")), pytest.param(games.read_from_file("e01.efg")), pytest.param(games.read_from_file("e02.efg")), - pytest.param(games.read_from_file("poker.efg")), + pytest.param(games.read_from_file("stripped_down_poker.efg")), pytest.param(gbt.Game.new_tree()), ], )