Skip to content

Commit fc18ad3

Browse files
comment out coded games to help track circular import
1 parent d0d5894 commit fc18ad3

2 files changed

Lines changed: 46 additions & 46 deletions

File tree

src/pygambit/catalog/catalog.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def games(
145145
>>> games(is_tree=True, num_players=2) # 2-player extensive-form games
146146
"""
147147
# Import manually coded games to ensure they are registered in the catalog
148-
_load_coded_games()
148+
# _load_coded_games()
149149

150150
# Filter by extensive-form if filtering by tree-specific attributes
151151
if (
@@ -296,25 +296,25 @@ def _generate_contrib_game_classes(catalog: dict[str, dict]) -> None:
296296
setattr(module, class_name, cls)
297297

298298

299-
_coded_games_loaded = False
299+
# _coded_games_loaded = False
300300

301301

302-
def _load_coded_games():
303-
"""Lazy load coded games."""
304-
global _coded_games_loaded
305-
if _coded_games_loaded:
306-
return
302+
# def _load_coded_games():
303+
# """Lazy load coded games."""
304+
# global _coded_games_loaded
305+
# if _coded_games_loaded:
306+
# return
307307

308-
from . import coded_games # noqa: F401
309-
# Import all coded game classes into this module's namespace
310-
# so they are registered as CatalogGame subclasses
311-
for name in dir(coded_games):
312-
if not name.startswith("_"):
313-
obj = getattr(coded_games, name)
314-
if isinstance(obj, type) and issubclass(obj, CatalogGame):
315-
globals()[name] = obj
308+
# from . import coded_games # noqa: F401
309+
# # Import all coded game classes into this module's namespace
310+
# # so they are registered as CatalogGame subclasses
311+
# for name in dir(coded_games):
312+
# if not name.startswith("_"):
313+
# obj = getattr(coded_games, name)
314+
# if isinstance(obj, type) and issubclass(obj, CatalogGame):
315+
# globals()[name] = obj
316316

317-
_coded_games_loaded = True
317+
# _coded_games_loaded = True
318318

319319

320320
# Generate classes at import time
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
from ..gambit import Game
2-
from .catalog import CatalogGame
1+
# from ..gambit import Game
2+
# from .catalog import CatalogGame
33

44

5-
class OneShotTrust(CatalogGame):
6-
"""
7-
The unique_NE_variant makes Trust a dominant strategy, replacing the
8-
non-singleton equilibrium component from the standard version of the game
9-
where the Buyer plays "Not Trust" and the seller can play any mixture with
10-
< 0.5 probability on Honor with a unique NE where the Buyer plays Trust and
11-
the Seller plays Abuse.
12-
"""
13-
test_suite = True
14-
"""This game is included in the pygambit test suite."""
5+
# class OneShotTrust(CatalogGame):
6+
# """
7+
# The unique_NE_variant makes Trust a dominant strategy, replacing the
8+
# non-singleton equilibrium component from the standard version of the game
9+
# where the Buyer plays "Not Trust" and the seller can play any mixture with
10+
# < 0.5 probability on Honor with a unique NE where the Buyer plays Trust and
11+
# the Seller plays Abuse.
12+
# """
13+
# test_suite = True
14+
# """This game is included in the pygambit test suite."""
1515

16-
@staticmethod
17-
def _game(unique_NE_variant: bool = False):
18-
g = Game.new_tree(
19-
players=["Buyer", "Seller"], title="One-shot trust game, after Kreps (1990)"
20-
)
21-
g.append_move(g.root, "Buyer", ["Trust", "Not trust"])
22-
g.append_move(g.root.children[0], "Seller", ["Honor", "Abuse"])
23-
g.set_outcome(g.root.children[0].children[0], g.add_outcome([1, 1], label="Trustworthy"))
24-
if unique_NE_variant:
25-
g.set_outcome(
26-
g.root.children[0].children[1], g.add_outcome(["1/2", 2], label="Untrustworthy")
27-
)
28-
else:
29-
g.set_outcome(
30-
g.root.children[0].children[1], g.add_outcome([-1, 2], label="Untrustworthy")
31-
)
32-
g.set_outcome(g.root.children[1], g.add_outcome([0, 0], label="Opt-out"))
33-
return g
16+
# @staticmethod
17+
# def _game(unique_NE_variant: bool = False):
18+
# g = Game.new_tree(
19+
# players=["Buyer", "Seller"], title="One-shot trust game, after Kreps (1990)"
20+
# )
21+
# g.append_move(g.root, "Buyer", ["Trust", "Not trust"])
22+
# g.append_move(g.root.children[0], "Seller", ["Honor", "Abuse"])
23+
# g.set_outcome(g.root.children[0].children[0], g.add_outcome([1, 1], label="Trustworthy"))
24+
# if unique_NE_variant:
25+
# g.set_outcome(
26+
# g.root.children[0].children[1], g.add_outcome(["1/2", 2], label="Untrustworthy")
27+
# )
28+
# else:
29+
# g.set_outcome(
30+
# g.root.children[0].children[1], g.add_outcome([-1, 2], label="Untrustworthy")
31+
# )
32+
# g.set_outcome(g.root.children[1], g.add_outcome([0, 0], label="Opt-out"))
33+
# return g

0 commit comments

Comments
 (0)