Skip to content

Commit 90742ee

Browse files
committed
Merge remote-tracking branch 'origin/maint_clean_up_tests_games_py' into dev_testfixtures
2 parents 7018a16 + 2394420 commit 90742ee

29 files changed

Lines changed: 3787 additions & 2366 deletions

tests/games.py

Lines changed: 19 additions & 674 deletions
Large diffs are not rendered by default.

tests/test_behav.py

Lines changed: 1602 additions & 862 deletions
Large diffs are not rendered by default.

tests/test_extensive.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_outcome_index_exception_label():
123123
###############################################################################
124124
# 1 player; reduction; generic payoffs
125125
(
126-
games.create_reduction_one_player_generic_payoffs_efg(),
126+
games.read_from_file("reduction_one_player_generic_payoffs.efg"),
127127
[["11", "12", "2*", "3*", "4*"]],
128128
[np.array(range(1, 6))],
129129
),
@@ -168,7 +168,7 @@ def test_outcome_index_exception_label():
168168
),
169169
# 2-player (zero-sum) game; reduction for both players; generic payoffs
170170
(
171-
games.create_reduction_generic_payoffs_efg(),
171+
games.read_from_file("reduction_generic_payoffs.efg"),
172172
[
173173
["1*1", "1*2", "211", "212", "221", "222"],
174174
["11*", "12*", "2**", "3*1", "3*2", "4**"],
@@ -210,7 +210,7 @@ def test_outcome_index_exception_label():
210210
),
211211
# # 2-player game from GTE survey; reduction for both players; payoff ties
212212
(
213-
games.create_reduction_both_players_payoff_ties_efg(),
213+
games.read_from_file("reduction_both_players_payoff_ties_GTE_survey.efg"),
214214
[
215215
["1*", "2*", "31", "32", "4*"],
216216
[
@@ -401,28 +401,28 @@ def test_reduced_strategic_form(
401401
"standard,modified",
402402
[
403403
(
404-
games.create_two_player_perfect_info_win_lose_efg(),
405-
games.create_two_player_perfect_info_win_lose_efg(nonterm_outcomes=True)
404+
games.read_from_file("two_player_perfect_info_win_lose.efg"),
405+
games.read_from_file("two_player_perfect_info_win_lose_with_nonterm_outcomes.efg")
406406
),
407407
(
408-
games.create_3_player_with_internal_outcomes_efg(),
409-
games.create_3_player_with_internal_outcomes_efg(nonterm_outcomes=True)
408+
games.read_from_file("3_player.efg"),
409+
games.read_from_file("3_player_with_nonterm_outcomes.efg")
410410
),
411411
(
412-
games.create_chance_in_middle_efg(),
413-
games.create_chance_in_middle_efg(nonterm_outcomes=True)
412+
games.read_from_file("chance_in_middle.efg"),
413+
games.read_from_file("chance_in_middle_with_nonterm_outcomes.efg")
414414
),
415415
(
416-
games.create_non_zero_sum_lacking_outcome_efg(),
417-
games.create_non_zero_sum_lacking_outcome_efg(missing_term_outcome=True)
416+
games.read_from_file("2_player_non_zero_sum.efg"),
417+
games.read_from_file("2_player_non_zero_sum_missing_term_outcome.efg"),
418418
),
419419
(
420-
games.create_entry_accomodation_efg(),
421-
games.create_entry_accomodation_efg(nonterm_outcomes=True)
420+
games.read_from_file("entry_accommodation.efg"),
421+
games.read_from_file("entry_accommodation_with_nonterm_outcomes.efg")
422422
),
423423
(
424-
games.create_three_action_internal_outcomes_efg(),
425-
games.create_three_action_internal_outcomes_efg(nonterm_outcomes=True)
424+
games.read_from_file("2_player_chance.efg"),
425+
games.read_from_file("2_player_chance_nonterm_outcomes_and_missing_term_outcomes.efg"),
426426
),
427427
(
428428
games.create_kuhn_poker_efg(),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EFG 2 R "" { "1" "2" }
2+
""
3+
4+
c "" 1 "" { "H" 1/2 "L" 1/2 } 0
5+
p "" 1 1 "" { "A" "B" "C" } 0
6+
p "" 2 1 "" { "X" "Y" } 0
7+
t "" 1 "1" { 1, -1 }
8+
t "" 2 "-1" { -1, 1 }
9+
p "" 2 2 "" { "X" "Y" } 0
10+
t "" 2 "-1" { -1, 1 }
11+
t "" 1 "1" { 1, -1 }
12+
p "" 2 3 "" { "X" "Y" } 0
13+
t "" 1 "1" { 1, -1 }
14+
t "" 5 "0" { 0, 0 }
15+
p "" 1 2 "" { "A" "B" "C" } 0
16+
p "" 2 1 "" { "X" "Y" } 0
17+
t "" 5 "0" { 0, 0 }
18+
t "" 1 "1" { 1, -1 }
19+
p "" 2 2 "" { "X" "Y" } 0
20+
t "" 1 "1" { 1, -1 }
21+
t "" 2 "-1" { -1, 1 }
22+
p "" 2 3 "" { "X" "Y" } 0
23+
t "" 2 "-1" { -1, 1 }
24+
t "" 1 "1" { 1, -1 }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EFG 2 R "" { "1" "2" }
2+
""
3+
4+
c "" 1 "" { "H" 1/2 "L" 1/2 } 0
5+
p "" 1 1 "" { "A" "B" "C" } 0
6+
p "" 2 1 "" { "X" "Y" } 1 "1" { 1, -1 }
7+
t "" 0
8+
t "" 4 "-2" { -2, 2 }
9+
p "" 2 2 "" { "X" "Y" } 0
10+
t "" 2 "-1" { -1, 1 }
11+
t "" 1 "1" { 1, -1 }
12+
p "" 2 3 "" { "X" "Y" } 0
13+
t "" 1 "1" { 1, -1 }
14+
t "" 0
15+
p "" 1 2 "" { "A" "B" "C" } 0
16+
p "" 2 1 "" { "X" "Y" } 0
17+
t "" 0
18+
t "" 1 "1" { 1, -1 }
19+
p "" 2 2 "" { "X" "Y" } 0
20+
t "" 1 "1" { 1, -1 }
21+
t "" 2 "-1" { -1, 1 }
22+
p "" 2 3 "" { "X" "Y" } 2 "-1" { -1, 1 }
23+
t "" 0
24+
t "" 3 "2" { 2, -2 }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
EFG 2 R "Non constant-sum game lacking outcome" { "1" "2" }
2+
""
3+
4+
c "" 1 "" { "H" 1/2 "T" 1/2 } 0
5+
p "" 1 1 "" { "A" "B" } 0
6+
p "" 2 1 "" { "X" "Y" } 0
7+
t "" 1 "" { 2, 1 }
8+
t "" 2 "" { -1, 2 }
9+
p "" 2 1 "" { "X" "Y" } 0
10+
t "" 3 "" { 1, -1 }
11+
t "" 4 "" { 0, 0 }
12+
p "" 1 1 "" { "A" "B" } 0
13+
p "" 2 1 "" { "X" "Y" } 0
14+
t "" 5 "" { 1, 0 }
15+
t "" 6 "" { 0, 1 }
16+
p "" 2 1 "" { "X" "Y" } 0
17+
t "" 7 "" { -1, 1 }
18+
t "" 8 "" { 2, -1 }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
EFG 2 R "Non constant-sum game lacking outcome" { "1" "2" }
2+
""
3+
4+
c "" 1 "" { "H" 1/2 "T" 1/2 } 0
5+
p "" 1 1 "" { "A" "B" } 0
6+
p "" 2 1 "" { "X" "Y" } 0
7+
t "" 1 "" { 2, 1 }
8+
t "" 2 "" { -1, 2 }
9+
p "" 2 1 "" { "X" "Y" } 0
10+
t "" 3 "" { 1, -1 }
11+
t "" 0
12+
p "" 1 1 "" { "A" "B" } 0
13+
p "" 2 1 "" { "X" "Y" } 0
14+
t "" 4 "" { 1, 0 }
15+
t "" 5 "" { 0, 1 }
16+
p "" 2 1 "" { "X" "Y" } 0
17+
t "" 6 "" { -1, 1 }
18+
t "" 7 "" { 2, -1 }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
NFG 1 R "2x2 bimatrix game with all zero payoffs, with strategy labels" { "Joe" "Dan" }
2+
3+
{ { "cooperate" "defect" }
4+
{ "defect" "defect" }
5+
}
6+
""
7+
8+
{
9+
{ "" 0, 0 }
10+
{ "" 0, 0 }
11+
{ "" 0, 0 }
12+
{ "" 0, 0 }
13+
}
14+
1 2 3 4
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
NFG 1 R "2x2x2 game with 2 pure and 1 mixed equilibrium"
2+
{ "Player 1" "Player 2" "Player 3" } { 2 2 2 }
3+
"
4+
- This comes from a local max cut instance:
5+
players {1,2,3} are nodes; edge weight{1,2} = 2; weight{1,3} = -1; weight{2,3} = 2
6+
- Pure strategies {a,b} encode if respective player is on left or right of the cut
7+
- The payoff to a player is the sum of their incident edges across the implied cut
8+
- Pure equilibrium iff local max cuts; in addition, uniform mixture is an equilibrium
9+
- Equilibrium analysis for pure profiles:
10+
a a a: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
11+
b a a: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
12+
a b a: 2 4 2 -- Nash (global max cut)
13+
b b a: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
14+
a a b: -1 2 1 -- Not Nash (regrets: 3, 0, 0)
15+
b a b: 2 4 2 -- Nash (global max cut)
16+
a b b: 1 2 -1 -- Not Nash (regrets: 0, 0, 3)
17+
b b b: 0 0 0 -- Not Nash (regrets: 1, 4, 1)
18+
"
19+
20+
0 0 0 1 2 -1 2 4 2 -1 2 1 -1 2 1 2 4 2 1 2 -1 0 0 0

tests/test_games/2x2x2_nfg_with_two_pure_one_mixed_eq.nfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)