Skip to content

Commit f894721

Browse files
committed
added game from GTE with 5x12 RSF
1 parent 732f32d commit f894721

2 files changed

Lines changed: 67 additions & 1 deletion

File tree

tests/games.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A utility module to create/load games for the test suite."""
2+
23
import pathlib
34

45
import numpy as np
@@ -132,7 +133,9 @@ def create_selten_horse_game_efg() -> gbt.Game:
132133

133134
def create_reduction_generic_payoffs_efg() -> gbt.Game:
134135
# tree with only root
135-
g = gbt.Game.new_tree(players=["1", "2"], title="2 player reduction generic payoffs")
136+
g = gbt.Game.new_tree(
137+
players=["1", "2"], title="2 player reduction generic payoffs"
138+
)
136139

137140
# add four children
138141
g.append_move(g.root, "2", ["a", "b", "c", "d"])
@@ -208,6 +211,28 @@ def create_reduction_one_player_generic_payoffs_efg() -> gbt.Game:
208211
return g
209212

210213

214+
def create_reduction_both_players_payoff_ties_efg() -> gbt.Game:
215+
g = gbt.Game.new_tree(players=["1", "2"], title="From GTE survey")
216+
g.append_move(g.root, "1", ["A", "B", "C", "D"])
217+
g.append_move(g.root.children[0], "2", ["a", "b"])
218+
g.append_move(g.root.children[1], "2", ["c", "d"])
219+
g.append_move(g.root.children[2], "2", ["e", "f"])
220+
g.append_move(g.root.children[0].children[1], "2", ["g", "h"])
221+
g.append_move(g.root.children[2].children, "1", ["E", "F"])
222+
223+
g.set_outcome(g.root.children[0].children[0], g.add_outcome([2, 8]))
224+
g.set_outcome(g.root.children[0].children[1].children[0], g.add_outcome([0, 1]))
225+
g.set_outcome(g.root.children[0].children[1].children[1], g.add_outcome([5, 2]))
226+
g.set_outcome(g.root.children[1].children[0], g.add_outcome([7, 6]))
227+
g.set_outcome(g.root.children[1].children[1], g.add_outcome([4, 2]))
228+
g.set_outcome(g.root.children[2].children[0].children[0], g.add_outcome([3, 7]))
229+
g.set_outcome(g.root.children[2].children[0].children[1], g.add_outcome([8, 3]))
230+
g.set_outcome(g.root.children[2].children[1].children[0], g.add_outcome([7, 8]))
231+
g.set_outcome(g.root.children[2].children[1].children[1], g.add_outcome([2, 2]))
232+
g.set_outcome(g.root.children[3], g.add_outcome([6, 4]))
233+
return g
234+
235+
211236
def make_rational(input: str):
212237
return gbt.Rational(input)
213238

tests/test_rsf.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,47 @@
9595
np.array([[-1, -3], [-2, -4], [-5, -7], [-6, -8]]),
9696
],
9797
),
98+
# 2-player game from GTE survey; reduction for both players; payoff ties
99+
(
100+
games.create_reduction_both_players_payoff_ties_efg(),
101+
[
102+
["1*", "2*", "31", "32", "4*"],
103+
[
104+
"111*",
105+
"112*",
106+
"121*",
107+
"122*",
108+
"2111",
109+
"2121",
110+
"2211",
111+
"2221",
112+
"2112",
113+
"2122",
114+
"2212",
115+
"2222",
116+
],
117+
],
118+
[
119+
np.array(
120+
[
121+
["2", "2", "2", "2", "0", "0", "0", "0", "5", "5", "5", "5"],
122+
["7", "7", "4", "4", "7", "7", "4", "4", "7", "7", "4", "4"],
123+
["3", "7", "3", "7", "3", "7", "3", "7", "3", "7", "3", "7"],
124+
["8", "2", "8", "2", "8", "2", "8", "2", "8", "2", "8", "2"],
125+
["6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6"],
126+
]
127+
),
128+
np.array(
129+
[
130+
["8", "8", "8", "8", "1", "1", "1", "1", "2", "2", "2", "2"],
131+
["6", "6", "2", "2", "6", "6", "2", "2", "6", "6", "2", "2"],
132+
["7", "8", "7", "8", "7", "8", "7", "8", "7", "8", "7", "8"],
133+
["3", "2", "3", "2", "3", "2", "3", "2", "3", "2", "3", "2"],
134+
["4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4"],
135+
]
136+
),
137+
],
138+
),
98139
],
99140
)
100141
def test_reduced_strategic_form(

0 commit comments

Comments
 (0)