From 317635317ec16e6345e618054fbe9e722fce0a68 Mon Sep 17 00:00:00 2001 From: wangyzh Date: Sun, 5 Jul 2026 13:01:58 +0800 Subject: [PATCH 1/8] Fix bug in update.py --- build_support/catalog/test_update.py | 51 ++++++++++++++++++++++++++++ build_support/catalog/update.py | 30 +++++++++++++--- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/build_support/catalog/test_update.py b/build_support/catalog/test_update.py index 645dc25f9..047c600c6 100644 --- a/build_support/catalog/test_update.py +++ b/build_support/catalog/test_update.py @@ -147,6 +147,57 @@ def _make_image_files(catalog_dir, slug, fmt="efg"): (img_dir / f"{slug}.ef").touch() +# --------------------------------------------------------------------------- +# Tests for catalog resource selection +# --------------------------------------------------------------------------- + + +@pytest.mark.catalog_update +class TestCatalogResourceSelection: + def test_catalog_games_uses_requested_catalog_dir_and_restores_resource( + self, tmp_path, monkeypatch + ): + stale_dir = tmp_path / "installed_catalog_data" + checkout_dir = tmp_path / "checkout_catalog" + stale_dir.mkdir() + checkout_dir.mkdir() + calls = [] + + def fake_games(**kwargs): + calls.append((update.gbt.catalog._CATALOG_RESOURCE, kwargs)) + return _make_df(_efg_row("checkout/game1")) + + monkeypatch.setattr(update.gbt.catalog, "_CATALOG_RESOURCE", stale_dir) + monkeypatch.setattr(update.gbt.catalog, "games", fake_games) + + df = update._catalog_games(checkout_dir) + + assert calls == [(checkout_dir, {"include_descriptions": True})] + assert update.gbt.catalog._CATALOG_RESOURCE == stale_dir + assert list(df["Game"]) == ["checkout/game1"] + + def test_generate_rst_table_uses_requested_catalog_dir_while_rendering( + self, tmp_path, monkeypatch + ): + stale_dir = tmp_path / "installed_catalog_data" + checkout_dir = tmp_path / "checkout_catalog" + stale_dir.mkdir() + checkout_dir.mkdir() + observed = [] + + def fake_write_tree_level(*args, **kwargs): + observed.append(update.gbt.catalog._CATALOG_RESOURCE) + + monkeypatch.setattr(update.gbt.catalog, "_CATALOG_RESOURCE", stale_dir) + monkeypatch.setattr(update, "load_hierarchy_labels", lambda: {}) + monkeypatch.setattr(update, "_write_tree_level", fake_write_tree_level) + + update.generate_rst_table(_make_df(), tmp_path / "out.rst", catalog_dir=checkout_dir) + + assert observed == [checkout_dir] + assert update.gbt.catalog._CATALOG_RESOURCE == stale_dir + + # --------------------------------------------------------------------------- # Tests for catalog_gtdraw_settings # --------------------------------------------------------------------------- diff --git a/build_support/catalog/update.py b/build_support/catalog/update.py index 0cf51385e..284b12846 100644 --- a/build_support/catalog/update.py +++ b/build_support/catalog/update.py @@ -1,6 +1,7 @@ import argparse import shutil import sys +from contextlib import contextmanager from pathlib import Path import pandas as pd @@ -17,6 +18,24 @@ SUPPORTED_GAME_FORMATS = {"efg", "nfg"} +@contextmanager +def _using_catalog_dir(catalog_dir: Path): + """Temporarily make pygambit.catalog read data from the checked-out catalog.""" + old_resource = gbt.catalog._CATALOG_RESOURCE + gbt.catalog._CATALOG_RESOURCE = catalog_dir + try: + yield + finally: + gbt.catalog._CATALOG_RESOURCE = old_resource + + +def _catalog_games(catalog_dir: Path | None = None) -> pd.DataFrame: + """Return catalog games using files from *catalog_dir*, not installed package data.""" + catalog_dir = catalog_dir or CATALOG_DIR + with _using_catalog_dir(catalog_dir): + return gbt.catalog.games(include_descriptions=True) + + def catalog_gtdraw_settings(slug: str) -> dict: """Return the gtdraw settings for a given catalog slug.""" with open(GTDRAW_SETTINGS_CONFIG, encoding="utf-8") as f: @@ -325,10 +344,11 @@ def generate_rst_table( catalog_dir = catalog_dir or CATALOG_DIR labels = load_hierarchy_labels() tree = _build_slug_tree(df) - with open(rst_path, "w", encoding="utf-8") as f: - _write_tree_level( - f, tree, "", labels, catalog_dir, indent="", regenerate_images=regenerate_images - ) + with _using_catalog_dir(catalog_dir): + with open(rst_path, "w", encoding="utf-8") as f: + _write_tree_level( + f, tree, "", labels, catalog_dir, indent="", regenerate_images=regenerate_images + ) def update_makefile( @@ -409,7 +429,7 @@ def update_makefile( args = parser.parse_args() # Create RST list-table used by doc/catalog.rst - df = gbt.catalog.games(include_descriptions=True) + df = _catalog_games() _warn_missing_descriptions(df) generate_rst_table(df, CATALOG_RST_TABLE, regenerate_images=args.regenerate_images) print(f"Generated {CATALOG_RST_TABLE} for use in local docs build. DO NOT COMMIT.") From bd34dec8ced84975af5552dfe5574772961e59ba Mon Sep 17 00:00:00 2001 From: wangyzh Date: Sun, 5 Jul 2026 13:03:55 +0800 Subject: [PATCH 2/8] Add MAS and original layouts --- build_support/catalog/catalog_hierarchy.yaml | 1 + catalog/books/shohambrown2008/fig5_1.efg | 21 +++++++ catalog/books/shohambrown2008/fig5_10.efg | 16 ++++++ .../fig5_10__original_layout.ef | 12 ++++ catalog/books/shohambrown2008/fig5_11.efg | 14 +++++ .../fig5_11__original_layout.ef | 10 ++++ catalog/books/shohambrown2008/fig5_12.efg | 16 ++++++ .../fig5_12__original_layout.ef | 15 +++++ catalog/books/shohambrown2008/fig5_15.efg | 17 ++++++ .../fig5_15__original_layout.ef | 11 ++++ .../fig5_1__original_layout.ef | 12 ++++ catalog/books/shohambrown2008/fig5_2.efg | 16 ++++++ .../fig5_2__original_layout.ef | 11 ++++ catalog/books/shohambrown2008/fig5_9.efg | 22 +++++++ .../fig5_9__original_layout.ef | 13 +++++ catalog/books/shohambrown2008/fig6_2.efg | 38 +++++++++++++ .../fig6_2__original_layout.ef | 38 +++++++++++++ catalog/books/shohambrown2008/fig6_8.efg | 36 ++++++++++++ .../fig6_8__original_layout.ef | 54 ++++++++++++++++++ .../fig1__Original_Layout.ef | 57 +++++++++++++++++++ 20 files changed, 430 insertions(+) create mode 100644 catalog/books/shohambrown2008/fig5_1.efg create mode 100644 catalog/books/shohambrown2008/fig5_10.efg create mode 100644 catalog/books/shohambrown2008/fig5_10__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig5_11.efg create mode 100644 catalog/books/shohambrown2008/fig5_11__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig5_12.efg create mode 100644 catalog/books/shohambrown2008/fig5_12__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig5_15.efg create mode 100644 catalog/books/shohambrown2008/fig5_15__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig5_1__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig5_2.efg create mode 100644 catalog/books/shohambrown2008/fig5_2__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig5_9.efg create mode 100644 catalog/books/shohambrown2008/fig5_9__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig6_2.efg create mode 100644 catalog/books/shohambrown2008/fig6_2__original_layout.ef create mode 100644 catalog/books/shohambrown2008/fig6_8.efg create mode 100644 catalog/books/shohambrown2008/fig6_8__original_layout.ef create mode 100644 catalog/journals/mor/vonstengelforges2008/fig1__Original_Layout.ef diff --git a/build_support/catalog/catalog_hierarchy.yaml b/build_support/catalog/catalog_hierarchy.yaml index 9280493a6..2feffdd7b 100644 --- a/build_support/catalog/catalog_hierarchy.yaml +++ b/build_support/catalog/catalog_hierarchy.yaml @@ -14,6 +14,7 @@ labels: books/myerson1991: "Myerson (1991) — Game Theory: Analysis of Conflict" books/vonstengel2022: "von Stengel (2022) — Game Theory Basics" books/watson2013: "Watson (2013) — Strategy: An Introduction to Game Theory" + books/shohambrown2008: "Shoham and Leyton-Brown (2008) — Multiagent Systems, Algorithmic, Game-Theoretic, and Logical Foundations" journals/geb/gilboa1997: "Gilboa (1997)" journals/geb/wichardt2008: "Wichardt (2008)" journals/ijgt/nau2004: "Nau et al. (2004)" diff --git a/catalog/books/shohambrown2008/fig5_1.efg b/catalog/books/shohambrown2008/fig5_1.efg new file mode 100644 index 000000000..b83e826c9 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_1.efg @@ -0,0 +1,21 @@ +EFG 2 R "Fig 5.1 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.1 from :cite:p:`ShoLeyB08`. +This is a sharing game. Imagine a brother and sister sharing two indivisible and identical presents +from their parents. First the brother suggests a split, which can be one of three-he +keeps both, she keeps both, or they each keep one. Then the sister chooses whether +to accept or reject the split. If she accepts they each get their allocated present(s), +and otherwise neither gets any gift. +" + +p "" 1 1 "" { "2-0" "1-1" "0-2" } 0 +p "" 2 2 "" { "no" "yes" } 0 +t "" 1 "" { 0 0 } +t "" 2 "" { 2 0 } +p "" 2 3 "" { "no" "yes" } 0 +t "" 3 "" { 0 0 } +t "" 4 "" { 1 1 } +p "" 2 4 "" { "no" "yes" } 0 +t "" 5 "" { 0 0 } +t "" 6 "" { 0 2 } diff --git a/catalog/books/shohambrown2008/fig5_10.efg b/catalog/books/shohambrown2008/fig5_10.efg new file mode 100644 index 000000000..94cd759ff --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_10.efg @@ -0,0 +1,16 @@ +EFG 2 R "Fig 5.10 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.10 from :cite:p:`ShoLeyB08`. +This is an example of an imperfect-information game. +" + +p "" 1 2 "" { "L" "R" } 0 +p "" 2 3 "" { "A" "B" } 0 +p "" 1 1 "" { "l" "r" } 0 +t "" 1 "" { 0 0 } +t "" 2 "" { 2 4 } +p "" 1 1 0 +t "" 3 "" { 4 2 } +t "" 4 "" { 0 0 } +t "" 5 "" { 0 0 } diff --git a/catalog/books/shohambrown2008/fig5_10__original_layout.ef b/catalog/books/shohambrown2008/fig5_10__original_layout.ef new file mode 100644 index 000000000..bc10d8212 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_10__original_layout.ef @@ -0,0 +1,12 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 player 2 xshift -3.58 from 0,1 move L +level 2 node 2 xshift 3.58 from 0,1 move R payoffs 0 0 +level 4 node 1 xshift -2.86 from 2,1 move A +level 4 node 2 xshift 2.86 from 2,1 move B +level 6 node 1 xshift -1.43 from 4,1 move l payoffs 0 0 +level 6 node 2 xshift 1.43 from 4,1 move r payoffs 2 4 +level 6 node 3 xshift -1.43 from 4,2 move l payoffs 4 2 +level 6 node 4 xshift 1.43 from 4,2 move r payoffs 0 0 +iset 4,1 4,2 player 1 diff --git a/catalog/books/shohambrown2008/fig5_11.efg b/catalog/books/shohambrown2008/fig5_11.efg new file mode 100644 index 000000000..a972fb90b --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_11.efg @@ -0,0 +1,14 @@ +EFG 2 R "Fig 5.11 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.11 from :cite:p:`ShoLeyB08`. +The Prisoner's Dilemma game in extensive form. +" + +p "" 1 2 "" { "C" "D" } 0 +p "" 2 1 "" { "c" "d" } 0 +t "" 1 "" { -1 -1 } +t "" 2 "" { -4 0 } +p "" 2 1 0 +t "" 3 "" { 0 -4 } +t "" 4 "" { -3 -3 } diff --git a/catalog/books/shohambrown2008/fig5_11__original_layout.ef b/catalog/books/shohambrown2008/fig5_11__original_layout.ef new file mode 100644 index 000000000..13246edad --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_11__original_layout.ef @@ -0,0 +1,10 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 xshift -3.58 from 0,1 move C +level 2 node 2 xshift 3.58 from 0,1 move D +level 4 node 1 xshift -1.79 from 2,1 move c payoffs -1 -1 +level 4 node 2 xshift 1.79 from 2,1 move d payoffs -4 0 +level 4 node 3 xshift -1.79 from 2,2 move c payoffs 0 -4 +level 4 node 4 xshift 1.79 from 2,2 move d payoffs -3 -3 +iset 2,1 2,2 player 2 diff --git a/catalog/books/shohambrown2008/fig5_12.efg b/catalog/books/shohambrown2008/fig5_12.efg new file mode 100644 index 000000000..2e08ce364 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_12.efg @@ -0,0 +1,16 @@ +EFG 2 R "Fig 5.12 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.12 from :cite:p:`ShoLeyB08`. +A game with imperfect recall. +Please read carefully about the definition of perfect recall, which infers three types of imperfect recall. +" + + +p "" 1 1 "" { "L" "R" } 0 +p "" 1 1 0 +t "" 1 "" { 1 0 } +t "" 2 "" { 100 100 } +p "" 2 2 "" { "U" "D" } 0 +t "" 3 "" { 5 1 } +t "" 4 "" { 2 2 } diff --git a/catalog/books/shohambrown2008/fig5_12__original_layout.ef b/catalog/books/shohambrown2008/fig5_12__original_layout.ef new file mode 100644 index 000000000..98b720cdc --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_12__original_layout.ef @@ -0,0 +1,15 @@ +% Extensive-form game transcribed from the uploaded image +player 1 name 1 +player 2 name 2 + +% Player 1's two decision nodes are in the same information set. +level 0 node 1 +level 2 node 1 xshift -3 from 0,1 move L +level 2 node 2 xshift 3 from 0,1 move R player 2 + +level 4 node 1 xshift -1 from 2,1 move L payoffs 1 0 +level 4 node 2 xshift 1 from 2,1 move R payoffs 100 100 +level 4 node 3 xshift -1 from 2,2 move U payoffs 5 1 +level 4 node 4 xshift 1 from 2,2 move D payoffs 2 2 + +iset 0,1 2,1 player 1 diff --git a/catalog/books/shohambrown2008/fig5_15.efg b/catalog/books/shohambrown2008/fig5_15.efg new file mode 100644 index 000000000..8f5a9414f --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_15.efg @@ -0,0 +1,17 @@ +EFG 2 R "Fig 5.15 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.15 from :cite:p:`ShoLeyB08`. +A game with imperfect information. +This example shows how a requirement that a substrategy be a best response in +all subgames is too simplistic for defining SPE in games with imperfect information. +" + +p "" 1 2 "" { "L" "C" "R" } 0 +t "" 1 "" { 1 1 } +p "" 2 1 "" { "U" "D" } 0 +t "" 2 "" { 0 1000 } +t "" 3 "" { 0 0 } +p "" 2 1 0 +t "" 4 "" { 1 0 } +t "" 5 "" { 3 1 } diff --git a/catalog/books/shohambrown2008/fig5_15__original_layout.ef b/catalog/books/shohambrown2008/fig5_15__original_layout.ef new file mode 100644 index 000000000..adb455c49 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_15__original_layout.ef @@ -0,0 +1,11 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 xshift -5.01 from 0,1 move L payoffs 1 1 +level 2 node 2 xshift -0.72 from 0,1 move C +level 2 node 3 xshift 5.01 from 0,1 move R +level 4 node 1 xshift -1.43 from 2,2 move U payoffs 0 1000 +level 4 node 2 xshift 1.43 from 2,2 move D payoffs 0 0 +level 4 node 3 xshift -1.43 from 2,3 move U payoffs 1 0 +level 4 node 4 xshift 1.43 from 2,3 move D payoffs 3 1 +iset 2,2 2,3 player 2 diff --git a/catalog/books/shohambrown2008/fig5_1__original_layout.ef b/catalog/books/shohambrown2008/fig5_1__original_layout.ef new file mode 100644 index 000000000..4eb06de72 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_1__original_layout.ef @@ -0,0 +1,12 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 player 2 xshift -4.77 from 0,1 move 2-0 +level 2 node 2 player 2 xshift 0 from 0,1 move 1-1 +level 4 node 1 xshift -1.19 from 2,1 move no payoffs 0 0 +level 4 node 2 xshift 1.19 from 2,1 move yes payoffs 2 0 +level 2 node 3 player 2 xshift 4.77 from 0,1 move 0-2 +level 4 node 3 xshift -1.19 from 2,2 move no payoffs 0 0 +level 4 node 4 xshift 1.19 from 2,2 move yes payoffs 1 1 +level 4 node 5 xshift -1.19 from 2,3 move no payoffs 0 0 +level 4 node 6 xshift 1.19 from 2,3 move yes payoffs 0 2 diff --git a/catalog/books/shohambrown2008/fig5_2.efg b/catalog/books/shohambrown2008/fig5_2.efg new file mode 100644 index 000000000..5ed1bd189 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_2.efg @@ -0,0 +1,16 @@ +EFG 2 R "Fig 5.2 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.2 from :cite:p:`ShoLeyB08`. +This is an example of a perfect-information game in extensive form. +" + +p "" 1 1 "" { "A" "B" } 0 +p "" 2 2 "" { "C" "D" } 0 +t "" 1 "" { 3 8 } +t "" 2 "" { 8 3 } +p "" 2 3 "" { "E" "F" } 0 +t "" 3 "" { 5 5 } +p "" 1 4 "" { "G" "H" } 0 +t "" 4 "" { 2 10 } +t "" 5 "" { 1 0 } diff --git a/catalog/books/shohambrown2008/fig5_2__original_layout.ef b/catalog/books/shohambrown2008/fig5_2__original_layout.ef new file mode 100644 index 000000000..630246f0b --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_2__original_layout.ef @@ -0,0 +1,11 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 player 2 xshift -3.22 from 0,1 move A +level 2 node 2 player 2 xshift 3.22 from 0,1 move B +level 4 node 1 xshift -1.43 from 2,1 move C payoffs 3 8 +level 4 node 2 xshift 1.43 from 2,1 move D payoffs 8 3 +level 4 node 3 xshift -2.15 from 2,2 move E payoffs 5 5 +level 4 node 4 player 1 xshift 2.15 from 2,2 move F +level 6 node 1 xshift -1.43 from 4,4 move G payoffs 2 10 +level 6 node 2 xshift 1.43 from 4,4 move H payoffs 1 0 diff --git a/catalog/books/shohambrown2008/fig5_9.efg b/catalog/books/shohambrown2008/fig5_9.efg new file mode 100644 index 000000000..68e2181ea --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_9.efg @@ -0,0 +1,22 @@ +EFG 2 R "Fig 5.9 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 5.9 from :cite:p:`ShoLeyB08`. +This is the centipede game. In this game two players alternate in making decisions, at each +turn choosing between going down and ending the game or going across and +continuing it. +This example is usd to explain the criticisms of backward induction for finding subgame-perfect equilibrium. +Note that centipede is also a parametrized game, with the parameter being the number of rounds. +" + +p "" 1 1 "" { "A" "D" } 0 +t "" 1 "" { 1 0 } +p "" 2 2 "" { "A" "D" } 0 +t "" 2 "" { 0 2 } +p "" 1 3 "" { "A" "D" } 0 +t "" 3 "" { 3 1 } +p "" 2 4 "" { "A" "D" } 0 +t "" 4 "" { 2 4 } +p "" 1 5 "" { "A" "D" } 0 +t "" 5 "" { 4 3 } +t "" 6 "" { 3 5 } diff --git a/catalog/books/shohambrown2008/fig5_9__original_layout.ef b/catalog/books/shohambrown2008/fig5_9__original_layout.ef new file mode 100644 index 000000000..168078648 --- /dev/null +++ b/catalog/books/shohambrown2008/fig5_9__original_layout.ef @@ -0,0 +1,13 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 xshift -2.31 from 0,1 move A payoffs 1 0 +level 2 node 2 player 2 xshift 2.31 from 0,1 move D +level 4 node 1 xshift -2.24 from 2,2 move A payoffs 0 2 +level 4 node 2 player 1 xshift 2.24 from 2,2 move D +level 6 node 1 xshift -2.09 from 4,2 move A payoffs 3 1 +level 6 node 2 player 2 xshift 2.09 from 4,2 move D +level 8 node 1 xshift -1.79 from 6,2 move A payoffs 2 4 +level 8 node 2 player 1 xshift 1.79 from 6,2 move D +level 10 node 1 xshift -1.19 from 8,2 move A payoffs 4 3 +level 10 node 2 xshift 1.19 from 8,2 move D payoffs 3 5 diff --git a/catalog/books/shohambrown2008/fig6_2.efg b/catalog/books/shohambrown2008/fig6_2.efg new file mode 100644 index 000000000..6a543e361 --- /dev/null +++ b/catalog/books/shohambrown2008/fig6_2.efg @@ -0,0 +1,38 @@ +EFG 2 R "Fig 6.2 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 6.2 from :cite:p:`ShoLeyB08`. +This is a repeated game, where Prisoner's Dilemma is played twice. +" + +p "" 1 6 "" { "C" "D" } 0 +p "" 2 1 "" { "c" "d" } 0 +p "" 1 7 "" { "C" "D" } 0 +p "" 2 4 "" { "c" "d" } 0 +t "" 1 "" { -2 -2 } +t "" 2 "" { -5 -1 } +p "" 2 4 0 +t "" 3 "" { -1 -5 } +t "" 4 "" { -4 -4 } +p "" 1 8 "" { "C" "D" } 0 +p "" 2 5 "" { "c" "d" } 0 +t "" 5 "" { -5 -1 } +t "" 6 "" { -8 0 } +p "" 2 5 0 +t "" 7 "" { -4 -4 } +t "" 8 "" { -7 -3 } +p "" 2 1 0 +p "" 1 9 "" { "C" "D" } 0 +p "" 2 2 "" { "c" "d" } 0 +t "" 9 "" { -1 -5 } +t "" 10 "" { -4 -4 } +p "" 2 2 0 +t "" 11 "" { 0 -8 } +t "" 12 "" { -3 -7 } +p "" 1 10 "" { "C" "D" } 0 +p "" 2 3 "" { "c" "d" } 0 +t "" 13 "" { -4 -4 } +t "" 14 "" { -7 -3 } +p "" 2 3 0 +t "" 15 "" { -3 -7 } +t "" 16 "" { -6 -6 } diff --git a/catalog/books/shohambrown2008/fig6_2__original_layout.ef b/catalog/books/shohambrown2008/fig6_2__original_layout.ef new file mode 100644 index 000000000..4571fb548 --- /dev/null +++ b/catalog/books/shohambrown2008/fig6_2__original_layout.ef @@ -0,0 +1,38 @@ +player 1 name 1 +player 2 name 2 +level 0 node 1 player 1 +level 2 node 1 xshift -6.37 from 0,1 move C +level 2 node 2 xshift 6.37 from 0,1 move D +level 4 node 1 player 1 xshift -3.19 from 2,1 move c +level 4 node 2 player 1 xshift 3.19 from 2,1 move d +level 4 node 3 player 1 xshift -3.19 from 2,2 move c +level 4 node 4 player 1 xshift 3.19 from 2,2 move d +level 6 node 1 xshift -1.59 from 4,1 move C +level 6 node 2 xshift 1.59 from 4,1 move D +level 6 node 3 xshift -1.59 from 4,2 move C +level 6 node 4 xshift 1.59 from 4,2 move D +level 6 node 5 xshift -1.59 from 4,3 move C +level 6 node 6 xshift 1.59 from 4,3 move D +level 6 node 7 xshift -1.59 from 4,4 move C +level 6 node 8 xshift 1.59 from 4,4 move D +level 8 node 1 xshift -0.8 from 6,1 move c payoffs -2 -2 +level 8 node 2 xshift 0.8 from 6,1 move d payoffs -5 -1 +level 8 node 3 xshift -0.8 from 6,2 move c payoffs -1 -5 +level 8 node 4 xshift 0.8 from 6,2 move d payoffs -4 -4 +level 8 node 5 xshift -0.8 from 6,3 move c payoffs -5 -1 +level 8 node 6 xshift 0.8 from 6,3 move d payoffs -8 0 +level 8 node 7 xshift -0.8 from 6,4 move c payoffs -4 -4 +level 8 node 8 xshift 0.8 from 6,4 move d payoffs -7 -3 +level 8 node 9 xshift -0.8 from 6,5 move c payoffs -1 -5 +level 8 node 10 xshift 0.8 from 6,5 move d payoffs -4 -4 +level 8 node 11 xshift -0.8 from 6,6 move c payoffs 0 -8 +level 8 node 12 xshift 0.8 from 6,6 move d payoffs -3 -7 +level 8 node 13 xshift -0.8 from 6,7 move c payoffs -4 -4 +level 8 node 14 xshift 0.8 from 6,7 move d payoffs -7 -3 +level 8 node 15 xshift -0.8 from 6,8 move c payoffs -3 -7 +level 8 node 16 xshift 0.8 from 6,8 move d payoffs -6 -6 +iset 2,1 2,2 player 2 +iset 6,5 6,6 player 2 +iset 6,7 6,8 player 2 +iset 6,1 6,2 player 2 +iset 6,3 6,4 player 2 diff --git a/catalog/books/shohambrown2008/fig6_8.efg b/catalog/books/shohambrown2008/fig6_8.efg new file mode 100644 index 000000000..08e0e3cba --- /dev/null +++ b/catalog/books/shohambrown2008/fig6_8.efg @@ -0,0 +1,36 @@ +EFG 2 R "Fig 6.8 from Shoham and Leyton-Brown (2008)" { "1" "2" } + +" +Figure 6.8 from :cite:p:`ShoLeyB08`. +This is a Bayesian game, represented in EFG with Nature deciding the types. +" + +c "" 5 "" { "MP" 1/4 "PD" 1/4 "Coord" 1/4 "BoS" 1/4 } 0 +p "" 1 1 "" { "U" "D" } 0 +p "" 2 3 "" { "L" "R" } 0 +t "" 1 "" { 2 0 } +t "" 2 "" { 0 2 } +p "" 2 3 0 +t "" 3 "" { 0 2 } +t "" 4 "" { 2 0 } +p "" 1 1 0 +p "" 2 4 "" { "L" "R" } 0 +t "" 5 "" { 2 2 } +t "" 6 "" { 0 3 } +p "" 2 4 0 +t "" 7 "" { 3 0 } +t "" 8 "" { 1 1 } +p "" 1 2 "" { "U" "D" } 0 +p "" 2 3 0 +t "" 9 "" { 2 2 } +t "" 10 "" { 0 0 } +p "" 2 3 0 +t "" 11 "" { 0 0 } +t "" 12 "" { 1 1 } +p "" 1 2 0 +p "" 2 4 0 +t "" 13 "" { 2 1 } +t "" 14 "" { 0 0 } +p "" 2 4 0 +t "" 15 "" { 0 0 } +t "" 16 "" { 1 2 } diff --git a/catalog/books/shohambrown2008/fig6_8__original_layout.ef b/catalog/books/shohambrown2008/fig6_8__original_layout.ef new file mode 100644 index 000000000..c115b8e3d --- /dev/null +++ b/catalog/books/shohambrown2008/fig6_8__original_layout.ef @@ -0,0 +1,54 @@ +% Four games with uniform chance and corrected player 2 information sets +% Nature chooses among MP, PD, Coord, BoS with probability 1/4 each. +player 0 name Nature +player 1 name 1 +player 2 name 2 + +% Nature root +level 0 node 1 player 0 + +% Nature moves: uniform distribution shown on each branch +level 2 node 1 xshift -7.5 from 0,1 move MP~(1/4) +level 2 node 2 xshift -2.5 from 0,1 move PD~(1/4) +level 2 node 3 xshift 2.5 from 0,1 move Coord~(1/4) +level 2 node 4 xshift 7.5 from 0,1 move BoS~(1/4) + +% Player 1 moves U/D +level 4 node 1 xshift -1 from 2,1 move U +level 4 node 2 xshift 1 from 2,1 move D +level 4 node 3 xshift -1 from 2,2 move U +level 4 node 4 xshift 1 from 2,2 move D +level 4 node 5 xshift -1 from 2,3 move U +level 4 node 6 xshift 1 from 2,3 move D +level 4 node 7 xshift -1 from 2,4 move U +level 4 node 8 xshift 1 from 2,4 move D + +% Player 2 moves L/R and payoffs, left-to-right as in the figure +level 6 node 1 xshift -0.55 from 4,1 move L payoffs 2 0 +level 6 node 2 xshift 0.55 from 4,1 move R payoffs 0 2 +level 6 node 3 xshift -0.55 from 4,2 move L payoffs 0 2 +level 6 node 4 xshift 0.55 from 4,2 move R payoffs 2 0 + +level 6 node 5 xshift -0.55 from 4,3 move L payoffs 2 2 +level 6 node 6 xshift 0.55 from 4,3 move R payoffs 0 3 +level 6 node 7 xshift -0.55 from 4,4 move L payoffs 3 0 +level 6 node 8 xshift 0.55 from 4,4 move R payoffs 1 1 + +level 6 node 9 xshift -0.55 from 4,5 move L payoffs 2 2 +level 6 node 10 xshift 0.55 from 4,5 move R payoffs 0 0 +level 6 node 11 xshift -0.55 from 4,6 move L payoffs 0 0 +level 6 node 12 xshift 0.55 from 4,6 move R payoffs 1 1 + +level 6 node 13 xshift -0.55 from 4,7 move L payoffs 2 1 +level 6 node 14 xshift 0.55 from 4,7 move R payoffs 0 0 +level 6 node 15 xshift -0.55 from 4,8 move L payoffs 0 0 +level 6 node 16 xshift 0.55 from 4,8 move R payoffs 1 2 + +% Player 1 information sets +iset 2,1 2,2 player 1 +iset 2,3 2,4 player 1 + +% Player 2 information sets: +% first and third are the same; second and fourth are the same. +iset 4,1 4,2 4,5 4,6 player 2 +iset 4,3 4,4 4,7 4,8 player 2 diff --git a/catalog/journals/mor/vonstengelforges2008/fig1__Original_Layout.ef b/catalog/journals/mor/vonstengelforges2008/fig1__Original_Layout.ef new file mode 100644 index 000000000..1c0dab62e --- /dev/null +++ b/catalog/journals/mor/vonstengelforges2008/fig1__Original_Layout.ef @@ -0,0 +1,57 @@ +% Extensive-form game transcribed from the provided figure. +% DrawTree .ef format. +% Layout is chosen to preserve the original geometry of the image: +% chance at the top, two Player 1 singleton information sets, +% crossed middle branches, and two horizontal Player 2 information sets. +% +% Player 0: Chance +% Player 1: 1 +% Player 2: 2 +% +% Chance chooses G or B with probability 1/2 each. +% Player 1 observes the chance outcome and chooses X or Y, with labels +% indexed by the realized chance outcome: X_G, Y_G, X_B, Y_B. +% Player 2 observes only whether the signal is X or Y, not the chance outcome. + +player 0 name Chance +player 1 name 1 +player 2 name 2 + +% Root chance node. +level 0 node n1 player 0 + +% Chance branches, arranged as in the figure. +level 2 node n2 xshift -2.8 from n1 move \frac{1}{2} player 1 +level 2 node n3 xshift 2.8 from n1 move \frac{1}{2} player 1 + +% Player 1 branches. +% Left Player 1 node: chance outcome G. +level 4 node n4 xshift -2.7 from n2 move X_G +level 4 node n5 xshift 4.1 from n2 move Y_G + +% Right Player 1 node: chance outcome B. +% The X_B and Y_G branches cross, matching the original layout. +level 4 node n6 xshift -4.1 from n3 move X_B +level 4 node n7 xshift 2.7 from n3 move Y_B + +% Player 2 information sets. +% X-signal information set: histories (G,X_G) and (B,X_B). +iset n4 n6 player 2 + +% Y-signal information set: histories (G,Y_G) and (B,Y_B). +iset n5 n7 player 2 + +% Player 2 actions and terminal payoffs, listed left-to-right as in the image. +% At the X-signal information set. +level 6 node n8 xshift -0.45 from n4 move l_X payoffs 4 10 +level 6 node n9 xshift 0.45 from n4 move r_X payoffs 0 6 + +level 6 node n10 xshift -0.45 from n6 move l_X payoffs 6 0 +level 6 node n11 xshift 0.45 from n6 move r_X payoffs 0 6 + +% At the Y-signal information set. +level 6 node n12 xshift -0.45 from n5 move l_Y payoffs 4 10 +level 6 node n13 xshift 0.45 from n5 move r_Y payoffs 0 6 + +level 6 node n14 xshift -0.45 from n7 move l_Y payoffs 6 0 +level 6 node n15 xshift 0.45 from n7 move r_Y payoffs 0 6 From 6443a1c90575c1eb748f0cd0330cc39272dd5671 Mon Sep 17 00:00:00 2001 From: wangyzh Date: Sun, 5 Jul 2026 13:17:04 +0800 Subject: [PATCH 3/8] Add MAS and original layouts --- build_support/catalog/catalog.am | 19 +++++++++++++++++++ doc/references.bib | 9 +++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/build_support/catalog/catalog.am b/build_support/catalog/catalog.am index 58c225f42..1c236d1dd 100644 --- a/build_support/catalog/catalog.am +++ b/build_support/catalog/catalog.am @@ -1,6 +1,24 @@ CATALOG_FILES = \ catalog/books/myerson1991/fig2_1.efg \ catalog/books/myerson1991/fig4_2.efg \ + catalog/books/shohambrown2008/fig5_1.efg \ + catalog/books/shohambrown2008/fig5_10.efg \ + catalog/books/shohambrown2008/fig5_10__original_layout.ef \ + catalog/books/shohambrown2008/fig5_11.efg \ + catalog/books/shohambrown2008/fig5_11__original_layout.ef \ + catalog/books/shohambrown2008/fig5_12.efg \ + catalog/books/shohambrown2008/fig5_12__original_layout.ef \ + catalog/books/shohambrown2008/fig5_15.efg \ + catalog/books/shohambrown2008/fig5_15__original_layout.ef \ + catalog/books/shohambrown2008/fig5_1__original_layout.ef \ + catalog/books/shohambrown2008/fig5_2.efg \ + catalog/books/shohambrown2008/fig5_2__original_layout.ef \ + catalog/books/shohambrown2008/fig5_9.efg \ + catalog/books/shohambrown2008/fig5_9__original_layout.ef \ + catalog/books/shohambrown2008/fig6_2.efg \ + catalog/books/shohambrown2008/fig6_2__original_layout.ef \ + catalog/books/shohambrown2008/fig6_8.efg \ + catalog/books/shohambrown2008/fig6_8__original_layout.ef \ catalog/books/vonstengel2022/fig10.1.efg \ catalog/books/vonstengel2022/fig10.12.efg \ catalog/books/vonstengel2022/fig10.5.efg \ @@ -23,6 +41,7 @@ CATALOG_FILES = \ catalog/journals/ijgt/selten1975/fig2.efg \ catalog/journals/ijgt/selten1975/fig3.efg \ catalog/journals/mor/vonstengelforges2008/fig1.efg \ + catalog/journals/mor/vonstengelforges2008/fig1__Original_Layout.ef \ catalog/journals/mor/vonstengelforges2008/fig6.efg \ catalog/journals/mor/vonstengelforges2008/fig6__Original_Layout.ef \ catalog/journals/mor/vonstengelforges2008/fig9.efg \ diff --git a/doc/references.bib b/doc/references.bib index f39c14834..8809502a3 100644 --- a/doc/references.bib +++ b/doc/references.bib @@ -417,8 +417,9 @@ @article{Wichardt2008 } @book{ShoLeyB08, - title={Multiagent systems: Algorithmic, game-theoretic, and logical foundations}, - author={Shoham, Yoav and Leyton-Brown, Kevin}, - year={2008}, - publisher={Cambridge University Press} + title = {Multiagent systems: Algorithmic, game-theoretic, and logical foundations}, + author = {Shoham, Yoav and Leyton-Brown, Kevin}, + year = {2008}, + publisher = {Cambridge University Press}, + category = {textbooks} } From aa2d033f495a14a04774136bd3da06183b71ee54 Mon Sep 17 00:00:00 2001 From: wangyzh Date: Sun, 5 Jul 2026 18:06:47 +0800 Subject: [PATCH 4/8] Fix trailing whitespaces and typos --- catalog/books/shohambrown2008/fig5_1.efg | 2 +- catalog/books/shohambrown2008/fig5_11__original_layout.ef | 6 +++--- catalog/books/shohambrown2008/fig5_12.efg | 2 +- catalog/books/shohambrown2008/fig5_15.efg | 2 +- catalog/books/shohambrown2008/fig5_9.efg | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/catalog/books/shohambrown2008/fig5_1.efg b/catalog/books/shohambrown2008/fig5_1.efg index b83e826c9..49f598d28 100644 --- a/catalog/books/shohambrown2008/fig5_1.efg +++ b/catalog/books/shohambrown2008/fig5_1.efg @@ -3,7 +3,7 @@ EFG 2 R "Fig 5.1 from Shoham and Leyton-Brown (2008)" { "1" "2" } " Figure 5.1 from :cite:p:`ShoLeyB08`. This is a sharing game. Imagine a brother and sister sharing two indivisible and identical presents -from their parents. First the brother suggests a split, which can be one of three-he +from their parents. First the brother suggests a split, which can be one of three: he keeps both, she keeps both, or they each keep one. Then the sister chooses whether to accept or reject the split. If she accepts they each get their allocated present(s), and otherwise neither gets any gift. diff --git a/catalog/books/shohambrown2008/fig5_11__original_layout.ef b/catalog/books/shohambrown2008/fig5_11__original_layout.ef index 13246edad..8aa60582e 100644 --- a/catalog/books/shohambrown2008/fig5_11__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_11__original_layout.ef @@ -1,8 +1,8 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 -level 2 node 1 xshift -3.58 from 0,1 move C -level 2 node 2 xshift 3.58 from 0,1 move D +level 0 node 1 player 1 +level 2 node 1 xshift -3.58 from 0,1 move C +level 2 node 2 xshift 3.58 from 0,1 move D level 4 node 1 xshift -1.79 from 2,1 move c payoffs -1 -1 level 4 node 2 xshift 1.79 from 2,1 move d payoffs -4 0 level 4 node 3 xshift -1.79 from 2,2 move c payoffs 0 -4 diff --git a/catalog/books/shohambrown2008/fig5_12.efg b/catalog/books/shohambrown2008/fig5_12.efg index 2e08ce364..91674c549 100644 --- a/catalog/books/shohambrown2008/fig5_12.efg +++ b/catalog/books/shohambrown2008/fig5_12.efg @@ -2,7 +2,7 @@ EFG 2 R "Fig 5.12 from Shoham and Leyton-Brown (2008)" { "1" "2" } " Figure 5.12 from :cite:p:`ShoLeyB08`. -A game with imperfect recall. +A game with imperfect recall. Please read carefully about the definition of perfect recall, which infers three types of imperfect recall. " diff --git a/catalog/books/shohambrown2008/fig5_15.efg b/catalog/books/shohambrown2008/fig5_15.efg index 8f5a9414f..ceb402d94 100644 --- a/catalog/books/shohambrown2008/fig5_15.efg +++ b/catalog/books/shohambrown2008/fig5_15.efg @@ -2,7 +2,7 @@ EFG 2 R "Fig 5.15 from Shoham and Leyton-Brown (2008)" { "1" "2" } " Figure 5.15 from :cite:p:`ShoLeyB08`. -A game with imperfect information. +A game with imperfect information. This example shows how a requirement that a substrategy be a best response in all subgames is too simplistic for defining SPE in games with imperfect information. " diff --git a/catalog/books/shohambrown2008/fig5_9.efg b/catalog/books/shohambrown2008/fig5_9.efg index 68e2181ea..861c7c0b7 100644 --- a/catalog/books/shohambrown2008/fig5_9.efg +++ b/catalog/books/shohambrown2008/fig5_9.efg @@ -5,7 +5,7 @@ Figure 5.9 from :cite:p:`ShoLeyB08`. This is the centipede game. In this game two players alternate in making decisions, at each turn choosing between going down and ending the game or going across and continuing it. -This example is usd to explain the criticisms of backward induction for finding subgame-perfect equilibrium. +This example is used to explain the criticisms of backward induction for finding subgame-perfect equilibrium. Note that centipede is also a parametrized game, with the parameter being the number of rounds. " From d54c2399baefdce2a66d9ae667a72bc83176c69d Mon Sep 17 00:00:00 2001 From: wyz2368 Date: Mon, 6 Jul 2026 22:49:14 +0800 Subject: [PATCH 5/8] Fix trailing whitespaces found by co-pilot. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- catalog/books/shohambrown2008/fig5_15__original_layout.ef | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/catalog/books/shohambrown2008/fig5_15__original_layout.ef b/catalog/books/shohambrown2008/fig5_15__original_layout.ef index adb455c49..50d5d3446 100644 --- a/catalog/books/shohambrown2008/fig5_15__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_15__original_layout.ef @@ -1,9 +1,9 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 +level 0 node 1 player 1 level 2 node 1 xshift -5.01 from 0,1 move L payoffs 1 1 -level 2 node 2 xshift -0.72 from 0,1 move C -level 2 node 3 xshift 5.01 from 0,1 move R +level 2 node 2 xshift -0.72 from 0,1 move C +level 2 node 3 xshift 5.01 from 0,1 move R level 4 node 1 xshift -1.43 from 2,2 move U payoffs 0 1000 level 4 node 2 xshift 1.43 from 2,2 move D payoffs 0 0 level 4 node 3 xshift -1.43 from 2,3 move U payoffs 1 0 From aa9adc76367cd9a4c0bfaed953b158eb38a24dad Mon Sep 17 00:00:00 2001 From: wangyzh Date: Thu, 9 Jul 2026 11:10:04 -0400 Subject: [PATCH 6/8] Fix trailing whitespaces and typos --- .../fig5_10__original_layout.ef | 8 ++--- .../fig5_15__original_layout.ef | 6 ++-- .../fig5_1__original_layout.ef | 8 ++--- .../fig5_2__original_layout.ef | 8 ++--- .../fig5_9__original_layout.ef | 10 +++---- .../fig6_2__original_layout.ef | 30 +++++++++---------- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/catalog/books/shohambrown2008/fig5_10__original_layout.ef b/catalog/books/shohambrown2008/fig5_10__original_layout.ef index bc10d8212..55e983222 100644 --- a/catalog/books/shohambrown2008/fig5_10__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_10__original_layout.ef @@ -1,10 +1,10 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 -level 2 node 1 player 2 xshift -3.58 from 0,1 move L +level 0 node 1 player 1 +level 2 node 1 player 2 xshift -3.58 from 0,1 move L level 2 node 2 xshift 3.58 from 0,1 move R payoffs 0 0 -level 4 node 1 xshift -2.86 from 2,1 move A -level 4 node 2 xshift 2.86 from 2,1 move B +level 4 node 1 xshift -2.86 from 2,1 move A +level 4 node 2 xshift 2.86 from 2,1 move B level 6 node 1 xshift -1.43 from 4,1 move l payoffs 0 0 level 6 node 2 xshift 1.43 from 4,1 move r payoffs 2 4 level 6 node 3 xshift -1.43 from 4,2 move l payoffs 4 2 diff --git a/catalog/books/shohambrown2008/fig5_15__original_layout.ef b/catalog/books/shohambrown2008/fig5_15__original_layout.ef index adb455c49..50d5d3446 100644 --- a/catalog/books/shohambrown2008/fig5_15__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_15__original_layout.ef @@ -1,9 +1,9 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 +level 0 node 1 player 1 level 2 node 1 xshift -5.01 from 0,1 move L payoffs 1 1 -level 2 node 2 xshift -0.72 from 0,1 move C -level 2 node 3 xshift 5.01 from 0,1 move R +level 2 node 2 xshift -0.72 from 0,1 move C +level 2 node 3 xshift 5.01 from 0,1 move R level 4 node 1 xshift -1.43 from 2,2 move U payoffs 0 1000 level 4 node 2 xshift 1.43 from 2,2 move D payoffs 0 0 level 4 node 3 xshift -1.43 from 2,3 move U payoffs 1 0 diff --git a/catalog/books/shohambrown2008/fig5_1__original_layout.ef b/catalog/books/shohambrown2008/fig5_1__original_layout.ef index 4eb06de72..492f04754 100644 --- a/catalog/books/shohambrown2008/fig5_1__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_1__original_layout.ef @@ -1,11 +1,11 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 -level 2 node 1 player 2 xshift -4.77 from 0,1 move 2-0 -level 2 node 2 player 2 xshift 0 from 0,1 move 1-1 +level 0 node 1 player 1 +level 2 node 1 player 2 xshift -4.77 from 0,1 move 2-0 +level 2 node 2 player 2 xshift 0 from 0,1 move 1-1 level 4 node 1 xshift -1.19 from 2,1 move no payoffs 0 0 level 4 node 2 xshift 1.19 from 2,1 move yes payoffs 2 0 -level 2 node 3 player 2 xshift 4.77 from 0,1 move 0-2 +level 2 node 3 player 2 xshift 4.77 from 0,1 move 0-2 level 4 node 3 xshift -1.19 from 2,2 move no payoffs 0 0 level 4 node 4 xshift 1.19 from 2,2 move yes payoffs 1 1 level 4 node 5 xshift -1.19 from 2,3 move no payoffs 0 0 diff --git a/catalog/books/shohambrown2008/fig5_2__original_layout.ef b/catalog/books/shohambrown2008/fig5_2__original_layout.ef index 630246f0b..1d55ae617 100644 --- a/catalog/books/shohambrown2008/fig5_2__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_2__original_layout.ef @@ -1,11 +1,11 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 -level 2 node 1 player 2 xshift -3.22 from 0,1 move A -level 2 node 2 player 2 xshift 3.22 from 0,1 move B +level 0 node 1 player 1 +level 2 node 1 player 2 xshift -3.22 from 0,1 move A +level 2 node 2 player 2 xshift 3.22 from 0,1 move B level 4 node 1 xshift -1.43 from 2,1 move C payoffs 3 8 level 4 node 2 xshift 1.43 from 2,1 move D payoffs 8 3 level 4 node 3 xshift -2.15 from 2,2 move E payoffs 5 5 -level 4 node 4 player 1 xshift 2.15 from 2,2 move F +level 4 node 4 player 1 xshift 2.15 from 2,2 move F level 6 node 1 xshift -1.43 from 4,4 move G payoffs 2 10 level 6 node 2 xshift 1.43 from 4,4 move H payoffs 1 0 diff --git a/catalog/books/shohambrown2008/fig5_9__original_layout.ef b/catalog/books/shohambrown2008/fig5_9__original_layout.ef index 168078648..9f477bc52 100644 --- a/catalog/books/shohambrown2008/fig5_9__original_layout.ef +++ b/catalog/books/shohambrown2008/fig5_9__original_layout.ef @@ -1,13 +1,13 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 +level 0 node 1 player 1 level 2 node 1 xshift -2.31 from 0,1 move A payoffs 1 0 -level 2 node 2 player 2 xshift 2.31 from 0,1 move D +level 2 node 2 player 2 xshift 2.31 from 0,1 move D level 4 node 1 xshift -2.24 from 2,2 move A payoffs 0 2 -level 4 node 2 player 1 xshift 2.24 from 2,2 move D +level 4 node 2 player 1 xshift 2.24 from 2,2 move D level 6 node 1 xshift -2.09 from 4,2 move A payoffs 3 1 -level 6 node 2 player 2 xshift 2.09 from 4,2 move D +level 6 node 2 player 2 xshift 2.09 from 4,2 move D level 8 node 1 xshift -1.79 from 6,2 move A payoffs 2 4 -level 8 node 2 player 1 xshift 1.79 from 6,2 move D +level 8 node 2 player 1 xshift 1.79 from 6,2 move D level 10 node 1 xshift -1.19 from 8,2 move A payoffs 4 3 level 10 node 2 xshift 1.19 from 8,2 move D payoffs 3 5 diff --git a/catalog/books/shohambrown2008/fig6_2__original_layout.ef b/catalog/books/shohambrown2008/fig6_2__original_layout.ef index 4571fb548..563e3b0f0 100644 --- a/catalog/books/shohambrown2008/fig6_2__original_layout.ef +++ b/catalog/books/shohambrown2008/fig6_2__original_layout.ef @@ -1,20 +1,20 @@ player 1 name 1 player 2 name 2 -level 0 node 1 player 1 -level 2 node 1 xshift -6.37 from 0,1 move C -level 2 node 2 xshift 6.37 from 0,1 move D -level 4 node 1 player 1 xshift -3.19 from 2,1 move c -level 4 node 2 player 1 xshift 3.19 from 2,1 move d -level 4 node 3 player 1 xshift -3.19 from 2,2 move c -level 4 node 4 player 1 xshift 3.19 from 2,2 move d -level 6 node 1 xshift -1.59 from 4,1 move C -level 6 node 2 xshift 1.59 from 4,1 move D -level 6 node 3 xshift -1.59 from 4,2 move C -level 6 node 4 xshift 1.59 from 4,2 move D -level 6 node 5 xshift -1.59 from 4,3 move C -level 6 node 6 xshift 1.59 from 4,3 move D -level 6 node 7 xshift -1.59 from 4,4 move C -level 6 node 8 xshift 1.59 from 4,4 move D +level 0 node 1 player 1 +level 2 node 1 xshift -6.37 from 0,1 move C +level 2 node 2 xshift 6.37 from 0,1 move D +level 4 node 1 player 1 xshift -3.19 from 2,1 move c +level 4 node 2 player 1 xshift 3.19 from 2,1 move d +level 4 node 3 player 1 xshift -3.19 from 2,2 move c +level 4 node 4 player 1 xshift 3.19 from 2,2 move d +level 6 node 1 xshift -1.59 from 4,1 move C +level 6 node 2 xshift 1.59 from 4,1 move D +level 6 node 3 xshift -1.59 from 4,2 move C +level 6 node 4 xshift 1.59 from 4,2 move D +level 6 node 5 xshift -1.59 from 4,3 move C +level 6 node 6 xshift 1.59 from 4,3 move D +level 6 node 7 xshift -1.59 from 4,4 move C +level 6 node 8 xshift 1.59 from 4,4 move D level 8 node 1 xshift -0.8 from 6,1 move c payoffs -2 -2 level 8 node 2 xshift 0.8 from 6,1 move d payoffs -5 -1 level 8 node 3 xshift -0.8 from 6,2 move c payoffs -1 -5 From c4b53b63722beb450991368047370b6a923a6187 Mon Sep 17 00:00:00 2001 From: wangyzh Date: Fri, 10 Jul 2026 05:13:18 -0400 Subject: [PATCH 7/8] Update layouts --- build_support/catalog/gtdraw_settings.yaml | 28 +++++ catalog/books/shohambrown2008/fig5_12.efg | 3 +- .../fig6_8__original_layout.ef | 116 ++++++++++++------ 3 files changed, 106 insertions(+), 41 deletions(-) diff --git a/build_support/catalog/gtdraw_settings.yaml b/build_support/catalog/gtdraw_settings.yaml index 2bbd9889c..28d33f2af 100644 --- a/build_support/catalog/gtdraw_settings.yaml +++ b/build_support/catalog/gtdraw_settings.yaml @@ -44,3 +44,31 @@ overrides: 2: '#DD79E0' 3: '#1616BC' 4: '#985003' + + books/shohambrown2008/fig6_8: + scale_factor: 1.0 + level_scaling: 1.0 + sublevel_scaling: 1.0 + width_scaling: 1.0 + horizontal: false + mirror: false + shared_terminal_depth: false + color_scheme: colorblind + edge_thickness: 1.0 + action_label_position: 0.5 + action_label_position_by: player + action_label_dist: 1.0 + vary_action_label_positions: false + vary_action_label_positions_by: all + font_family: rmfamily + font_bold: false + font_italic: false + font_size: normalsize + node_size: 1.5 + label_bg: false + label_bg_color: white + label_bg_opacity: 0.8 + iset_fill: false + iset_fill_opacity: 0.2 + iset_boundary: solid + legend_position: top-left diff --git a/catalog/books/shohambrown2008/fig5_12.efg b/catalog/books/shohambrown2008/fig5_12.efg index 91674c549..27c70afe2 100644 --- a/catalog/books/shohambrown2008/fig5_12.efg +++ b/catalog/books/shohambrown2008/fig5_12.efg @@ -2,8 +2,7 @@ EFG 2 R "Fig 5.12 from Shoham and Leyton-Brown (2008)" { "1" "2" } " Figure 5.12 from :cite:p:`ShoLeyB08`. -A game with imperfect recall. -Please read carefully about the definition of perfect recall, which infers three types of imperfect recall. +A game with imperfect recall, in particular absent-mindedness. " diff --git a/catalog/books/shohambrown2008/fig6_8__original_layout.ef b/catalog/books/shohambrown2008/fig6_8__original_layout.ef index c115b8e3d..a01dfbf0f 100644 --- a/catalog/books/shohambrown2008/fig6_8__original_layout.ef +++ b/catalog/books/shohambrown2008/fig6_8__original_layout.ef @@ -1,5 +1,13 @@ -% Four games with uniform chance and corrected player 2 information sets -% Nature chooses among MP, PD, Coord, BoS with probability 1/4 each. +% Four games with uniform chance and non-overlapping information sets. +% Nature chooses among MP, PD, Coord, and BoS with probability 1/4 each. +% +% The Player 2 information sets are separated vertically: +% - MP and Coord nodes are at level 5. +% - PD and BoS nodes are at level 11. +% +% The additional spacing prevents the U/D labels and the terminal +% payoffs of the upper subtrees from overlapping either information set. + player 0 name Nature player 1 name 1 player 2 name 2 @@ -7,48 +15,78 @@ player 2 name 2 % Nature root level 0 node 1 player 0 -% Nature moves: uniform distribution shown on each branch +% Nature moves +% MP and PD belong to Player 1's first information set. level 2 node 1 xshift -7.5 from 0,1 move MP~(1/4) level 2 node 2 xshift -2.5 from 0,1 move PD~(1/4) -level 2 node 3 xshift 2.5 from 0,1 move Coord~(1/4) -level 2 node 4 xshift 7.5 from 0,1 move BoS~(1/4) + +% Coord and BoS belong to Player 1's second information set. +level 3 node 3 xshift 2.5 from 0,1 move Coord~(1/4) +level 3 node 4 xshift 7.5 from 0,1 move BoS~(1/4) % Player 1 moves U/D -level 4 node 1 xshift -1 from 2,1 move U -level 4 node 2 xshift 1 from 2,1 move D -level 4 node 3 xshift -1 from 2,2 move U -level 4 node 4 xshift 1 from 2,2 move D -level 4 node 5 xshift -1 from 2,3 move U -level 4 node 6 xshift 1 from 2,3 move D -level 4 node 7 xshift -1 from 2,4 move U -level 4 node 8 xshift 1 from 2,4 move D - -% Player 2 moves L/R and payoffs, left-to-right as in the figure -level 6 node 1 xshift -0.55 from 4,1 move L payoffs 2 0 -level 6 node 2 xshift 0.55 from 4,1 move R payoffs 0 2 -level 6 node 3 xshift -0.55 from 4,2 move L payoffs 0 2 -level 6 node 4 xshift 0.55 from 4,2 move R payoffs 2 0 - -level 6 node 5 xshift -0.55 from 4,3 move L payoffs 2 2 -level 6 node 6 xshift 0.55 from 4,3 move R payoffs 0 3 -level 6 node 7 xshift -0.55 from 4,4 move L payoffs 3 0 -level 6 node 8 xshift 0.55 from 4,4 move R payoffs 1 1 - -level 6 node 9 xshift -0.55 from 4,5 move L payoffs 2 2 -level 6 node 10 xshift 0.55 from 4,5 move R payoffs 0 0 -level 6 node 11 xshift -0.55 from 4,6 move L payoffs 0 0 -level 6 node 12 xshift 0.55 from 4,6 move R payoffs 1 1 - -level 6 node 13 xshift -0.55 from 4,7 move L payoffs 2 1 -level 6 node 14 xshift 0.55 from 4,7 move R payoffs 0 0 -level 6 node 15 xshift -0.55 from 4,8 move L payoffs 0 0 -level 6 node 16 xshift 0.55 from 4,8 move R payoffs 1 2 + +% Matching Pennies: +% These nodes belong to Player 2 information set 1. +level 5 node 1 xshift -1 from 2,1 move U +level 5 node 2 xshift 1 from 2,1 move D + +% Prisoner's Dilemma: +% These nodes belong to Player 2 information set 2. +level 11 node 3 xshift -1 from 2,2 move U +level 11 node 4 xshift 1 from 2,2 move D + +% Coordination: +% These nodes belong to Player 2 information set 1. +level 5 node 5 xshift -1 from 3,3 move U +level 5 node 6 xshift 1 from 3,3 move D + +% Battle of the Sexes: +% These nodes belong to Player 2 information set 2. +level 11 node 7 xshift -1 from 3,4 move U +level 11 node 8 xshift 1 from 3,4 move D + +% Player 2 moves L/R and terminal payoffs + +% Matching Pennies +% The terminal level is sufficiently above the second information set. +level 8 node 1 xshift -0.55 from 5,1 move L payoffs 2 0 +level 8 node 2 xshift 0.55 from 5,1 move R payoffs 0 2 +level 8 node 3 xshift -0.55 from 5,2 move L payoffs 0 2 +level 8 node 4 xshift 0.55 from 5,2 move R payoffs 2 0 + +% Prisoner's Dilemma +level 14 node 5 xshift -0.55 from 11,3 move L payoffs 2 2 +level 14 node 6 xshift 0.55 from 11,3 move R payoffs 0 3 +level 14 node 7 xshift -0.55 from 11,4 move L payoffs 3 0 +level 14 node 8 xshift 0.55 from 11,4 move R payoffs 1 1 + +% Coordination +% These payoffs are placed at level 8, leaving three levels before +% the lower Player 2 information set at level 11. +level 8 node 9 xshift -0.55 from 5,5 move L payoffs 2 2 +level 8 node 10 xshift 0.55 from 5,5 move R payoffs 0 0 +level 8 node 11 xshift -0.55 from 5,6 move L payoffs 0 0 +level 8 node 12 xshift 0.55 from 5,6 move R payoffs 1 1 + +% Battle of the Sexes +level 14 node 13 xshift -0.55 from 11,7 move L payoffs 2 1 +level 14 node 14 xshift 0.55 from 11,7 move R payoffs 0 0 +level 14 node 15 xshift -0.55 from 11,8 move L payoffs 0 0 +level 14 node 16 xshift 0.55 from 11,8 move R payoffs 1 2 % Player 1 information sets + +% Player 1 cannot distinguish MP from PD. iset 2,1 2,2 player 1 -iset 2,3 2,4 player 1 -% Player 2 information sets: -% first and third are the same; second and fourth are the same. -iset 4,1 4,2 4,5 4,6 player 2 -iset 4,3 4,4 4,7 4,8 player 2 +% Player 1 cannot distinguish Coordination from Battle of the Sexes. +iset 3,3 3,4 player 1 + +% Player 2 information sets + +% Player 2 cannot distinguish MP from Coordination. +iset 5,1 5,2 5,5 5,6 player 2 + +% Player 2 cannot distinguish PD from Battle of the Sexes. +iset 11,3 11,4 11,7 11,8 player 2 From ce57268f4cec5f96a047ec1d43b4a2491edaebf6 Mon Sep 17 00:00:00 2001 From: wangyzh Date: Fri, 10 Jul 2026 05:13:29 -0400 Subject: [PATCH 8/8] Fix ruff --- build_support/catalog/test_update.py | 4 ++-- build_support/catalog/update.py | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build_support/catalog/test_update.py b/build_support/catalog/test_update.py index 047c600c6..e58c63f55 100644 --- a/build_support/catalog/test_update.py +++ b/build_support/catalog/test_update.py @@ -173,7 +173,7 @@ def fake_games(**kwargs): df = update._catalog_games(checkout_dir) assert calls == [(checkout_dir, {"include_descriptions": True})] - assert update.gbt.catalog._CATALOG_RESOURCE == stale_dir + assert stale_dir == update.gbt.catalog._CATALOG_RESOURCE assert list(df["Game"]) == ["checkout/game1"] def test_generate_rst_table_uses_requested_catalog_dir_while_rendering( @@ -195,7 +195,7 @@ def fake_write_tree_level(*args, **kwargs): update.generate_rst_table(_make_df(), tmp_path / "out.rst", catalog_dir=checkout_dir) assert observed == [checkout_dir] - assert update.gbt.catalog._CATALOG_RESOURCE == stale_dir + assert stale_dir == update.gbt.catalog._CATALOG_RESOURCE # --------------------------------------------------------------------------- diff --git a/build_support/catalog/update.py b/build_support/catalog/update.py index 284b12846..5cc15443b 100644 --- a/build_support/catalog/update.py +++ b/build_support/catalog/update.py @@ -344,11 +344,10 @@ def generate_rst_table( catalog_dir = catalog_dir or CATALOG_DIR labels = load_hierarchy_labels() tree = _build_slug_tree(df) - with _using_catalog_dir(catalog_dir): - with open(rst_path, "w", encoding="utf-8") as f: - _write_tree_level( - f, tree, "", labels, catalog_dir, indent="", regenerate_images=regenerate_images - ) + with _using_catalog_dir(catalog_dir), open(rst_path, "w", encoding="utf-8") as f: + _write_tree_level( + f, tree, "", labels, catalog_dir, indent="", regenerate_images=regenerate_images + ) def update_makefile(