Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc4ccf0
removed create_2x2x2_nfg from games.py
rahulsavani Jan 14, 2026
fa70567
removed create_coord_4x4_nfg from games.py
rahulsavani Jan 14, 2026
543c937
removed create_2x2_zero_nfg from games.py
rahulsavani Jan 14, 2026
c8f1752
removed create_STOC_simplified{,2} from games.py (which were not used…
rahulsavani Jan 14, 2026
6887099
added new .nfg files
rahulsavani Jan 14, 2026
00b28c3
removed create_seq_form_STOC_paper_zero_sum_2_player_efg from games.py
rahulsavani Jan 14, 2026
2cfa8a1
removed create_problem_example_efg from games.py
rahulsavani Jan 14, 2026
f2a8039
removed create_chance_in_middle_efg from games.py
rahulsavani Jan 14, 2026
e0f16fb
chance_in_middle efgs
rahulsavani Jan 14, 2026
39332ac
removed create_two_player_perfect_info_win_lose_efg from games.py
rahulsavani Jan 14, 2026
47b6500
removed create_reduction_both_players_payoff_ties_efg from games.py
rahulsavani Jan 14, 2026
255afa4
removed create_3_player_with_internal_outcomes_efg and create_large_p…
rahulsavani Jan 14, 2026
f8c32f4
removed create_reduction_one_player_generic_payoffs_efg from games.py
rahulsavani Jan 14, 2026
ce73a36
removed create_reduction_generic_payoffs_efg from games.py
rahulsavani Jan 14, 2026
9307709
removed create_perfect_info_with_chance_efg from games.py
rahulsavani Jan 14, 2026
78e3375
removed create_entry_accomodation_efg from games.py
rahulsavani Jan 14, 2026
22fafa7
removed create_non_zero_sum_lacking_outcome_efg from games.py
rahulsavani Jan 14, 2026
e275daf
create_matching_pennies_efg uses create_efg_corresponding_to_bimatrix…
rahulsavani Jan 14, 2026
25b42cd
removed temp to_efg call
rahulsavani Jan 14, 2026
02d1d86
removed create_mixed_behav_game_efg from games.py
rahulsavani Jan 14, 2026
0e5aabd
create_2x2_zero_sum_efg uses create_efg_corresponding_to_bimatrix_game
rahulsavani Jan 14, 2026
9548e67
removed create_selten_horse_game_efg from games.py
rahulsavani Jan 14, 2026
cdb6201
removed create_el_farol_bar_game_efg and create_centipede_game_with_c…
rahulsavani Jan 14, 2026
2394420
comment in create_one_shot_trust_efg, which could be removed in due c…
rahulsavani Jan 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
693 changes: 19 additions & 674 deletions tests/games.py

Large diffs are not rendered by default.

2,464 changes: 1,602 additions & 862 deletions tests/test_behav.py

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions tests/test_extensive.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_outcome_index_exception_label():
###############################################################################
# 1 player; reduction; generic payoffs
(
games.create_reduction_one_player_generic_payoffs_efg(),
games.read_from_file("reduction_one_player_generic_payoffs.efg"),
[["11", "12", "2*", "3*", "4*"]],
[np.array(range(1, 6))],
),
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_outcome_index_exception_label():
),
# 2-player (zero-sum) game; reduction for both players; generic payoffs
(
games.create_reduction_generic_payoffs_efg(),
games.read_from_file("reduction_generic_payoffs.efg"),
[
["1*1", "1*2", "211", "212", "221", "222"],
["11*", "12*", "2**", "3*1", "3*2", "4**"],
Expand Down Expand Up @@ -210,7 +210,7 @@ def test_outcome_index_exception_label():
),
# # 2-player game from GTE survey; reduction for both players; payoff ties
(
games.create_reduction_both_players_payoff_ties_efg(),
games.read_from_file("reduction_both_players_payoff_ties_GTE_survey.efg"),
[
["1*", "2*", "31", "32", "4*"],
[
Expand Down Expand Up @@ -401,28 +401,28 @@ def test_reduced_strategic_form(
"standard,modified",
[
(
games.create_two_player_perfect_info_win_lose_efg(),
games.create_two_player_perfect_info_win_lose_efg(nonterm_outcomes=True)
games.read_from_file("two_player_perfect_info_win_lose.efg"),
games.read_from_file("two_player_perfect_info_win_lose_with_nonterm_outcomes.efg")
),
(
games.create_3_player_with_internal_outcomes_efg(),
games.create_3_player_with_internal_outcomes_efg(nonterm_outcomes=True)
games.read_from_file("3_player.efg"),
games.read_from_file("3_player_with_nonterm_outcomes.efg")
),
(
games.create_chance_in_middle_efg(),
games.create_chance_in_middle_efg(nonterm_outcomes=True)
games.read_from_file("chance_in_middle.efg"),
games.read_from_file("chance_in_middle_with_nonterm_outcomes.efg")
),
(
games.create_non_zero_sum_lacking_outcome_efg(),
games.create_non_zero_sum_lacking_outcome_efg(missing_term_outcome=True)
games.read_from_file("2_player_non_zero_sum.efg"),
games.read_from_file("2_player_non_zero_sum_missing_term_outcome.efg"),
),
(
games.create_entry_accomodation_efg(),
games.create_entry_accomodation_efg(nonterm_outcomes=True)
games.read_from_file("entry_accommodation.efg"),
games.read_from_file("entry_accommodation_with_nonterm_outcomes.efg")
),
(
games.create_three_action_internal_outcomes_efg(),
games.create_three_action_internal_outcomes_efg(nonterm_outcomes=True)
games.read_from_file("2_player_chance.efg"),
games.read_from_file("2_player_chance_nonterm_outcomes_and_missing_term_outcomes.efg"),
),
(
games.create_kuhn_poker_efg(),
Expand Down
24 changes: 24 additions & 0 deletions tests/test_games/2_player_chance.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
EFG 2 R "" { "1" "2" }
""

c "" 1 "" { "H" 1/2 "L" 1/2 } 0
p "" 1 1 "" { "A" "B" "C" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 2 2 "" { "X" "Y" } 0
t "" 2 "-1" { -1, 1 }
t "" 1 "1" { 1, -1 }
p "" 2 3 "" { "X" "Y" } 0
t "" 1 "1" { 1, -1 }
t "" 5 "0" { 0, 0 }
p "" 1 2 "" { "A" "B" "C" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 5 "0" { 0, 0 }
t "" 1 "1" { 1, -1 }
p "" 2 2 "" { "X" "Y" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 2 3 "" { "X" "Y" } 0
t "" 2 "-1" { -1, 1 }
t "" 1 "1" { 1, -1 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
EFG 2 R "" { "1" "2" }
""

c "" 1 "" { "H" 1/2 "L" 1/2 } 0
p "" 1 1 "" { "A" "B" "C" } 0
p "" 2 1 "" { "X" "Y" } 1 "1" { 1, -1 }
t "" 0
t "" 4 "-2" { -2, 2 }
p "" 2 2 "" { "X" "Y" } 0
t "" 2 "-1" { -1, 1 }
t "" 1 "1" { 1, -1 }
p "" 2 3 "" { "X" "Y" } 0
t "" 1 "1" { 1, -1 }
t "" 0
p "" 1 2 "" { "A" "B" "C" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 0
t "" 1 "1" { 1, -1 }
p "" 2 2 "" { "X" "Y" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 2 3 "" { "X" "Y" } 2 "-1" { -1, 1 }
t "" 0
t "" 3 "2" { 2, -2 }
18 changes: 18 additions & 0 deletions tests/test_games/2_player_non_zero_sum.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
EFG 2 R "Non constant-sum game lacking outcome" { "1" "2" }
""

c "" 1 "" { "H" 1/2 "T" 1/2 } 0
p "" 1 1 "" { "A" "B" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 1 "" { 2, 1 }
t "" 2 "" { -1, 2 }
p "" 2 1 "" { "X" "Y" } 0
t "" 3 "" { 1, -1 }
t "" 4 "" { 0, 0 }
p "" 1 1 "" { "A" "B" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 5 "" { 1, 0 }
t "" 6 "" { 0, 1 }
p "" 2 1 "" { "X" "Y" } 0
t "" 7 "" { -1, 1 }
t "" 8 "" { 2, -1 }
18 changes: 18 additions & 0 deletions tests/test_games/2_player_non_zero_sum_missing_term_outcome.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
EFG 2 R "Non constant-sum game lacking outcome" { "1" "2" }
""

c "" 1 "" { "H" 1/2 "T" 1/2 } 0
p "" 1 1 "" { "A" "B" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 1 "" { 2, 1 }
t "" 2 "" { -1, 2 }
p "" 2 1 "" { "X" "Y" } 0
t "" 3 "" { 1, -1 }
t "" 0
p "" 1 1 "" { "A" "B" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 4 "" { 1, 0 }
t "" 5 "" { 0, 1 }
p "" 2 1 "" { "X" "Y" } 0
t "" 6 "" { -1, 1 }
t "" 7 "" { 2, -1 }
14 changes: 14 additions & 0 deletions tests/test_games/2x2_bimatrix_all_zero_payoffs.nfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
NFG 1 R "2x2 bimatrix game with all zero payoffs, with strategy labels" { "Joe" "Dan" }

{ { "cooperate" "defect" }
{ "defect" "defect" }
}
""

{
{ "" 0, 0 }
{ "" 0, 0 }
{ "" 0, 0 }
{ "" 0, 0 }
}
1 2 3 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
NFG 1 R "2x2x2 game with 2 pure and 1 mixed equilibrium"
{ "Player 1" "Player 2" "Player 3" } { 2 2 2 }
"
- This comes from a local max cut instance:
players {1,2,3} are nodes; edge weight{1,2} = 2; weight{1,3} = -1; weight{2,3} = 2
- Pure strategies {a,b} encode if respective player is on left or right of the cut
- The payoff to a player is the sum of their incident edges across the implied cut
- Pure equilibrium iff local max cuts; in addition, uniform mixture is an equilibrium
- Equilibrium analysis for pure profiles:
a a a: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
b a a: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
a b a: 2 4 2 -- Nash (global max cut)
b b a: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
a a b: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
b a b: 2 4 2 -- Nash (global max cut)
a b b: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
b b b: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
"

0 0 0 1 2 -1 2 4 2 -1 2 1 -1 2 1 2 4 2 1 2 -1 0 0 0
4 changes: 0 additions & 4 deletions tests/test_games/2x2x2_nfg_with_two_pure_one_mixed_eq.nfg

This file was deleted.

24 changes: 24 additions & 0 deletions tests/test_games/3_player.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
EFG 2 R "3 player game" { "1" "2" "3" }
""

c "" 1 "" { "H" 1/2 "T" 1/2 } 0
p "" 1 1 "" { "a" "b" } 0
p "" 2 1 "" { "A" "B" } 0
p "" 3 2 "" { "Y" "Z" } 0
t "" 1 "" { 3, 1, 4 }
t "" 2 "" { 4, 0, 1 }
p "" 3 2 "" { "Y" "Z" } 0
t "" 10 "" { 0, 0, 0 }
t "" 10 "" { 0, 0, 0 }
p "" 3 1 "" { "W" "X" } 0
t "" 3 "" { 1, 3, 2 }
p "" 2 2 "" { "C" "D" } 0
t "" 4 "" { 2, 4, 1 }
t "" 5 "" { 4, 1, 3 }
p "" 1 2 "" { "c" "d" } 0
p "" 2 1 "" { "A" "B" } 0
t "" 6 "" { 2, 2, 4 }
t "" 7 "" { 3, 1, 1 }
p "" 3 1 "" { "W" "X" } 0
t "" 8 "" { 0, 4, 2 }
t "" 9 "" { 1, 2, 3 }
24 changes: 24 additions & 0 deletions tests/test_games/3_player_with_nonterm_outcomes.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
EFG 2 R "3 player game" { "1" "2" "3" }
""

c "" 1 "" { "H" 1/2 "T" 1/2 } 0
p "" 1 1 "" { "a" "b" } 0
p "" 2 1 "" { "A" "B" } 0
p "" 3 2 "" { "Y" "Z" } 0
t "" 1 "" { 3, 1, 4 }
t "" 2 "" { 4, 0, 1 }
p "" 3 2 "" { "Y" "Z" } 0
t "" 0
t "" 0
p "" 3 1 "" { "W" "X" } 0
t "" 3 "" { 1, 3, 2 }
p "" 2 2 "" { "C" "D" } 0
t "" 4 "" { 2, 4, 1 }
t "" 5 "" { 4, 1, 3 }
p "" 1 2 "" { "c" "d" } 6 "" { 1, 2, 3 }
p "" 2 1 "" { "A" "B" } 0
t "" 7 "" { 1, 0, 1 }
t "" 8 "" { 2, -1, -2 }
p "" 3 1 "" { "W" "X" } 0
t "" 9 "" { -1, 2, -1 }
t "" 0
34 changes: 34 additions & 0 deletions tests/test_games/chance_in_middle.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
EFG 2 R "Chance in middle game" { "1" "2" }
""

p "" 1 1 "" { "A" "B" } 0
c "" 1 "" { "H" 1/5 "L" 4/5 } 0
p "" 2 1 "" { "X" "Y" } 0
p "" 1 2 "" { "C" "D" } 0
t "" 6 "0" { 0, 0 }
t "" 3 "-2" { -2, 2 }
p "" 1 3 "" { "C" "D" } 0
t "" 5 "-0.5" { -1/2, 1/2 }
t "" 7 "-1.5" { -3/2, 3/2 }
p "" 2 2 "" { "X" "Y" } 0
p "" 1 2 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
p "" 1 3 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
c "" 2 "" { "H" 7/10 "L" 3/10 } 0
p "" 2 1 "" { "X" "Y" } 0
p "" 1 4 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
p "" 1 5 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 2 2 "" { "X" "Y" } 0
p "" 1 4 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 1 5 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
34 changes: 34 additions & 0 deletions tests/test_games/chance_in_middle_with_nonterm_outcomes.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
EFG 2 R "Chance in middle game" { "1" "2" }
""

p "" 1 1 "" { "A" "B" } 0
c "" 1 "" { "H" 1/5 "L" 4/5 } 0
p "" 2 1 "" { "X" "Y" } 8 "a" { -1, 1 }
p "" 1 2 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 1 3 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
p "" 2 2 "" { "X" "Y" } 0
p "" 1 2 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
p "" 1 3 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
c "" 2 "" { "H" 7/10 "L" 3/10 } 0
p "" 2 1 "" { "X" "Y" } 0
p "" 1 4 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
p "" 1 5 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 2 2 "" { "X" "Y" } 0
p "" 1 4 "" { "C" "D" } 0
t "" 1 "1" { 1, -1 }
t "" 2 "-1" { -1, 1 }
p "" 1 5 "" { "C" "D" } 0
t "" 4 "0.5" { 1/2, -1/2 }
t "" 5 "-0.5" { -1/2, 1/2 }
14 changes: 14 additions & 0 deletions tests/test_games/entry_accommodation.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
EFG 2 R "Entry-accomodation game" { "1" "2" }
""

p "" 1 1 "" { "S" "T" } 0
p "" 2 1 "" { "E" "O" } 0
p "" 1 2 "" { "A" "F" } 0
t "" 1 "" { 3, 2 }
t "" 2 "" { 0, 1 }
t "" 3 "" { 1, 3 }
p "" 2 1 "" { "E" "O" } 0
p "" 1 3 "" { "A" "F" } 0
t "" 4 "" { 2, 3 }
t "" 5 "" { 1, 0 }
t "" 6 "" { 3, 1 }
14 changes: 14 additions & 0 deletions tests/test_games/entry_accommodation_with_nonterm_outcomes.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
EFG 2 R "Entry-accomodation game" { "1" "2" }
""

p "" 1 1 "" { "S" "T" } 0
p "" 2 1 "" { "E" "O" } 1 "" { 3, 2 }
p "" 1 2 "" { "A" "F" } 0
t "" 0
t "" 2 "" { -3, -1 }
t "" 3 "" { -2, 1 }
p "" 2 1 "" { "E" "O" } 0
p "" 1 3 "" { "A" "F" } 0
t "" 4 "" { 2, 3 }
t "" 5 "" { 1, 0 }
t "" 6 "" { 3, 1 }
18 changes: 18 additions & 0 deletions tests/test_games/large_payoff_game.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
EFG 2 R "Large payoff game" { "1" "2" }
""

c "" 1 "" { "L" 1/2 "R" 1/2 } 0
p "" 1 1 "" { "A" "B" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 1 "large payoff" { 10000000000000000000, -10000000000000000000 }
t "" 2 "1" { 1, -1 }
p "" 2 2 "" { "X" "Y" } 0
t "" 3 "-1" { -1, 1 }
t "" 4 "0" { 0, 0 }
p "" 1 2 "" { "A" "B" } 0
p "" 2 1 "" { "X" "Y" } 0
t "" 3 "-1" { -1, 1 }
t "" 2 "1" { 1, -1 }
p "" 2 2 "" { "X" "Y" } 0
t "" 4 "0" { 0, 0 }
t "" 1 "large payoff" { 10000000000000000000, -10000000000000000000 }
7 changes: 6 additions & 1 deletion tests/test_games/mixed_behavior_game.efg
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
EFG 2 R "Test Extensive Form Game" { "Player 1" "Player 2" "Player 3" }
""
"
Three-player extensive form game: binary tree with 3 infomation sets, one per player,
with 1, 2, and 4 nodes respectively.

Since no information is revealed this is directly equivalent to a simultaneous move game.
"

p "" 1 1 "Infoset 1:1" { "U1" "D1" } 0
p "" 2 1 "Infoset 2:1" { "U2" "D2" } 0
Expand Down
12 changes: 12 additions & 0 deletions tests/test_games/perfect_info_with_chance.efg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
EFG 2 R "2 player perfect info with chance" { "1" "2" }
""

p "" 1 1 "" { "a" "b" } 0
c "" 1 "" { "L" 1/2 "R" 1/2 } 0
p "" 2 1 "" { "A" "B" } 0
t "" 1 "aLA" { -2, 2 }
t "" 2 "aLB" { -2, 2 }
p "" 2 2 "" { "C" "D" } 0
t "" 3 "aRC" { -2, 2 }
t "" 4 "aRD" { -2, 2 }
t "" 5 "b" { -1, 1 }
Loading