Skip to content

Commit 255afa4

Browse files
committed
removed create_3_player_with_internal_outcomes_efg and create_large_payoff_game from games.py
1 parent 47b6500 commit 255afa4

File tree

7 files changed

+74
-82
lines changed

7 files changed

+74
-82
lines changed

tests/games.py

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -185,80 +185,6 @@ def create_non_zero_sum_lacking_outcome_efg(missing_term_outcome: bool = False)
185185
return g
186186

187187

188-
def create_large_payoff_game_efg() -> gbt.Game:
189-
g = gbt.Game.new_tree(players=["1", "2"], title="Large payoff game")
190-
g.append_move(g.root, g.players.chance, ["L", "R"])
191-
for i in range(2):
192-
g.append_move(g.root.children[i], "1", ["A", "B"])
193-
for i in range(2):
194-
g.append_move(g.root.children[0].children[i], "2", ["X", "Y"])
195-
g.append_infoset(g.root.children[1].children[i], g.root.children[0].children[i].infoset)
196-
o_large = g.add_outcome([10000000000000000000, -10000000000000000000], label="large payoff")
197-
o_1 = g.add_outcome([1, -1], label="1")
198-
o_m1 = g.add_outcome([-1, 1], label="-1")
199-
o_zero = g.add_outcome([0, 0], label="0")
200-
g.set_outcome(g.root.children[0].children[0].children[0], o_large)
201-
g.set_outcome(g.root.children[0].children[0].children[1], o_1)
202-
g.set_outcome(g.root.children[0].children[1].children[0], o_m1)
203-
g.set_outcome(g.root.children[0].children[1].children[1], o_zero)
204-
g.set_outcome(g.root.children[1].children[0].children[0], o_m1)
205-
g.set_outcome(g.root.children[1].children[0].children[1], o_1)
206-
g.set_outcome(g.root.children[1].children[1].children[0], o_zero)
207-
g.set_outcome(g.root.children[1].children[1].children[1], o_large)
208-
g.to_efg("large_payoff_game.efg")
209-
return g
210-
211-
212-
def create_3_player_with_internal_outcomes_efg(nonterm_outcomes: bool = False) -> gbt.Game:
213-
g = gbt.Game.new_tree(players=["1", "2", "3"], title="3 player game")
214-
g.append_move(g.root, g.players.chance, ["H", "T"])
215-
g.set_chance_probs(g.root.infoset, ["1/2", "1/2"])
216-
g.append_move(g.root.children[0], "1", ["a", "b"])
217-
g.append_move(g.root.children[1], "1", ["c", "d"])
218-
g.append_move(g.root.children[0].children[0], "2", ["A", "B"])
219-
g.append_infoset(g.root.children[1].children[0], g.root.children[0].children[0].infoset)
220-
g.append_move(g.root.children[0].children[1], "3", ["W", "X"])
221-
g.append_infoset(g.root.children[1].children[1], g.root.children[0].children[1].infoset)
222-
g.append_move(g.root.children[0].children[0].children[0], "3", ["Y", "Z"])
223-
iset = g.root.children[0].children[0].children[0].infoset
224-
g.append_infoset(g.root.children[0].children[0].children[1], iset)
225-
g.append_move(g.root.children[0].children[1].children[1], "2", ["C", "D"])
226-
o = g.add_outcome([3, 1, 4])
227-
g.set_outcome(g.root.children[0].children[0].children[0].children[0], o)
228-
o = g.add_outcome([4, 0, 1])
229-
g.set_outcome(g.root.children[0].children[0].children[0].children[1], o)
230-
o = g.add_outcome([1, 3, 2])
231-
g.set_outcome(g.root.children[0].children[1].children[0], o)
232-
o = g.add_outcome([2, 4, 1])
233-
g.set_outcome(g.root.children[0].children[1].children[1].children[0], o)
234-
o = g.add_outcome([4, 1, 3])
235-
g.set_outcome(g.root.children[0].children[1].children[1].children[1], o)
236-
if nonterm_outcomes:
237-
o = g.add_outcome([1, 2, 3])
238-
g.set_outcome(g.root.children[1], o)
239-
o = g.add_outcome([1, 0, 1])
240-
g.set_outcome(g.root.children[1].children[0].children[0], o)
241-
o = g.add_outcome([2, -1, -2])
242-
g.set_outcome(g.root.children[1].children[0].children[1], o)
243-
o = g.add_outcome([-1, 2, -1])
244-
g.set_outcome(g.root.children[1].children[1].children[0], o)
245-
else:
246-
o = g.add_outcome([2, 2, 4])
247-
g.set_outcome(g.root.children[1].children[0].children[0], o)
248-
o = g.add_outcome([3, 1, 1])
249-
g.set_outcome(g.root.children[1].children[0].children[1], o)
250-
o = g.add_outcome([0, 4, 2])
251-
g.set_outcome(g.root.children[1].children[1].children[0], o)
252-
o = g.add_outcome([1, 2, 3])
253-
g.set_outcome(g.root.children[1].children[1].children[1], o)
254-
o = g.add_outcome([0, 0, 0])
255-
g.set_outcome(g.root.children[0].children[0].children[1].children[0], o)
256-
g.set_outcome(g.root.children[0].children[0].children[1].children[1], o)
257-
tmp = "_with_nonterm_outcomes" if nonterm_outcomes else ""
258-
g.to_efg(f"3_player{tmp}.efg")
259-
return g
260-
261-
262188
def create_matching_pennies_efg(with_neutral_outcome: bool = False) -> gbt.Game:
263189
"""
264190
TODO: use create_efg_corresponding_to_bimatrix_game

tests/test_behav.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,8 @@ def test_infoset_regret_consistency(game: gbt.Game, rational_flag: bool):
843843
(games.create_stripped_down_poker_efg(), True),
844844
(games.create_kuhn_poker_efg(), False),
845845
(games.create_kuhn_poker_efg(), True),
846-
(games.create_3_player_with_internal_outcomes_efg(), False),
847-
(games.create_3_player_with_internal_outcomes_efg(), True)
846+
(games.read_from_file("3_player.efg"), False),
847+
(games.read_from_file("3_player.efg"), True)
848848
]
849849
)
850850
def test_max_regret_consistency(game: gbt.Game, rational_flag: bool):

tests/test_extensive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ def test_reduced_strategic_form(
405405
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
(
412412
games.read_from_file("chance_in_middle.efg"),

tests/test_games/3_player.efg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EFG 2 R "3 player game" { "1" "2" "3" }
2+
""
3+
4+
c "" 1 "" { "H" 1/2 "T" 1/2 } 0
5+
p "" 1 1 "" { "a" "b" } 0
6+
p "" 2 1 "" { "A" "B" } 0
7+
p "" 3 2 "" { "Y" "Z" } 0
8+
t "" 1 "" { 3, 1, 4 }
9+
t "" 2 "" { 4, 0, 1 }
10+
p "" 3 2 "" { "Y" "Z" } 0
11+
t "" 10 "" { 0, 0, 0 }
12+
t "" 10 "" { 0, 0, 0 }
13+
p "" 3 1 "" { "W" "X" } 0
14+
t "" 3 "" { 1, 3, 2 }
15+
p "" 2 2 "" { "C" "D" } 0
16+
t "" 4 "" { 2, 4, 1 }
17+
t "" 5 "" { 4, 1, 3 }
18+
p "" 1 2 "" { "c" "d" } 0
19+
p "" 2 1 "" { "A" "B" } 0
20+
t "" 6 "" { 2, 2, 4 }
21+
t "" 7 "" { 3, 1, 1 }
22+
p "" 3 1 "" { "W" "X" } 0
23+
t "" 8 "" { 0, 4, 2 }
24+
t "" 9 "" { 1, 2, 3 }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EFG 2 R "3 player game" { "1" "2" "3" }
2+
""
3+
4+
c "" 1 "" { "H" 1/2 "T" 1/2 } 0
5+
p "" 1 1 "" { "a" "b" } 0
6+
p "" 2 1 "" { "A" "B" } 0
7+
p "" 3 2 "" { "Y" "Z" } 0
8+
t "" 1 "" { 3, 1, 4 }
9+
t "" 2 "" { 4, 0, 1 }
10+
p "" 3 2 "" { "Y" "Z" } 0
11+
t "" 0
12+
t "" 0
13+
p "" 3 1 "" { "W" "X" } 0
14+
t "" 3 "" { 1, 3, 2 }
15+
p "" 2 2 "" { "C" "D" } 0
16+
t "" 4 "" { 2, 4, 1 }
17+
t "" 5 "" { 4, 1, 3 }
18+
p "" 1 2 "" { "c" "d" } 6 "" { 1, 2, 3 }
19+
p "" 2 1 "" { "A" "B" } 0
20+
t "" 7 "" { 1, 0, 1 }
21+
t "" 8 "" { 2, -1, -2 }
22+
p "" 3 1 "" { "W" "X" } 0
23+
t "" 9 "" { -1, 2, -1 }
24+
t "" 0
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
EFG 2 R "Large payoff game" { "1" "2" }
2+
""
3+
4+
c "" 1 "" { "L" 1/2 "R" 1/2 } 0
5+
p "" 1 1 "" { "A" "B" } 0
6+
p "" 2 1 "" { "X" "Y" } 0
7+
t "" 1 "large payoff" { 10000000000000000000, -10000000000000000000 }
8+
t "" 2 "1" { 1, -1 }
9+
p "" 2 2 "" { "X" "Y" } 0
10+
t "" 3 "-1" { -1, 1 }
11+
t "" 4 "0" { 0, 0 }
12+
p "" 1 2 "" { "A" "B" } 0
13+
p "" 2 1 "" { "X" "Y" } 0
14+
t "" 3 "-1" { -1, 1 }
15+
t "" 2 "1" { 1, -1 }
16+
p "" 2 2 "" { "X" "Y" } 0
17+
t "" 4 "0" { 0, 0 }
18+
t "" 1 "large payoff" { 10000000000000000000, -10000000000000000000 }

tests/test_nash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,15 @@ def test_enummixed_rational(game: gbt.Game, mixed_strategy_prof_data: list):
249249
##############################################################################
250250
##############################################################################
251251
(
252-
games.create_3_player_with_internal_outcomes_efg(),
252+
games.read_from_file("3_player.efg"),
253253
[
254254
[[[1, 0], [1, 0]], [[1, 0], ["1/2", "1/2"]], [[1, 0], [0, 1]]],
255255
[[[1, 0], [1, 0]], [[1, 0], [0, 1]],
256256
[[1, 0], ["1/3", "2/3"]]]],
257257
2,
258258
),
259259
(
260-
games.create_3_player_with_internal_outcomes_efg(nonterm_outcomes=True),
260+
games.read_from_file("3_player_with_nonterm_outcomes.efg"),
261261
[
262262
[[[1, 0], [1, 0]], [[1, 0], ["1/2", "1/2"]], [[1, 0], [0, 1]]],
263263
[[[1, 0], [1, 0]], [[1, 0], [0, 1]],
@@ -579,7 +579,7 @@ def test_lcp_behavior_double():
579579
],
580580
),
581581
(
582-
games.create_large_payoff_game_efg(),
582+
games.read_from_file("large_payoff_game.efg"),
583583
[
584584
[[1, 0], [1, 0]],
585585
[[0, 1], ["9999999999999999999/10000000000000000000",
@@ -784,7 +784,7 @@ def test_lp_behavior_double():
784784
],
785785
),
786786
(
787-
games.create_large_payoff_game_efg(),
787+
games.read_from_file("large_payoff_game.efg"),
788788
[
789789
[[1, 0], [1, 0]],
790790
[[0, 1], ["9999999999999999999/10000000000000000000",

0 commit comments

Comments
 (0)