Skip to content

Commit ce5738e

Browse files
committed
added new tests for lcp_strategy_rational and enummixed_rational
1 parent 624f862 commit ce5738e

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

tests/games.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,28 @@ def bet(player, payoffs, pot):
233233
return g
234234

235235

236+
def kuhn_poker_lcp_first_mixed_strategy_prof():
237+
"""
238+
Returns
239+
-------
240+
Data for the first extreme equilibrium in mixed stategies for Kuhn poker found by lcp_solve
241+
"""
242+
alice = [0] * 27
243+
alice[1] = "2/3"
244+
alice[4] = "1/3"
245+
bob = [0] * 64
246+
bob[12] = "2/3"
247+
bob[30] = "1/3"
248+
return [alice, bob]
249+
250+
236251
def create_one_shot_trust_efg() -> gbt.Game:
252+
"""
253+
Returns
254+
-------
255+
Game
256+
One-shot trust game, after Kreps (1990)
257+
"""
237258
g = gbt.Game.new_tree(
238259
players=["Buyer", "Seller"], title="One-shot trust game, after Kreps (1990)"
239260
)

tests/test_nash.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@
1717
TOL = 1e-13 # tolerance for floating point assertions
1818

1919

20-
def kuhn_poker_lcp_mixed_strategy_prof():
21-
alice = [0] * 27
22-
alice[1] = "2/3"
23-
alice[4] = "1/3"
24-
bob = [0] * 64
25-
bob[12] = "2/3"
26-
bob[30] = "1/3"
27-
return [alice, bob]
28-
29-
3020
def test_enumpure_strategy():
3121
"""Test calls of enumeration of pure strategies."""
3222
game = games.read_from_file("poker.efg")
@@ -264,7 +254,7 @@ def test_lcp_strategy_double():
264254
# Zero-sum games
265255
(games.create_1_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None),
266256
(games.create_myerson_2_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None),
267-
(games.create_kuhn_poker_efg(), [kuhn_poker_lcp_mixed_strategy_prof()], 1),
257+
(games.create_kuhn_poker_efg(), [games.kuhn_poker_lcp_first_mixed_strategy_prof()], 1),
268258
# Non-zero-sum games
269259
(games.create_one_shot_trust_efg(), [[[0, 1], ["1/2", "1/2"]]], 1,),
270260
(

0 commit comments

Comments
 (0)