diff --git a/.gitignore b/.gitignore index f8be35fcf..65fe1c9d4 100644 --- a/.gitignore +++ b/.gitignore @@ -41,14 +41,11 @@ dist *.dmg Gambit.app/* *.so -doc/tutorials/games/*.nfg -doc/tutorials/games/*.efg -doc/tutorials/*.png *.dmg Gambit.app/* *.ipynb_checkpoints -*.ef +doc/**/*.ef build_support/msw/gambit.wxs build_support/osx/Info.plist src/pygambit/catalog -doc/catalog.csv +doc/catalog_table.rst diff --git a/.readthedocs.yml b/.readthedocs.yml index dc6c7c782..b30aba061 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -13,8 +13,9 @@ build: - libgmp-dev - pandoc - texlive-full + - imagemagick jobs: - # Create CSV for catalog table in docs + # Create RST for catalog table in docs post_install: - $READTHEDOCS_VIRTUALENV_PATH/bin/python build_support/catalog/update.py diff --git a/build_support/catalog/update.py b/build_support/catalog/update.py index e42a18ad9..adf2f2450 100644 --- a/build_support/catalog/update.py +++ b/build_support/catalog/update.py @@ -1,12 +1,137 @@ import argparse +import re from pathlib import Path +import pandas as pd +from draw_tree import generate_pdf, generate_png, generate_tex + import pygambit as gbt -CATALOG_CSV = Path(__file__).parent.parent.parent / "doc" / "catalog.csv" +CATALOG_RST_TABLE = Path(__file__).parent.parent.parent / "doc" / "catalog_table.rst" CATALOG_DIR = Path(__file__).parent.parent.parent / "catalog" MAKEFILE_AM = Path(__file__).parent.parent.parent / "Makefile.am" +# Common arguments for visualization generation +draw_tree_args = { + "color_scheme": "gambit", + "sublevel_scaling": 0, + "shared_terminal_depth": True, +} + + +def _write_efg_table(df: pd.DataFrame, f, tikz_re, regenerate_images: bool): + """Write the EFG games list-table to file handle f.""" + f.write(".. list-table::\n") + f.write(" :header-rows: 1\n") + f.write(" :widths: 100\n") + f.write(" :class: tight-table\n") + f.write("\n") + f.write(" * - **Extensive form games**\n") + + efg_df = df[df["Format"] == "efg"] + for _, row in efg_df.iterrows(): + slug = row["Game"] + title = str(row.get("Title", "")).strip() + description = str(row.get("Description", "")).strip() + + tex_path = CATALOG_DIR / "img" / f"{slug}.tex" + if regenerate_images or not tex_path.exists(): + g = gbt.catalog.load(slug) + viz_path = CATALOG_DIR / "img" / f"{slug}" + viz_path.parent.mkdir(parents=True, exist_ok=True) + for func in [generate_tex, generate_png, generate_pdf]: + func(g, save_to=str(viz_path), **draw_tree_args) + + with open(tex_path, encoding="utf-8") as tex_f: + tex_content = tex_f.read() + match = tikz_re.search(tex_content) + tikz = match.group(1).strip() if match else "% Could not extract tikzpicture from tex file" + + # Main dropdown + f.write(f" * - .. dropdown:: {title}\n") + f.write(" \n") + if description: + for line in description.splitlines(): + f.write(f" {line}\n") + f.write(" \n") + f.write(" **Load in PyGambit:**\n") + f.write(" \n") + f.write(" .. code-block:: python\n") + f.write(" \n") + f.write(f' pygambit.catalog.load("{slug}")\n') + f.write(" \n") + + # Download links (inside the dropdown) + download_links = [row["Download"]] + for ext in ["ef", "tex", "png", "pdf"]: + download_links.append(f":download:`{slug}.{ext} <../catalog/img/{slug}.{ext}>`") + f.write(" **Download game and image files:**\n") + f.write(" \n") + f.write(f" {' '.join(download_links)}\n") + f.write(" \n") + + # TiKZ image (outside dropdown) + f.write(" .. tikz::\n") + f.write(" :align: center\n") + f.write(" \n") + for line in tikz.splitlines(): + f.write(f" {line}\n") + f.write(" \n") + + +def _write_nfg_table(df: pd.DataFrame, f): + """Write the NFG games list-table to file handle f.""" + f.write(".. list-table::\n") + f.write(" :header-rows: 1\n") + f.write(" :widths: 100\n") + f.write(" :class: tight-table\n") + f.write("\n") + f.write(" * - **Strategic form games**\n") + + nfg_df = df[df["Format"] == "nfg"] + for _, row in nfg_df.iterrows(): + slug = row["Game"] + + # Title as plain text header + f.write(" * - \n") + f.write(" \n") + + # Jupyter-execute block (no dropdown) + f.write(" .. jupyter-execute::\n") + f.write(" \n") + f.write(" import pygambit\n") + f.write(f' pygambit.catalog.load("{slug}")\n') + f.write(" \n") + + # Download link (plain, no dropdown) + f.write(f" :download:`{slug}.nfg <../catalog/{slug}.nfg>`\n") + f.write(" \n") + + +def generate_rst_table(df: pd.DataFrame, rst_path: Path, regnerate_images: bool = False): + """Generate RST output with two list-tables: one for EFG and one for NFG games.""" + tikz_re = re.compile(r"\\begin\{document\}(.*?)\\end\{document\}", re.DOTALL) + + with open(rst_path, "w", encoding="utf-8") as f: + # TOC linking to both sections + f.write(".. contents::\n") + f.write(" :local:\n") + f.write(" :depth: 1\n") + f.write("\n") + + # EFG section + f.write("Extensive form games\n") + f.write("--------------------\n") + f.write("\n") + _write_efg_table(df, f, tikz_re, regnerate_images) + f.write("\n") + + # NFG section + f.write("Strategic form games\n") + f.write("--------------------\n") + f.write("\n") + _write_nfg_table(df, f) + def update_makefile(): """Update the Makefile.am with all games from the catalog.""" @@ -60,15 +185,15 @@ def update_makefile(): if __name__ == "__main__": - parser = argparse.ArgumentParser() parser.add_argument("--build", action="store_true") + parser.add_argument("--regenerate-images", action="store_true") args = parser.parse_args() - # Create CSV used by RST docs page - gbt.catalog.games().to_csv(CATALOG_CSV, index=False) - print(f"Generated {CATALOG_CSV} for use in local docs build. DO NOT COMMIT.") - - # Update the Makefile.am with the current list of catalog files + # Create RST list-table used by doc/catalog.rst + df = gbt.catalog.games(include_descriptions=True) + generate_rst_table(df, CATALOG_RST_TABLE, regnerate_images=args.regenerate_images) + print(f"Generated {CATALOG_RST_TABLE} for use in local docs build. DO NOT COMMIT.") if args.build: + # Update the Makefile.am with the current list of catalog files update_makefile() diff --git a/catalog/__init__.py b/catalog/__init__.py index 4a972d917..05f0c0321 100644 --- a/catalog/__init__.py +++ b/catalog/__init__.py @@ -1,5 +1,6 @@ from importlib.resources import as_file, files from pathlib import Path +from typing import Any import pandas as pd @@ -17,32 +18,153 @@ def load(slug: str) -> gbt.Game: """ Load a game from the package catalog. + + Parameters + ---------- + slug : str + The slug of the game to load. + + Returns + ------- + gbt.Game + The loaded game. + + Raises + ------ + FileNotFoundError + If the game does not exist in the catalog. """ slug = str(Path(slug)).replace("\\", "/") + # Try to load from file for suffix, reader in READERS.items(): resource_path = _CATALOG_RESOURCE / f"{slug}{suffix}" - if resource_path.is_file(): - # as_file ensures we have a real filesystem path for the reader with as_file(resource_path) as path: return reader(str(path)) - raise FileNotFoundError(f"No catalog entry called {slug}.nfg or {slug}.efg") - - -def games() -> pd.DataFrame: + # Try loading from family games + fg = family_games() + if slug in fg: + return fg[slug] + + # Raise error if game does not exist + raise FileNotFoundError(f"No catalog entry called {slug}") + + +def games( + n_actions: int | None = None, + n_contingencies: int | None = None, + n_infosets: int | None = None, + is_const_sum: bool | None = None, + is_perfect_recall: bool | None = None, + is_tree: bool | None = None, + min_payoff: float | None = None, + max_payoff: float | None = None, + n_nodes: int | None = None, + n_outcomes: int | None = None, + n_players: int | None = None, + n_strategies: int | None = None, + include_descriptions: bool = False, +) -> pd.DataFrame: """ - List games available in the package catalog, including subdirectories. + List games available in the package catalog. + + Most arguments are treated as filters on the + attributes of the Game objects. + + Parameters + ---------- + n_actions: int, optional + The number of actions in the game. Only extensive games are returned. + n_contingencies: int, optional + The number of contingencies in the game. + n_infosets: int, optional + The number of information sets in the game. Only extensive games are returned. + is_const_sum: bool, optional + Whether the game is constant-sum. + is_perfect_recall: bool, optional + Whether the game has perfect recall. + is_tree: bool, optional + Whether the game is an extensive game (a tree). + min_payoff: float, optional + The minimum payoff in the game. Games returned have `min_payoff >= value`. + max_payoff: float, optional + The maximum payoff in the game. Games returned have `max_payoff <= value`. + n_nodes: int, optional + The number of nodes in the game. Only extensive games are returned. + n_outcomes: int, optional + The number of outcomes in the game. + n_players: int, optional + The number of players in the game. + n_strategies: int, optional + The number of pure strategies in the game. + include_descriptions: bool, optional + Whether to include the description of each game in the returned DataFrame. + Defaults to False. + + Returns + ------- + pd.DataFrame + A DataFrame with columns "Game" and "Title", where "Game" is the slug to load the game. + If `include_descriptions=True`, the DataFrame will also include a "Description" column. """ - records: list[dict[str, str]] = [] - - # Using rglob("*") to find files in all subdirectories + records: list[dict[str, Any]] = [] + + def check_filters(game: gbt.Game) -> bool: + if n_actions is not None: + if not game.is_tree: + return False + if len(game.actions) != n_actions: + return False + if n_contingencies is not None and len(game.contingencies) != n_contingencies: + return False + if n_infosets is not None: + if not game.is_tree: + return False + if len(game.infosets) != n_infosets: + return False + if is_const_sum is not None and game.is_const_sum != is_const_sum: + return False + if is_perfect_recall is not None and game.is_perfect_recall != is_perfect_recall: + return False + if is_tree is not None and game.is_tree != is_tree: + return False + if min_payoff is not None and game.min_payoff < min_payoff: + return False + if max_payoff is not None and game.max_payoff > max_payoff: + return False + if n_nodes is not None: + if not game.is_tree: + return False + if len(game.nodes) != n_nodes: + return False + if n_outcomes is not None and len(game.outcomes) != n_outcomes: + return False + if n_players is not None and len(game.players) != n_players: + return False + return not (n_strategies is not None and len(game.strategies) != n_strategies) + + def append_record( + slug: str, + game: gbt.Game, + ) -> None: + record = { + "Game": slug, + "Title": game.title, + } + if include_descriptions: + record["Description"] = game.description + ext = "efg" if game.is_tree else "nfg" + record["Download"] = f":download:`{slug}.{ext} <../catalog/{slug}.{ext}>`" + record["Format"] = ext + records.append(record) + + # Add all the games stored as EFG/NFG files for resource_path in sorted(_CATALOG_RESOURCE.rglob("*")): reader = READERS.get(resource_path.suffix) if reader is not None and resource_path.is_file(): - # Calculate the path relative to the root resource # and remove the suffix to get the "slug" rel_path = resource_path.relative_to(_CATALOG_RESOURCE) @@ -50,11 +172,79 @@ def games() -> pd.DataFrame: with as_file(resource_path) as path: game = reader(str(path)) - records.append( - { - "Game": slug, - "Title": game.title, - } - ) - + if check_filters(game): + append_record(slug, game) + + # Add all the games from families + for slug, game in family_games().items(): + # Throw an error if there's a slug collision between family games and file-based games + if slug in [r["Game"] for r in records]: + raise ValueError( + f"Slug collision: {slug} is present in both file-based and family games." + ) + if check_filters(game): + append_record(slug, game) + + if include_descriptions: + return pd.DataFrame.from_records( + records, columns=["Game", "Title", "Description", "Download", "Format"] + ) return pd.DataFrame.from_records(records, columns=["Game", "Title"]) + + +def family_games() -> dict[str, gbt.Game]: + """ + Generate a dict of games for inclusion in the catalog, + using the game families in this module. + + Returns + ------- + dict[str, gbt.Game] + A dictionary mapping slugs to game objects for family games. + """ + return { + "one_shot_trust": one_shot_trust(), + "oneshot_trust_unique_NE": one_shot_trust(unique_NE_variant=True), + } + + +################################################################################################ +# Families + + +def one_shot_trust(unique_NE_variant: bool = False) -> gbt.Game: + """ + The unique_NE_variant makes Trust a dominant strategy, replacing the + non-singleton equilibrium component from the standard version of the game + where the Buyer plays "Not Trust" and the seller can play any mixture with + < 0.5 probability on Honor with a unique NE where the Buyer plays Trust and + the Seller plays Abuse. + + Parameters + ---------- + unique_NE_variant : bool, optional + Whether to modify the game so that it has a unique Nash equilibrium. + Defaults to False. + + Returns + ------- + gbt.Game + The constructed extensive-form game. + """ + g = gbt.Game.new_tree(players=["Buyer", "Seller"]) + g.description = "One-shot trust game with binary actions, originally from [Kre90]_." + g.append_move(g.root, "Buyer", ["Trust", "Not trust"]) + g.append_move(g.root.children[0], "Seller", ["Honor", "Abuse"]) + g.set_outcome(g.root.children[0].children[0], g.add_outcome([1, 1], label="Trustworthy")) + if unique_NE_variant: + g.title = "One-shot trust game with unique NE" + g.set_outcome( + g.root.children[0].children[1], g.add_outcome(["1/2", 2], label="Untrustworthy") + ) + else: + g.title = "One-shot trust game" + g.set_outcome( + g.root.children[0].children[1], g.add_outcome([-1, 2], label="Untrustworthy") + ) + g.set_outcome(g.root.children[1], g.add_outcome([0, 0], label="Opt-out")) + return g diff --git a/catalog/bagwell1995.efg b/catalog/bagwell1995.efg index 58889c664..3c9c92101 100644 --- a/catalog/bagwell1995.efg +++ b/catalog/bagwell1995.efg @@ -1,6 +1,6 @@ EFG 2 R "Bagwell (GEB 1995) commitment and (un)observability" { "Player 1" "Player 2" } "This is a Stackelberg-type game with imperfectly observed commitment, following the -analysis of Bagwell [^Bag1995]. The outcomes and payoffs are the same as in Bagwell's +analysis of Bagwell [Bag1995]_. The outcomes and payoffs are the same as in Bagwell's model. This example sets the probability that the follower 'correctly' observes the leader's action as .99 (99/100). The key result is that the only pure-strategy equilibrium that survives if observability is imperfect is the one in which players @@ -8,8 +8,8 @@ choose the actions that would form an equilibrium if the game was a *simultaneou game. There is an equilibrium in which the 'Stackelberg' action is played with high probability, but strictly less than one. -[^Bag1995]: Bagwell, Kyle (1995) Commitment and observability in games. - _Games and Economic Behavior_ 8: 271-280. +[Bag1995]_: Bagwell, Kyle (1995) Commitment and observability in games. + Games and Economic Behavior 8: 271-280. " p "" 1 1 "" { "S" "C" } 0 diff --git a/catalog/img/bagwell1995.ef b/catalog/img/bagwell1995.ef new file mode 100644 index 000000000..23e69370e --- /dev/null +++ b/catalog/img/bagwell1995.ef @@ -0,0 +1,19 @@ +player 1 name Player~1 +player 2 name Player~2 +level -2.0 node 1 player 1 +level 2.0 node 1 player 0 xshift -4.0 from -2.0,1 move S +level 6.0 node 1 xshift -2.0 from 2.0,1 move s~(\frac{99}{100}) +level 10.0 node 1 xshift -1.0 from 6.0,1 move S payoffs 5 2 +level 10.0 node 2 xshift 1.0 from 6.0,1 move C payoffs 3 1 +level 6.0 node 2 xshift 2.0 from 2.0,1 move c~(\frac{1}{100}) +level 10.0 node 3 xshift -1.0 from 6.0,2 move S payoffs 5 2 +level 10.0 node 4 xshift 1.0 from 6.0,2 move C payoffs 3 1 +level 2.0 node 2 player 0 xshift 4.0 from -2.0,1 move C +level 6.0 node 3 xshift -2.0 from 2.0,2 move s~(\frac{1}{100}) +level 10.0 node 5 xshift -1.0 from 6.0,3 move S payoffs 6 3 +level 10.0 node 6 xshift 1.0 from 6.0,3 move C payoffs 4 4 +level 6.0 node 4 xshift 2.0 from 2.0,2 move c~(\frac{99}{100}) +level 10.0 node 7 xshift -1.0 from 6.0,4 move S payoffs 6 3 +level 10.0 node 8 xshift 1.0 from 6.0,4 move C payoffs 4 4 +iset 6.0,1 6.0,3 player 2 +iset 6.0,2 6.0,4 player 2 diff --git a/catalog/img/bagwell1995.pdf b/catalog/img/bagwell1995.pdf new file mode 100644 index 000000000..66542886c Binary files /dev/null and b/catalog/img/bagwell1995.pdf differ diff --git a/catalog/img/bagwell1995.png b/catalog/img/bagwell1995.png new file mode 100644 index 000000000..4e4dbe0c5 Binary files /dev/null and b/catalog/img/bagwell1995.png differ diff --git a/catalog/img/bagwell1995.tex b/catalog/img/bagwell1995.tex new file mode 100644 index 000000000..261a2bdde --- /dev/null +++ b/catalog/img/bagwell1995.tex @@ -0,0 +1,159 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/bagwell1995.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playertwocolor] (-6,-5.625) arc(90:270:0.375) + -- (2,-6.375) arc(-90:90:0.375) -- cycle; +\draw [color=\playertwocolor] (-2,-5.625) arc(90:270:0.375) + -- (6,-6.375) arc(-90:90:0.375) -- cycle; +%% player 1 name Player~1 +\def\playerone{Player~1} +%% player 2 name Player~2 +\def\playertwo{Player~2} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 0 xshift -4.0 from -2.0,1 move S +\def\playerzero{\small chance} +\draw [line width=\treethickn,color=\playeronecolor] (-4,-2) + -- (0,2); +\draw (-2,0) node[left,yshift=\yup,color=\playeronecolor] {$S$\strut}; +%% level 6.0 node 1 xshift -2.0 from 2.0,1 move s~(\frac{99}{100}) +\draw [line width=\treethickn,color=\chancecolor] (-6,-6) + -- (-4,-2); +\draw (-5,-4) node[left,yshift=\yfracup,color=\chancecolor] {$s~(\frac{99}{100})$\strut}; +%% level 10.0 node 1 xshift -1.0 from 6.0,1 move S payoffs 5 2 +\draw [line width=\treethickn,color=\playertwocolor] (-7,-10) + node[below,yshift=0.1\paydown] {$5$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (-6,-6); +\draw (-6.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$S$\strut}; +%% level 10.0 node 2 xshift 1.0 from 6.0,1 move C payoffs 3 1 +\draw [line width=\treethickn,color=\playertwocolor] (-5,-10) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (-6,-6); +\draw (-5.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% level 6.0 node 2 xshift 2.0 from 2.0,1 move c~(\frac{1}{100}) +\draw [line width=\treethickn,color=\chancecolor] (-2,-6) + -- (-4,-2); +\draw (-3,-4) node[right,yshift=\yfracup,color=\chancecolor] {$c~(\frac{1}{100})$\strut}; +%% level 10.0 node 3 xshift -1.0 from 6.0,2 move S payoffs 5 2 +\draw [line width=\treethickn,color=\playertwocolor] (-3,-10) + node[below,yshift=0.1\paydown] {$5$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (-2,-6); +\draw (-2.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$S$\strut}; +%% level 10.0 node 4 xshift 1.0 from 6.0,2 move C payoffs 3 1 +\draw [line width=\treethickn,color=\playertwocolor] (-1,-10) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (-2,-6); +\draw (-1.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% level 2.0 node 2 player 0 xshift 4.0 from -2.0,1 move C +\draw [line width=\treethickn,color=\playeronecolor] (4,-2) + -- (0,2); +\draw (2,0) node[right,yshift=\yup,color=\playeronecolor] {$C$\strut}; +%% level 6.0 node 3 xshift -2.0 from 2.0,2 move s~(\frac{1}{100}) +\draw [line width=\treethickn,color=\chancecolor] (2,-6) + -- (4,-2); +\draw (3,-4) node[left,yshift=\yfracup,color=\chancecolor] {$s~(\frac{1}{100})$\strut}; +%% level 10.0 node 5 xshift -1.0 from 6.0,3 move S payoffs 6 3 +\draw [line width=\treethickn,color=\playertwocolor] (1,-10) + node[below,yshift=0.1\paydown] {$6$\strut} + node[below,yshift=-0.9\paydown] {$3$\strut} + -- (2,-6); +\draw (1.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$S$\strut}; +%% level 10.0 node 6 xshift 1.0 from 6.0,3 move C payoffs 4 4 +\draw [line width=\treethickn,color=\playertwocolor] (3,-10) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + -- (2,-6); +\draw (2.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% level 6.0 node 4 xshift 2.0 from 2.0,2 move c~(\frac{99}{100}) +\draw [line width=\treethickn,color=\chancecolor] (6,-6) + -- (4,-2); +\draw (5,-4) node[right,yshift=\yfracup,color=\chancecolor] {$c~(\frac{99}{100})$\strut}; +%% level 10.0 node 7 xshift -1.0 from 6.0,4 move S payoffs 6 3 +\draw [line width=\treethickn,color=\playertwocolor] (5,-10) + node[below,yshift=0.1\paydown] {$6$\strut} + node[below,yshift=-0.9\paydown] {$3$\strut} + -- (6,-6); +\draw (5.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$S$\strut}; +%% level 10.0 node 8 xshift 1.0 from 6.0,4 move C payoffs 4 4 +\draw [line width=\treethickn,color=\playertwocolor] (7,-10) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + -- (6,-6); +\draw (6.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% iset 6.0,1 6.0,3 player 2 +%% iset 6.0,2 6.0,4 player 2 +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (-4,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-6,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-2,-6) {}; +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (4,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (2,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (6,-6) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-8.5,2.0)}] +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {\small chance}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Player~1}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Player~2}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/myerson1991/fig2_1.ef b/catalog/img/myerson1991/fig2_1.ef new file mode 100644 index 000000000..42cea3903 --- /dev/null +++ b/catalog/img/myerson1991/fig2_1.ef @@ -0,0 +1,14 @@ +player 1 name Fred +player 2 name Alice +level -2.0 node 1 player 0 +level 2.0 node 1 player 1 xshift -3.0 from -2.0,1 move Red~(\frac{1}{2}) +level 6.0 node 1 xshift -1.5 from 2.0,1 move Raise +level 10.0 node 1 xshift -1.0 from 6.0,1 move Meet payoffs 2 -2 +level 10.0 node 2 xshift 1.0 from 6.0,1 move Pass payoffs 1 -1 +level 10.0 node 3 xshift 1.5 from 2.0,1 move Fold payoffs 1 -1 +level 2.0 node 2 player 1 xshift 3.0 from -2.0,1 move Black~(\frac{1}{2}) +level 6.0 node 2 xshift -1.5 from 2.0,2 move Raise +level 10.0 node 4 xshift -1.0 from 6.0,2 move Meet payoffs -2 2 +level 10.0 node 5 xshift 1.0 from 6.0,2 move Pass payoffs 1 -1 +level 10.0 node 6 xshift 1.5 from 2.0,2 move Fold payoffs -1 1 +iset 6.0,1 6.0,2 player 2 diff --git a/catalog/img/myerson1991/fig2_1.pdf b/catalog/img/myerson1991/fig2_1.pdf new file mode 100644 index 000000000..e462c2410 Binary files /dev/null and b/catalog/img/myerson1991/fig2_1.pdf differ diff --git a/catalog/img/myerson1991/fig2_1.png b/catalog/img/myerson1991/fig2_1.png new file mode 100644 index 000000000..a75cbddf3 Binary files /dev/null and b/catalog/img/myerson1991/fig2_1.png differ diff --git a/catalog/img/myerson1991/fig2_1.tex b/catalog/img/myerson1991/fig2_1.tex new file mode 100644 index 000000000..ec257b11c --- /dev/null +++ b/catalog/img/myerson1991/fig2_1.tex @@ -0,0 +1,134 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/myerson1991/fig2_1.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playertwocolor] (-4.5,-5.625) arc(90:270:0.375) + -- (1.5,-6.375) arc(-90:90:0.375) -- cycle; +%% player 1 name Fred +\def\playerone{Fred} +%% player 2 name Alice +\def\playertwo{Alice} +%% level -2.0 node 1 player 0 +\def\playerzero{\small chance} +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 1 xshift -3.0 from -2.0,1 move Red~(\frac{1}{2}) +\draw [line width=\treethickn,color=\chancecolor] (-3,-2) + -- (0,2); +\draw (-1.5,0) node[left,yshift=\yfracup,color=\chancecolor] {$Red~(\frac{1}{2})$\strut}; +%% level 6.0 node 1 xshift -1.5 from 2.0,1 move Raise +\draw [line width=\treethickn,color=\playeronecolor] (-4.5,-6) + -- (-3,-2); +\draw (-3.75,-4) node[left,yshift=\yup,color=\playeronecolor] {$Raise$\strut}; +%% level 10.0 node 1 xshift -1.0 from 6.0,1 move Meet payoffs 2 -2 +\draw [line width=\treethickn,color=\playertwocolor] (-5.5,-10) + node[below,yshift=0.1\paydown] {$2$\strut} + node[below,yshift=-0.9\paydown] {$-2{\phantom-}$\strut} + -- (-4.5,-6); +\draw (-5,-8) node[left,yshift=\yup,color=\playertwocolor] {$Meet$\strut}; +%% level 10.0 node 2 xshift 1.0 from 6.0,1 move Pass payoffs 1 -1 +\draw [line width=\treethickn,color=\playertwocolor] (-3.5,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$-1{\phantom-}$\strut} + -- (-4.5,-6); +\draw (-4,-8) node[right,yshift=\yup,color=\playertwocolor] {$Pass$\strut}; +%% level 10.0 node 3 xshift 1.5 from 2.0,1 move Fold payoffs 1 -1 +\draw [line width=\treethickn,color=\playeronecolor] (-1.5,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$-1{\phantom-}$\strut} + -- (-3,-2); +\draw (-2.25,-6) node[right,yshift=\yup,color=\playeronecolor] {$Fold$\strut}; +%% level 2.0 node 2 player 1 xshift 3.0 from -2.0,1 move Black~(\frac{1}{2}) +\draw [line width=\treethickn,color=\chancecolor] (3,-2) + -- (0,2); +\draw (1.5,0) node[right,yshift=\yfracup,color=\chancecolor] {$Black~(\frac{1}{2})$\strut}; +%% level 6.0 node 2 xshift -1.5 from 2.0,2 move Raise +\draw [line width=\treethickn,color=\playeronecolor] (1.5,-6) + -- (3,-2); +\draw (2.25,-4) node[left,yshift=\yup,color=\playeronecolor] {$Raise$\strut}; +%% level 10.0 node 4 xshift -1.0 from 6.0,2 move Meet payoffs -2 2 +\draw [line width=\treethickn,color=\playertwocolor] (0.5,-10) + node[below,yshift=0.1\paydown] {$-2{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (1.5,-6); +\draw (1,-8) node[left,yshift=\yup,color=\playertwocolor] {$Meet$\strut}; +%% level 10.0 node 5 xshift 1.0 from 6.0,2 move Pass payoffs 1 -1 +\draw [line width=\treethickn,color=\playertwocolor] (2.5,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$-1{\phantom-}$\strut} + -- (1.5,-6); +\draw (2,-8) node[right,yshift=\yup,color=\playertwocolor] {$Pass$\strut}; +%% level 10.0 node 6 xshift 1.5 from 2.0,2 move Fold payoffs -1 1 +\draw [line width=\treethickn,color=\playeronecolor] (4.5,-10) + node[below,yshift=0.1\paydown] {$-1{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (3,-2); +\draw (3.75,-6) node[right,yshift=\yup,color=\playeronecolor] {$Fold$\strut}; +%% iset 6.0,1 6.0,2 player 2 +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (-3,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-4.5,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (3,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (1.5,-6) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-7.0,2.0)}] +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {\small chance}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Fred}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Alice}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/myerson1991/fig4_2.ef b/catalog/img/myerson1991/fig4_2.ef new file mode 100644 index 000000000..d3838f531 --- /dev/null +++ b/catalog/img/myerson1991/fig4_2.ef @@ -0,0 +1,15 @@ +player 1 name Player~1 +player 2 name Player~2 +level -2.0 node 1 player 1 +level 2.0 node 1 xshift -3.0 from -2.0,1 move A1 +level 6.0 node 1 xshift -2.0 from 2.0,1 move W2 +level 10.0 node 1 xshift -1.0 from 6.0,1 move Y1 payoffs 3 0 +level 10.0 node 2 xshift 1.0 from 6.0,1 move Z1 payoffs 0 0 +level 6.0 node 2 xshift 2.0 from 2.0,1 move X2 +level 10.0 node 3 xshift -1.0 from 6.0,2 move Y1 payoffs 2 3 +level 10.0 node 4 xshift 1.0 from 6.0,2 move Z1 payoffs 4 1 +level 2.0 node 2 xshift 3.0 from -2.0,1 move B1 +level 10.0 node 5 xshift -1.0 from 2.0,2 move W2 payoffs 2 3 +level 10.0 node 6 xshift 1.0 from 2.0,2 move X2 payoffs 3 2 +iset 2.0,1 2.0,2 player 2 +iset 6.0,1 6.0,2 player 1 diff --git a/catalog/img/myerson1991/fig4_2.pdf b/catalog/img/myerson1991/fig4_2.pdf new file mode 100644 index 000000000..15fff36bc Binary files /dev/null and b/catalog/img/myerson1991/fig4_2.pdf differ diff --git a/catalog/img/myerson1991/fig4_2.png b/catalog/img/myerson1991/fig4_2.png new file mode 100644 index 000000000..6aa7cc2aa Binary files /dev/null and b/catalog/img/myerson1991/fig4_2.png differ diff --git a/catalog/img/myerson1991/fig4_2.tex b/catalog/img/myerson1991/fig4_2.tex new file mode 100644 index 000000000..da13f9a35 --- /dev/null +++ b/catalog/img/myerson1991/fig4_2.tex @@ -0,0 +1,134 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/myerson1991/fig4_2.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playertwocolor] (-3,-1.625) arc(90:270:0.375) + -- (3,-2.375) arc(-90:90:0.375) -- cycle; +\draw [color=\playeronecolor] (-5,-5.625) arc(90:270:0.375) + -- (-1,-6.375) arc(-90:90:0.375) -- cycle; +%% player 1 name Player~1 +\def\playerone{Player~1} +%% player 2 name Player~2 +\def\playertwo{Player~2} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 xshift -3.0 from -2.0,1 move A1 +\draw [line width=\treethickn,color=\playeronecolor] (-3,-2) + -- (0,2); +\draw (-1.5,0) node[left,yshift=\yup,color=\playeronecolor] {$A1$\strut}; +%% level 6.0 node 1 xshift -2.0 from 2.0,1 move W2 +\draw [line width=\treethickn,color=\playertwocolor] (-5,-6) + -- (-3,-2); +\draw (-4,-4) node[left,yshift=\yup,color=\playertwocolor] {$W2$\strut}; +%% level 10.0 node 1 xshift -1.0 from 6.0,1 move Y1 payoffs 3 0 +\draw [line width=\treethickn,color=\playeronecolor] (-6,-10) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (-5,-6); +\draw (-5.5,-8) node[left,yshift=\yup,color=\playeronecolor] {$Y1$\strut}; +%% level 10.0 node 2 xshift 1.0 from 6.0,1 move Z1 payoffs 0 0 +\draw [line width=\treethickn,color=\playeronecolor] (-4,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (-5,-6); +\draw (-4.5,-8) node[right,yshift=\yup,color=\playeronecolor] {$Z1$\strut}; +%% level 6.0 node 2 xshift 2.0 from 2.0,1 move X2 +\draw [line width=\treethickn,color=\playertwocolor] (-1,-6) + -- (-3,-2); +\draw (-2,-4) node[right,yshift=\yup,color=\playertwocolor] {$X2$\strut}; +%% level 10.0 node 3 xshift -1.0 from 6.0,2 move Y1 payoffs 2 3 +\draw [line width=\treethickn,color=\playeronecolor] (-2,-10) + node[below,yshift=0.1\paydown] {$2$\strut} + node[below,yshift=-0.9\paydown] {$3$\strut} + -- (-1,-6); +\draw (-1.5,-8) node[left,yshift=\yup,color=\playeronecolor] {$Y1$\strut}; +%% level 10.0 node 4 xshift 1.0 from 6.0,2 move Z1 payoffs 4 1 +\draw [line width=\treethickn,color=\playeronecolor] (0,-10) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (-1,-6); +\draw (-0.5,-8) node[right,yshift=\yup,color=\playeronecolor] {$Z1$\strut}; +%% level 2.0 node 2 xshift 3.0 from -2.0,1 move B1 +\draw [line width=\treethickn,color=\playeronecolor] (3,-2) + -- (0,2); +\draw (1.5,0) node[right,yshift=\yup,color=\playeronecolor] {$B1$\strut}; +%% level 10.0 node 5 xshift -1.0 from 2.0,2 move W2 payoffs 2 3 +\draw [line width=\treethickn,color=\playertwocolor] (2,-10) + node[below,yshift=0.1\paydown] {$2$\strut} + node[below,yshift=-0.9\paydown] {$3$\strut} + -- (3,-2); +\draw (2.5,-6) node[left,yshift=\yup,color=\playertwocolor] {$W2$\strut}; +%% level 10.0 node 6 xshift 1.0 from 2.0,2 move X2 payoffs 3 2 +\draw [line width=\treethickn,color=\playertwocolor] (4,-10) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (3,-2); +\draw (3.5,-6) node[right,yshift=\yup,color=\playertwocolor] {$X2$\strut}; +%% iset 2.0,1 2.0,2 player 2 +%% iset 6.0,1 6.0,2 player 1 +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-3,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (-5,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (-1,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (3,-2) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-7.5,2.0)}] +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {Player~1}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Player~2}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/one_shot_trust.ef b/catalog/img/one_shot_trust.ef new file mode 100644 index 000000000..6a5842469 --- /dev/null +++ b/catalog/img/one_shot_trust.ef @@ -0,0 +1,7 @@ +player 1 name Buyer +player 2 name Seller +level -2.0 node 1 player 1 +level 2.0 node 1 player 2 xshift -1.5 from -2.0,1 move Trust +level 6.0 node 1 xshift -1.0 from 2.0,1 move Honor payoffs 1 1 +level 6.0 node 2 xshift 1.0 from 2.0,1 move Abuse payoffs -1 2 +level 6.0 node 3 xshift 1.5 from -2.0,1 move Not~trust payoffs 0 0 diff --git a/catalog/img/one_shot_trust.pdf b/catalog/img/one_shot_trust.pdf new file mode 100644 index 000000000..2918939ef Binary files /dev/null and b/catalog/img/one_shot_trust.pdf differ diff --git a/catalog/img/one_shot_trust.png b/catalog/img/one_shot_trust.png new file mode 100644 index 000000000..bfbc80170 Binary files /dev/null and b/catalog/img/one_shot_trust.png differ diff --git a/catalog/img/one_shot_trust.tex b/catalog/img/one_shot_trust.tex new file mode 100644 index 000000000..bf6e4a7d1 --- /dev/null +++ b/catalog/img/one_shot_trust.tex @@ -0,0 +1,95 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/one_shot_trust.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +%% player 1 name Buyer +\def\playerone{Buyer} +%% player 2 name Seller +\def\playertwo{Seller} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 2 xshift -1.5 from -2.0,1 move Trust +\draw [line width=\treethickn,color=\playeronecolor] (-1.5,-2) + -- (0,2); +\draw (-0.75,0) node[left,yshift=\yup,color=\playeronecolor] {$Trust$\strut}; +%% level 6.0 node 1 xshift -1.0 from 2.0,1 move Honor payoffs 1 1 +\draw [line width=\treethickn,color=\playertwocolor] (-2.5,-6) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (-1.5,-2); +\draw (-2,-4) node[left,yshift=\yup,color=\playertwocolor] {$Honor$\strut}; +%% level 6.0 node 2 xshift 1.0 from 2.0,1 move Abuse payoffs -1 2 +\draw [line width=\treethickn,color=\playertwocolor] (-0.5,-6) + node[below,yshift=0.1\paydown] {$-1{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (-1.5,-2); +\draw (-1,-4) node[right,yshift=\yup,color=\playertwocolor] {$Abuse$\strut}; +%% level 6.0 node 3 xshift 1.5 from -2.0,1 move Not~trust payoffs 0 0 +\draw [line width=\treethickn,color=\playeronecolor] (1.5,-6) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (0,2); +\draw (0.75,-2) node[right,yshift=\yup,color=\playeronecolor] {$Not~trust$\strut}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-1.5,-2) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-4.0,2.0)}] +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {Buyer}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Seller}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/oneshot_trust_unique_NE.ef b/catalog/img/oneshot_trust_unique_NE.ef new file mode 100644 index 000000000..ffef1e816 --- /dev/null +++ b/catalog/img/oneshot_trust_unique_NE.ef @@ -0,0 +1,7 @@ +player 1 name Buyer +player 2 name Seller +level -2.0 node 1 player 1 +level 2.0 node 1 player 2 xshift -1.5 from -2.0,1 move Trust +level 6.0 node 1 xshift -1.0 from 2.0,1 move Honor payoffs 1 1 +level 6.0 node 2 xshift 1.0 from 2.0,1 move Abuse payoffs 1/2 2 +level 6.0 node 3 xshift 1.5 from -2.0,1 move Not~trust payoffs 0 0 diff --git a/catalog/img/oneshot_trust_unique_NE.pdf b/catalog/img/oneshot_trust_unique_NE.pdf new file mode 100644 index 000000000..41d9d7db3 Binary files /dev/null and b/catalog/img/oneshot_trust_unique_NE.pdf differ diff --git a/catalog/img/oneshot_trust_unique_NE.png b/catalog/img/oneshot_trust_unique_NE.png new file mode 100644 index 000000000..11e859e2a Binary files /dev/null and b/catalog/img/oneshot_trust_unique_NE.png differ diff --git a/catalog/img/oneshot_trust_unique_NE.tex b/catalog/img/oneshot_trust_unique_NE.tex new file mode 100644 index 000000000..e97ea2edc --- /dev/null +++ b/catalog/img/oneshot_trust_unique_NE.tex @@ -0,0 +1,95 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/oneshot_trust_unique_NE.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +%% player 1 name Buyer +\def\playerone{Buyer} +%% player 2 name Seller +\def\playertwo{Seller} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 2 xshift -1.5 from -2.0,1 move Trust +\draw [line width=\treethickn,color=\playeronecolor] (-1.5,-2) + -- (0,2); +\draw (-0.75,0) node[left,yshift=\yup,color=\playeronecolor] {$Trust$\strut}; +%% level 6.0 node 1 xshift -1.0 from 2.0,1 move Honor payoffs 1 1 +\draw [line width=\treethickn,color=\playertwocolor] (-2.5,-6) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (-1.5,-2); +\draw (-2,-4) node[left,yshift=\yup,color=\playertwocolor] {$Honor$\strut}; +%% level 6.0 node 2 xshift 1.0 from 2.0,1 move Abuse payoffs 1/2 2 +\draw [line width=\treethickn,color=\playertwocolor] (-0.5,-6) + node[below,yshift=0.1\paydown] {$1/2$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (-1.5,-2); +\draw (-1,-4) node[right,yshift=\yup,color=\playertwocolor] {$Abuse$\strut}; +%% level 6.0 node 3 xshift 1.5 from -2.0,1 move Not~trust payoffs 0 0 +\draw [line width=\treethickn,color=\playeronecolor] (1.5,-6) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (0,2); +\draw (0.75,-2) node[right,yshift=\yup,color=\playeronecolor] {$Not~trust$\strut}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-1.5,-2) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-4.0,2.0)}] +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {Buyer}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Seller}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/reiley2008/fig1.ef b/catalog/img/reiley2008/fig1.ef new file mode 100644 index 000000000..1f7f97b96 --- /dev/null +++ b/catalog/img/reiley2008/fig1.ef @@ -0,0 +1,14 @@ +player 1 name Professor +player 2 name Student +level -2.0 node 1 player 0 +level 2.0 node 1 player 1 xshift -3.0 from -2.0,1 move King~(\frac{1}{2}) +level 6.0 node 1 xshift -1.5 from 2.0,1 move Bet +level 10.0 node 1 xshift -1.0 from 6.0,1 move Call payoffs 2 -2 +level 10.0 node 2 xshift 1.0 from 6.0,1 move Fold payoffs 1 -1 +level 10.0 node 3 xshift 1.5 from 2.0,1 move Fold payoffs -1 1 +level 2.0 node 2 player 1 xshift 3.0 from -2.0,1 move Queen~(\frac{1}{2}) +level 6.0 node 2 xshift -1.5 from 2.0,2 move Bet +level 10.0 node 4 xshift -1.0 from 6.0,2 move Call payoffs -2 2 +level 10.0 node 5 xshift 1.0 from 6.0,2 move Fold payoffs 1 -1 +level 10.0 node 6 xshift 1.5 from 2.0,2 move Fold payoffs -1 1 +iset 6.0,1 6.0,2 player 2 diff --git a/catalog/img/reiley2008/fig1.pdf b/catalog/img/reiley2008/fig1.pdf new file mode 100644 index 000000000..5cba86551 Binary files /dev/null and b/catalog/img/reiley2008/fig1.pdf differ diff --git a/catalog/img/reiley2008/fig1.png b/catalog/img/reiley2008/fig1.png new file mode 100644 index 000000000..178acef8a Binary files /dev/null and b/catalog/img/reiley2008/fig1.png differ diff --git a/catalog/img/reiley2008/fig1.tex b/catalog/img/reiley2008/fig1.tex new file mode 100644 index 000000000..bd7141786 --- /dev/null +++ b/catalog/img/reiley2008/fig1.tex @@ -0,0 +1,134 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/reiley2008/fig1.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playertwocolor] (-4.5,-5.625) arc(90:270:0.375) + -- (1.5,-6.375) arc(-90:90:0.375) -- cycle; +%% player 1 name Professor +\def\playerone{Professor} +%% player 2 name Student +\def\playertwo{Student} +%% level -2.0 node 1 player 0 +\def\playerzero{\small chance} +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 1 xshift -3.0 from -2.0,1 move King~(\frac{1}{2}) +\draw [line width=\treethickn,color=\chancecolor] (-3,-2) + -- (0,2); +\draw (-1.5,0) node[left,yshift=\yfracup,color=\chancecolor] {$King~(\frac{1}{2})$\strut}; +%% level 6.0 node 1 xshift -1.5 from 2.0,1 move Bet +\draw [line width=\treethickn,color=\playeronecolor] (-4.5,-6) + -- (-3,-2); +\draw (-3.75,-4) node[left,yshift=\yup,color=\playeronecolor] {$Bet$\strut}; +%% level 10.0 node 1 xshift -1.0 from 6.0,1 move Call payoffs 2 -2 +\draw [line width=\treethickn,color=\playertwocolor] (-5.5,-10) + node[below,yshift=0.1\paydown] {$2$\strut} + node[below,yshift=-0.9\paydown] {$-2{\phantom-}$\strut} + -- (-4.5,-6); +\draw (-5,-8) node[left,yshift=\yup,color=\playertwocolor] {$Call$\strut}; +%% level 10.0 node 2 xshift 1.0 from 6.0,1 move Fold payoffs 1 -1 +\draw [line width=\treethickn,color=\playertwocolor] (-3.5,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$-1{\phantom-}$\strut} + -- (-4.5,-6); +\draw (-4,-8) node[right,yshift=\yup,color=\playertwocolor] {$Fold$\strut}; +%% level 10.0 node 3 xshift 1.5 from 2.0,1 move Fold payoffs -1 1 +\draw [line width=\treethickn,color=\playeronecolor] (-1.5,-10) + node[below,yshift=0.1\paydown] {$-1{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (-3,-2); +\draw (-2.25,-6) node[right,yshift=\yup,color=\playeronecolor] {$Fold$\strut}; +%% level 2.0 node 2 player 1 xshift 3.0 from -2.0,1 move Queen~(\frac{1}{2}) +\draw [line width=\treethickn,color=\chancecolor] (3,-2) + -- (0,2); +\draw (1.5,0) node[right,yshift=\yfracup,color=\chancecolor] {$Queen~(\frac{1}{2})$\strut}; +%% level 6.0 node 2 xshift -1.5 from 2.0,2 move Bet +\draw [line width=\treethickn,color=\playeronecolor] (1.5,-6) + -- (3,-2); +\draw (2.25,-4) node[left,yshift=\yup,color=\playeronecolor] {$Bet$\strut}; +%% level 10.0 node 4 xshift -1.0 from 6.0,2 move Call payoffs -2 2 +\draw [line width=\treethickn,color=\playertwocolor] (0.5,-10) + node[below,yshift=0.1\paydown] {$-2{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (1.5,-6); +\draw (1,-8) node[left,yshift=\yup,color=\playertwocolor] {$Call$\strut}; +%% level 10.0 node 5 xshift 1.0 from 6.0,2 move Fold payoffs 1 -1 +\draw [line width=\treethickn,color=\playertwocolor] (2.5,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$-1{\phantom-}$\strut} + -- (1.5,-6); +\draw (2,-8) node[right,yshift=\yup,color=\playertwocolor] {$Fold$\strut}; +%% level 10.0 node 6 xshift 1.5 from 2.0,2 move Fold payoffs -1 1 +\draw [line width=\treethickn,color=\playeronecolor] (4.5,-10) + node[below,yshift=0.1\paydown] {$-1{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (3,-2); +\draw (3.75,-6) node[right,yshift=\yup,color=\playeronecolor] {$Fold$\strut}; +%% iset 6.0,1 6.0,2 player 2 +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (-3,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-4.5,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (3,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (1.5,-6) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-7.0,2.0)}] +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {\small chance}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Professor}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Student}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/selten1975/fig1.ef b/catalog/img/selten1975/fig1.ef new file mode 100644 index 000000000..32f7227d8 --- /dev/null +++ b/catalog/img/selten1975/fig1.ef @@ -0,0 +1,13 @@ +player 1 name Player~1 +player 2 name Player~2 +player 3 name Player~3 +level -2.0 node 1 player 1 +level 2.0 node 1 player 2 xshift -2.75 from -2.0,1 move R +level 10.0 node 1 xshift -1.5 from 2.0,1 move R payoffs 1 1 1 +level 6.0 node 1 xshift 1.5 from 2.0,1 move L +level 10.0 node 2 xshift -1.0 from 6.0,1 move R payoffs 4 4 0 +level 10.0 node 3 xshift 1.0 from 6.0,1 move L payoffs 0 0 1 +level 2.0 node 2 xshift 2.75 from -2.0,1 move L +level 10.0 node 4 xshift -1.0 from 2.0,2 move R payoffs 3 2 2 +level 10.0 node 5 xshift 1.0 from 2.0,2 move L payoffs 0 0 0 +iset 6.0,1 2.0,2 player 3 diff --git a/catalog/img/selten1975/fig1.pdf b/catalog/img/selten1975/fig1.pdf new file mode 100644 index 000000000..b6c9c21ff Binary files /dev/null and b/catalog/img/selten1975/fig1.pdf differ diff --git a/catalog/img/selten1975/fig1.png b/catalog/img/selten1975/fig1.png new file mode 100644 index 000000000..752c0b93e Binary files /dev/null and b/catalog/img/selten1975/fig1.png differ diff --git a/catalog/img/selten1975/fig1.tex b/catalog/img/selten1975/fig1.tex new file mode 100644 index 000000000..2cd67f2bc --- /dev/null +++ b/catalog/img/selten1975/fig1.tex @@ -0,0 +1,129 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/selten1975/fig1.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playerthreecolor] (-1.515,-5.735) arc(135:315:0.375) + -- (3.015,-2.265) arc(-45:135:0.375) -- cycle; +%% player 1 name Player~1 +\def\playerone{Player~1} +%% player 2 name Player~2 +\def\playertwo{Player~2} +%% player 3 name Player~3 +\def\playerthree{Player~3} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 2 xshift -2.75 from -2.0,1 move R +\draw [line width=\treethickn,color=\playeronecolor] (-2.75,-2) + -- (0,2); +\draw (-1.375,0) node[left,yshift=\yup,color=\playeronecolor] {$R$\strut}; +%% level 10.0 node 1 xshift -1.5 from 2.0,1 move R payoffs 1 1 1 +\draw [line width=\treethickn,color=\playertwocolor] (-4.25,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + node[below,yshift=-1.9\paydown] {$1$\strut} + -- (-2.75,-2); +\draw (-3.5,-6) node[left,yshift=\yup,color=\playertwocolor] {$R$\strut}; +%% level 6.0 node 1 xshift 1.5 from 2.0,1 move L +\draw [line width=\treethickn,color=\playertwocolor] (-1.25,-6) + -- (-2.75,-2); +\draw (-2,-4) node[right,yshift=\yup,color=\playertwocolor] {$L$\strut}; +%% level 10.0 node 2 xshift -1.0 from 6.0,1 move R payoffs 4 4 0 +\draw [line width=\treethickn,color=\playerthreecolor] (-2.25,-10) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + node[below,yshift=-1.9\paydown] {$0$\strut} + -- (-1.25,-6); +\draw (-1.75,-8) node[left,yshift=\yup,color=\playerthreecolor] {$R$\strut}; +%% level 10.0 node 3 xshift 1.0 from 6.0,1 move L payoffs 0 0 1 +\draw [line width=\treethickn,color=\playerthreecolor] (-0.25,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + node[below,yshift=-1.9\paydown] {$1$\strut} + -- (-1.25,-6); +\draw (-0.75,-8) node[right,yshift=\yup,color=\playerthreecolor] {$L$\strut}; +%% level 2.0 node 2 xshift 2.75 from -2.0,1 move L +\draw [line width=\treethickn,color=\playeronecolor] (2.75,-2) + -- (0,2); +\draw (1.375,0) node[right,yshift=\yup,color=\playeronecolor] {$L$\strut}; +%% level 10.0 node 4 xshift -1.0 from 2.0,2 move R payoffs 3 2 2 +\draw [line width=\treethickn,color=\playerthreecolor] (1.75,-10) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + node[below,yshift=-1.9\paydown] {$2$\strut} + -- (2.75,-2); +\draw (2.25,-6) node[left,yshift=\yup,color=\playerthreecolor] {$R$\strut}; +%% level 10.0 node 5 xshift 1.0 from 2.0,2 move L payoffs 0 0 0 +\draw [line width=\treethickn,color=\playerthreecolor] (3.75,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + node[below,yshift=-1.9\paydown] {$0$\strut} + -- (2.75,-2); +\draw (3.25,-6) node[right,yshift=\yup,color=\playerthreecolor] {$L$\strut}; +%% iset 6.0,1 2.0,2 player 3 +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-2.75,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playerthreecolor, fill=\playerthreecolor, shape=circle] at (-1.25,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playerthreecolor, fill=\playerthreecolor, shape=circle] at (2.75,-2) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-5.75,2.0)}] +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {Player~1}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Player~2}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playerthreecolor,fill=\playerthreecolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Player~3}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/selten1975/fig2.ef b/catalog/img/selten1975/fig2.ef new file mode 100644 index 000000000..745edde26 --- /dev/null +++ b/catalog/img/selten1975/fig2.ef @@ -0,0 +1,9 @@ +player 1 name Player~1 +player 2 name Player~2 +level -2.0 node 1 player 1 +level 10.0 node 1 xshift -1.75 from -2.0,1 move R payoffs 1 1 +level 2.0 node 1 player 2 xshift 1.75 from -2.0,1 move L +level 10.0 node 2 xshift -1.5 from 2.0,1 move R payoffs 0 2 +level 6.0 node 1 player 1 xshift 1.5 from 2.0,1 move L +level 10.0 node 3 xshift -1.0 from 6.0,1 move r payoffs 0 3 +level 10.0 node 4 xshift 1.0 from 6.0,1 move l payoffs 2 0 diff --git a/catalog/img/selten1975/fig2.pdf b/catalog/img/selten1975/fig2.pdf new file mode 100644 index 000000000..557819469 Binary files /dev/null and b/catalog/img/selten1975/fig2.pdf differ diff --git a/catalog/img/selten1975/fig2.png b/catalog/img/selten1975/fig2.png new file mode 100644 index 000000000..9aac6ceca Binary files /dev/null and b/catalog/img/selten1975/fig2.png differ diff --git a/catalog/img/selten1975/fig2.tex b/catalog/img/selten1975/fig2.tex new file mode 100644 index 000000000..fafc48f7f --- /dev/null +++ b/catalog/img/selten1975/fig2.tex @@ -0,0 +1,106 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/selten1975/fig2.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +%% player 1 name Player~1 +\def\playerone{Player~1} +%% player 2 name Player~2 +\def\playertwo{Player~2} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 10.0 node 1 xshift -1.75 from -2.0,1 move R payoffs 1 1 +\draw [line width=\treethickn,color=\playeronecolor] (-1.75,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (0,2); +\draw (-0.875,-4) node[left,yshift=\yup,color=\playeronecolor] {$R$\strut}; +%% level 2.0 node 1 player 2 xshift 1.75 from -2.0,1 move L +\draw [line width=\treethickn,color=\playeronecolor] (1.75,-2) + -- (0,2); +\draw (0.875,0) node[right,yshift=\yup,color=\playeronecolor] {$L$\strut}; +%% level 10.0 node 2 xshift -1.5 from 2.0,1 move R payoffs 0 2 +\draw [line width=\treethickn,color=\playertwocolor] (0.25,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$2$\strut} + -- (1.75,-2); +\draw (1,-6) node[left,yshift=\yup,color=\playertwocolor] {$R$\strut}; +%% level 6.0 node 1 player 1 xshift 1.5 from 2.0,1 move L +\draw [line width=\treethickn,color=\playertwocolor] (3.25,-6) + -- (1.75,-2); +\draw (2.5,-4) node[right,yshift=\yup,color=\playertwocolor] {$L$\strut}; +%% level 10.0 node 3 xshift -1.0 from 6.0,1 move r payoffs 0 3 +\draw [line width=\treethickn,color=\playeronecolor] (2.25,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$3$\strut} + -- (3.25,-6); +\draw (2.75,-8) node[left,yshift=\yup,color=\playeronecolor] {$r$\strut}; +%% level 10.0 node 4 xshift 1.0 from 6.0,1 move l payoffs 2 0 +\draw [line width=\treethickn,color=\playeronecolor] (4.25,-10) + node[below,yshift=0.1\paydown] {$2$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (3.25,-6); +\draw (3.75,-8) node[right,yshift=\yup,color=\playeronecolor] {$l$\strut}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (1.75,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (3.25,-6) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-3.25,2.0)}] +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {Player~1}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Player~2}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/selten1975/fig3.ef b/catalog/img/selten1975/fig3.ef new file mode 100644 index 000000000..777d2eefc --- /dev/null +++ b/catalog/img/selten1975/fig3.ef @@ -0,0 +1,15 @@ +player 1 name Player~1 +player 2 name Player~2 +player 3 name Player~3 +level -2.0 node 1 player 1 +level 2.0 node 1 xshift -3.625 from -2.0,1 move R +level 14.0 node 1 xshift -1.0 from 2.0,1 move R payoffs 3 0 3 +level 14.0 node 2 xshift 1.0 from 2.0,1 move L payoffs 0 0 0 +level 2.0 node 2 player 2 xshift 3.625 from -2.0,1 move L +level 6.0 node 1 player 1 xshift -1.75 from 2.0,2 move R +level 10.0 node 1 xshift -1.5 from 6.0,1 move R +level 14.0 node 3 xshift -1.0 from 10.0,1 move R payoffs 4 4 0 +level 14.0 node 4 xshift 1.0 from 10.0,1 move L payoffs 0 0 5 +level 14.0 node 5 xshift 1.5 from 6.0,1 move L payoffs 2 0 0 +level 14.0 node 6 xshift 1.75 from 2.0,2 move L payoffs 1 3 0 +iset 2.0,1 10.0,1 player 3 diff --git a/catalog/img/selten1975/fig3.pdf b/catalog/img/selten1975/fig3.pdf new file mode 100644 index 000000000..e42cc0209 Binary files /dev/null and b/catalog/img/selten1975/fig3.pdf differ diff --git a/catalog/img/selten1975/fig3.png b/catalog/img/selten1975/fig3.png new file mode 100644 index 000000000..0522f71ef Binary files /dev/null and b/catalog/img/selten1975/fig3.png differ diff --git a/catalog/img/selten1975/fig3.tex b/catalog/img/selten1975/fig3.tex new file mode 100644 index 000000000..dd82fff0f --- /dev/null +++ b/catalog/img/selten1975/fig3.tex @@ -0,0 +1,141 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/selten1975/fig3.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playerthreecolor] (-3.29,-1.832) arc(26.6:206.6:0.375) + -- (0.04,-10.168) arc(-153.4:26.6:0.375) -- cycle; +%% player 1 name Player~1 +\def\playerone{Player~1} +%% player 2 name Player~2 +\def\playertwo{Player~2} +%% player 3 name Player~3 +\def\playerthree{Player~3} +%% level -2.0 node 1 player 1 +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 xshift -3.625 from -2.0,1 move R +\draw [line width=\treethickn,color=\playeronecolor] (-3.625,-2) + -- (0,2); +\draw (-1.812,0) node[left,yshift=\yup,color=\playeronecolor] {$R$\strut}; +%% level 14.0 node 1 xshift -1.0 from 2.0,1 move R payoffs 3 0 3 +\draw [line width=\treethickn,color=\playerthreecolor] (-4.625,-14) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + node[below,yshift=-1.9\paydown] {$3$\strut} + -- (-3.625,-2); +\draw (-4.125,-8) node[left,yshift=\yup,color=\playerthreecolor] {$R$\strut}; +%% level 14.0 node 2 xshift 1.0 from 2.0,1 move L payoffs 0 0 0 +\draw [line width=\treethickn,color=\playerthreecolor] (-2.625,-14) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + node[below,yshift=-1.9\paydown] {$0$\strut} + -- (-3.625,-2); +\draw (-3.125,-8) node[right,yshift=\yup,color=\playerthreecolor] {$L$\strut}; +%% level 2.0 node 2 player 2 xshift 3.625 from -2.0,1 move L +\draw [line width=\treethickn,color=\playeronecolor] (3.625,-2) + -- (0,2); +\draw (1.812,0) node[right,yshift=\yup,color=\playeronecolor] {$L$\strut}; +%% level 6.0 node 1 player 1 xshift -1.75 from 2.0,2 move R +\draw [line width=\treethickn,color=\playertwocolor] (1.875,-6) + -- (3.625,-2); +\draw (2.75,-4) node[left,yshift=\yup,color=\playertwocolor] {$R$\strut}; +%% level 10.0 node 1 xshift -1.5 from 6.0,1 move R +\draw [line width=\treethickn,color=\playeronecolor] (0.375,-10) + -- (1.875,-6); +\draw (1.125,-8) node[left,yshift=\yup,color=\playeronecolor] {$R$\strut}; +%% level 14.0 node 3 xshift -1.0 from 10.0,1 move R payoffs 4 4 0 +\draw [line width=\treethickn,color=\playerthreecolor] (-0.625,-14) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + node[below,yshift=-1.9\paydown] {$0$\strut} + -- (0.375,-10); +\draw (-0.125,-12) node[left,yshift=\yup,color=\playerthreecolor] {$R$\strut}; +%% level 14.0 node 4 xshift 1.0 from 10.0,1 move L payoffs 0 0 5 +\draw [line width=\treethickn,color=\playerthreecolor] (1.375,-14) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + node[below,yshift=-1.9\paydown] {$5$\strut} + -- (0.375,-10); +\draw (0.875,-12) node[right,yshift=\yup,color=\playerthreecolor] {$L$\strut}; +%% level 14.0 node 5 xshift 1.5 from 6.0,1 move L payoffs 2 0 0 +\draw [line width=\treethickn,color=\playeronecolor] (3.375,-14) + node[below,yshift=0.1\paydown] {$2$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + node[below,yshift=-1.9\paydown] {$0$\strut} + -- (1.875,-6); +\draw (2.625,-10) node[right,yshift=\yup,color=\playeronecolor] {$L$\strut}; +%% level 14.0 node 6 xshift 1.75 from 2.0,2 move L payoffs 1 3 0 +\draw [line width=\treethickn,color=\playertwocolor] (5.375,-14) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$3$\strut} + node[below,yshift=-1.9\paydown] {$0$\strut} + -- (3.625,-2); +\draw (4.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$L$\strut}; +%% iset 2.0,1 10.0,1 player 3 +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playerthreecolor, fill=\playerthreecolor, shape=circle] at (-3.625,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (3.625,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (1.875,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playerthreecolor, fill=\playerthreecolor, shape=circle] at (0.375,-10) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-6.125,2.0)}] +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {Player~1}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Player~2}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playerthreecolor,fill=\playerthreecolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Player~3}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/watson2013/exercise29_6.ef b/catalog/img/watson2013/exercise29_6.ef new file mode 100644 index 000000000..e99afb038 --- /dev/null +++ b/catalog/img/watson2013/exercise29_6.ef @@ -0,0 +1,19 @@ +player 1 name Wesley +player 2 name Prince +level -2.0 node 1 player 0 +level 2.0 node 1 player 1 xshift -4.0 from -2.0,1 move Strong~(\frac{1}{2}) +level 6.0 node 1 xshift -2.0 from 2.0,1 move Up +level 10.0 node 1 xshift -1.0 from 6.0,1 move Surrender payoffs 1 0 +level 10.0 node 2 xshift 1.0 from 6.0,1 move Fight payoffs 0 -2 +level 6.0 node 2 xshift 2.0 from 2.0,1 move Stay +level 10.0 node 3 xshift -1.0 from 6.0,2 move Surrender payoffs 1 0 +level 10.0 node 4 xshift 1.0 from 6.0,2 move Fight payoffs 0 -2 +level 2.0 node 2 player 1 xshift 4.0 from -2.0,1 move Weak~(\frac{1}{2}) +level 6.0 node 3 xshift -2.0 from 2.0,2 move Up +level 10.0 node 5 xshift -1.0 from 6.0,3 move Surrender payoffs -1 0 +level 10.0 node 6 xshift 1.0 from 6.0,3 move Fight payoffs -3 1 +level 6.0 node 4 xshift 2.0 from 2.0,2 move Stay +level 10.0 node 7 xshift -1.0 from 6.0,4 move Surrender payoffs 1 0 +level 10.0 node 8 xshift 1.0 from 6.0,4 move Fight payoffs -1 1 +iset 6.0,1 6.0,3 player 2 +iset 6.0,2 6.0,4 player 2 diff --git a/catalog/img/watson2013/exercise29_6.pdf b/catalog/img/watson2013/exercise29_6.pdf new file mode 100644 index 000000000..0a3028f74 Binary files /dev/null and b/catalog/img/watson2013/exercise29_6.pdf differ diff --git a/catalog/img/watson2013/exercise29_6.png b/catalog/img/watson2013/exercise29_6.png new file mode 100644 index 000000000..9dd1412b3 Binary files /dev/null and b/catalog/img/watson2013/exercise29_6.png differ diff --git a/catalog/img/watson2013/exercise29_6.tex b/catalog/img/watson2013/exercise29_6.tex new file mode 100644 index 000000000..302fa59fe --- /dev/null +++ b/catalog/img/watson2013/exercise29_6.tex @@ -0,0 +1,159 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/watson2013/exercise29_6.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playertwocolor] (-6,-5.625) arc(90:270:0.375) + -- (2,-6.375) arc(-90:90:0.375) -- cycle; +\draw [color=\playertwocolor] (-2,-5.625) arc(90:270:0.375) + -- (6,-6.375) arc(-90:90:0.375) -- cycle; +%% player 1 name Wesley +\def\playerone{Wesley} +%% player 2 name Prince +\def\playertwo{Prince} +%% level -2.0 node 1 player 0 +\def\playerzero{\small chance} +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 1 xshift -4.0 from -2.0,1 move Strong~(\frac{1}{2}) +\draw [line width=\treethickn,color=\chancecolor] (-4,-2) + -- (0,2); +\draw (-2,0) node[left,yshift=\yfracup,color=\chancecolor] {$Strong~(\frac{1}{2})$\strut}; +%% level 6.0 node 1 xshift -2.0 from 2.0,1 move Up +\draw [line width=\treethickn,color=\playeronecolor] (-6,-6) + -- (-4,-2); +\draw (-5,-4) node[left,yshift=\yup,color=\playeronecolor] {$Up$\strut}; +%% level 10.0 node 1 xshift -1.0 from 6.0,1 move Surrender payoffs 1 0 +\draw [line width=\treethickn,color=\playertwocolor] (-7,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (-6,-6); +\draw (-6.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$Surrender$\strut}; +%% level 10.0 node 2 xshift 1.0 from 6.0,1 move Fight payoffs 0 -2 +\draw [line width=\treethickn,color=\playertwocolor] (-5,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$-2{\phantom-}$\strut} + -- (-6,-6); +\draw (-5.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$Fight$\strut}; +%% level 6.0 node 2 xshift 2.0 from 2.0,1 move Stay +\draw [line width=\treethickn,color=\playeronecolor] (-2,-6) + -- (-4,-2); +\draw (-3,-4) node[right,yshift=\yup,color=\playeronecolor] {$Stay$\strut}; +%% level 10.0 node 3 xshift -1.0 from 6.0,2 move Surrender payoffs 1 0 +\draw [line width=\treethickn,color=\playertwocolor] (-3,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (-2,-6); +\draw (-2.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$Surrender$\strut}; +%% level 10.0 node 4 xshift 1.0 from 6.0,2 move Fight payoffs 0 -2 +\draw [line width=\treethickn,color=\playertwocolor] (-1,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$-2{\phantom-}$\strut} + -- (-2,-6); +\draw (-1.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$Fight$\strut}; +%% level 2.0 node 2 player 1 xshift 4.0 from -2.0,1 move Weak~(\frac{1}{2}) +\draw [line width=\treethickn,color=\chancecolor] (4,-2) + -- (0,2); +\draw (2,0) node[right,yshift=\yfracup,color=\chancecolor] {$Weak~(\frac{1}{2})$\strut}; +%% level 6.0 node 3 xshift -2.0 from 2.0,2 move Up +\draw [line width=\treethickn,color=\playeronecolor] (2,-6) + -- (4,-2); +\draw (3,-4) node[left,yshift=\yup,color=\playeronecolor] {$Up$\strut}; +%% level 10.0 node 5 xshift -1.0 from 6.0,3 move Surrender payoffs -1 0 +\draw [line width=\treethickn,color=\playertwocolor] (1,-10) + node[below,yshift=0.1\paydown] {$-1{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (2,-6); +\draw (1.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$Surrender$\strut}; +%% level 10.0 node 6 xshift 1.0 from 6.0,3 move Fight payoffs -3 1 +\draw [line width=\treethickn,color=\playertwocolor] (3,-10) + node[below,yshift=0.1\paydown] {$-3{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (2,-6); +\draw (2.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$Fight$\strut}; +%% level 6.0 node 4 xshift 2.0 from 2.0,2 move Stay +\draw [line width=\treethickn,color=\playeronecolor] (6,-6) + -- (4,-2); +\draw (5,-4) node[right,yshift=\yup,color=\playeronecolor] {$Stay$\strut}; +%% level 10.0 node 7 xshift -1.0 from 6.0,4 move Surrender payoffs 1 0 +\draw [line width=\treethickn,color=\playertwocolor] (5,-10) + node[below,yshift=0.1\paydown] {$1$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (6,-6); +\draw (5.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$Surrender$\strut}; +%% level 10.0 node 8 xshift 1.0 from 6.0,4 move Fight payoffs -1 1 +\draw [line width=\treethickn,color=\playertwocolor] (7,-10) + node[below,yshift=0.1\paydown] {$-1{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$1$\strut} + -- (6,-6); +\draw (6.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$Fight$\strut}; +%% iset 6.0,1 6.0,3 player 2 +%% iset 6.0,2 6.0,4 player 2 +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (-4,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-6,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-2,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (4,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (2,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (6,-6) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-8.5,2.0)}] +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {\small chance}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {Wesley}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Prince}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/img/watson2013/fig29_1.ef b/catalog/img/watson2013/fig29_1.ef new file mode 100644 index 000000000..6dbb66d0f --- /dev/null +++ b/catalog/img/watson2013/fig29_1.ef @@ -0,0 +1,19 @@ +player 1 name You +player 2 name Firm +level -2.0 node 1 player 0 +level 2.0 node 1 player 1 xshift -4.0 from -2.0,1 move High~(\frac{1}{3}) +level 6.0 node 1 xshift -2.0 from 2.0,1 move E +level 10.0 node 1 xshift -1.0 from 6.0,1 move M payoffs 6 10 +level 10.0 node 2 xshift 1.0 from 6.0,1 move C payoffs 0 4 +level 6.0 node 2 xshift 2.0 from 2.0,1 move N +level 10.0 node 3 xshift -1.0 from 6.0,2 move M payoffs 10 10 +level 10.0 node 4 xshift 1.0 from 6.0,2 move C payoffs 4 4 +level 2.0 node 2 player 1 xshift 4.0 from -2.0,1 move Low~(\frac{2}{3}) +level 6.0 node 3 xshift -2.0 from 2.0,2 move E +level 10.0 node 5 xshift -1.0 from 6.0,3 move M payoffs 3 0 +level 10.0 node 6 xshift 1.0 from 6.0,3 move C payoffs -3 4 +level 6.0 node 4 xshift 2.0 from 2.0,2 move N +level 10.0 node 7 xshift -1.0 from 6.0,4 move M payoffs 10 0 +level 10.0 node 8 xshift 1.0 from 6.0,4 move C payoffs 4 4 +iset 6.0,1 6.0,3 player 2 +iset 6.0,2 6.0,4 player 2 diff --git a/catalog/img/watson2013/fig29_1.pdf b/catalog/img/watson2013/fig29_1.pdf new file mode 100644 index 000000000..6364013b9 Binary files /dev/null and b/catalog/img/watson2013/fig29_1.pdf differ diff --git a/catalog/img/watson2013/fig29_1.png b/catalog/img/watson2013/fig29_1.png new file mode 100644 index 000000000..13d3979a8 Binary files /dev/null and b/catalog/img/watson2013/fig29_1.png differ diff --git a/catalog/img/watson2013/fig29_1.tex b/catalog/img/watson2013/fig29_1.tex new file mode 100644 index 000000000..c07d8a3fa --- /dev/null +++ b/catalog/img/watson2013/fig29_1.tex @@ -0,0 +1,159 @@ +\documentclass[tikz,border=10pt]{standalone} + \usepackage{newpxtext,newpxmath} + \linespread{1.10} + \usetikzlibrary{shapes} + \usetikzlibrary{arrows.meta} + + \begin{document} + + % TikZ code with built-in styling for game trees +% TikZ libraries required for game trees +\usetikzlibrary{shapes} +\usetikzlibrary{arrows.meta} + +% Style settings for game tree formatting +\tikzset{ + every node/.append style={font=\rmfamily}, + every text node part/.append style={align=center}, + node distance=1.5mm, + thick +} + +% Built-in macro definitions for game tree drawing +\newdimen\ndiam +\ndiam1.5mm +\newdimen\sqwidth +\sqwidth1.6mm +\newdimen\spx +\spx.7mm +\newdimen\spy +\spy.5mm +\newdimen\yup +\yup0.5mm +\newdimen\yfracup +\yfracup1mm +\newdimen\paydown +\paydown2.5ex +\newdimen\treethickn +\treethickn1.0pt +\definecolor{chancecolorrgb}{RGB}{117,145,56} +\definecolor{gambitredrgb}{RGB}{234,51,35} +\newcommand\chancecolor{chancecolorrgb} +\newcommand\playeronecolor{gambitredrgb} +\newcommand\playertwocolor{blue} +\newcommand\playerthreecolor{orange} +\newcommand\playerfourcolor{purple} +\newcommand\playerfivecolor{cyan} +\newcommand\playersixcolor{magenta} + +% Game tree content from /Users/echalstrey/projects/gambit/catalog/img/watson2013/fig29_1.ef +\begin{tikzpicture}[scale=0.8 + , StealthFill/.tip={Stealth[line width=.7pt,inset=0pt,length=13pt,angle'=30]}] +% \draw [help lines, color=green] (-5,0) grid (5,-6); +\draw [color=\playertwocolor] (-6,-5.625) arc(90:270:0.375) + -- (2,-6.375) arc(-90:90:0.375) -- cycle; +\draw [color=\playertwocolor] (-2,-5.625) arc(90:270:0.375) + -- (6,-6.375) arc(-90:90:0.375) -- cycle; +%% player 1 name You +\def\playerone{You} +%% player 2 name Firm +\def\playertwo{Firm} +%% level -2.0 node 1 player 0 +\def\playerzero{\small chance} +\draw [line width=\treethickn] (0,2) + ; +%% level 2.0 node 1 player 1 xshift -4.0 from -2.0,1 move High~(\frac{1}{3}) +\draw [line width=\treethickn,color=\chancecolor] (-4,-2) + -- (0,2); +\draw (-2,0) node[left,yshift=\yfracup,color=\chancecolor] {$High~(\frac{1}{3})$\strut}; +%% level 6.0 node 1 xshift -2.0 from 2.0,1 move E +\draw [line width=\treethickn,color=\playeronecolor] (-6,-6) + -- (-4,-2); +\draw (-5,-4) node[left,yshift=\yup,color=\playeronecolor] {$E$\strut}; +%% level 10.0 node 1 xshift -1.0 from 6.0,1 move M payoffs 6 10 +\draw [line width=\treethickn,color=\playertwocolor] (-7,-10) + node[below,yshift=0.1\paydown] {$6$\strut} + node[below,yshift=-0.9\paydown] {$10$\strut} + -- (-6,-6); +\draw (-6.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$M$\strut}; +%% level 10.0 node 2 xshift 1.0 from 6.0,1 move C payoffs 0 4 +\draw [line width=\treethickn,color=\playertwocolor] (-5,-10) + node[below,yshift=0.1\paydown] {$0$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + -- (-6,-6); +\draw (-5.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% level 6.0 node 2 xshift 2.0 from 2.0,1 move N +\draw [line width=\treethickn,color=\playeronecolor] (-2,-6) + -- (-4,-2); +\draw (-3,-4) node[right,yshift=\yup,color=\playeronecolor] {$N$\strut}; +%% level 10.0 node 3 xshift -1.0 from 6.0,2 move M payoffs 10 10 +\draw [line width=\treethickn,color=\playertwocolor] (-3,-10) + node[below,yshift=0.1\paydown] {$10$\strut} + node[below,yshift=-0.9\paydown] {$10$\strut} + -- (-2,-6); +\draw (-2.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$M$\strut}; +%% level 10.0 node 4 xshift 1.0 from 6.0,2 move C payoffs 4 4 +\draw [line width=\treethickn,color=\playertwocolor] (-1,-10) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + -- (-2,-6); +\draw (-1.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% level 2.0 node 2 player 1 xshift 4.0 from -2.0,1 move Low~(\frac{2}{3}) +\draw [line width=\treethickn,color=\chancecolor] (4,-2) + -- (0,2); +\draw (2,0) node[right,yshift=\yfracup,color=\chancecolor] {$Low~(\frac{2}{3})$\strut}; +%% level 6.0 node 3 xshift -2.0 from 2.0,2 move E +\draw [line width=\treethickn,color=\playeronecolor] (2,-6) + -- (4,-2); +\draw (3,-4) node[left,yshift=\yup,color=\playeronecolor] {$E$\strut}; +%% level 10.0 node 5 xshift -1.0 from 6.0,3 move M payoffs 3 0 +\draw [line width=\treethickn,color=\playertwocolor] (1,-10) + node[below,yshift=0.1\paydown] {$3$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (2,-6); +\draw (1.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$M$\strut}; +%% level 10.0 node 6 xshift 1.0 from 6.0,3 move C payoffs -3 4 +\draw [line width=\treethickn,color=\playertwocolor] (3,-10) + node[below,yshift=0.1\paydown] {$-3{\phantom-}$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + -- (2,-6); +\draw (2.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% level 6.0 node 4 xshift 2.0 from 2.0,2 move N +\draw [line width=\treethickn,color=\playeronecolor] (6,-6) + -- (4,-2); +\draw (5,-4) node[right,yshift=\yup,color=\playeronecolor] {$N$\strut}; +%% level 10.0 node 7 xshift -1.0 from 6.0,4 move M payoffs 10 0 +\draw [line width=\treethickn,color=\playertwocolor] (5,-10) + node[below,yshift=0.1\paydown] {$10$\strut} + node[below,yshift=-0.9\paydown] {$0$\strut} + -- (6,-6); +\draw (5.5,-8) node[left,yshift=\yup,color=\playertwocolor] {$M$\strut}; +%% level 10.0 node 8 xshift 1.0 from 6.0,4 move C payoffs 4 4 +\draw [line width=\treethickn,color=\playertwocolor] (7,-10) + node[below,yshift=0.1\paydown] {$4$\strut} + node[below,yshift=-0.9\paydown] {$4$\strut} + -- (6,-6); +\draw (6.5,-8) node[right,yshift=\yup,color=\playertwocolor] {$C$\strut}; +%% iset 6.0,1 6.0,3 player 2 +%% iset 6.0,2 6.0,4 player 2 +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (-4,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-6,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (-2,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playeronecolor, fill=\playeronecolor, shape=circle] at (4,-2) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (2,-6) {}; +\node[inner sep=0pt,minimum size=\ndiam, draw=\playertwocolor, fill=\playertwocolor, shape=circle] at (6,-6) {}; + +% Player color legend +\begin{scope}[scale=1,shift={(-8.5,2.0)}] +\node[inner sep=0pt,minimum size=\sqwidth,draw=\chancecolor,fill=\chancecolor,shape=rectangle] at (0,0) {}; +\node[anchor=west] at (0.3,0) {\small chance}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playeronecolor,fill=\playeronecolor,shape=circle] at (0,-0.625) {}; +\node[anchor=west] at (0.3,-0.625) {You}; +\node[inner sep=0pt,minimum size=\ndiam,draw=\playertwocolor,fill=\playertwocolor,shape=circle] at (0,-1.25) {}; +\node[anchor=west] at (0.3,-1.25) {Firm}; +\end{scope} + +\end{tikzpicture} + + \end{document} diff --git a/catalog/myerson1991/fig2_1.efg b/catalog/myerson1991/fig2_1.efg index a95745147..63b992f04 100644 --- a/catalog/myerson1991/fig2_1.efg +++ b/catalog/myerson1991/fig2_1.efg @@ -1,5 +1,5 @@ EFG 2 R "A simple Poker game" { "Fred" "Alice" } -"This is a simple game of one-card poker from Myerson [^Mye91], used as the +"This is a simple game of one-card poker from Myerson [Mye91]_, used as the introductory example for game models. Note that as specified in the text, the game has the slightly unusual feature @@ -13,7 +13,7 @@ reiley2008/fig1 than a win. -[^Mye1991]: Myerson, Roger B. (1991) Game Theory: Analysis of Conflict. +[Mye91]_: Myerson, Roger B. (1991) Game Theory: Analysis of Conflict. Cambridge: Harvard University Press. " diff --git a/catalog/myerson1991/fig4_2.efg b/catalog/myerson1991/fig4_2.efg index 9631090f0..c36cf1e13 100644 --- a/catalog/myerson1991/fig4_2.efg +++ b/catalog/myerson1991/fig4_2.efg @@ -1,5 +1,5 @@ EFG 2 R "Myerson (1991) Figure 4.2" { "Player 1" "Player 2" } -"An example from Myerson [^Mye1991] which illustrates the distinction between +"An example from Myerson [Mye91]_ which illustrates the distinction between an equilibrium of an extensive form game and an equilibrium of its (multi)agent representation. The actions B1, Z1, and W2 form a behavior profile which is an equilibrium in the (multi)agent @@ -8,7 +8,7 @@ game, because Player 1 would prefer to switch from (B1, Z1) to (A1, Y1); the (multi)agent representation rules out such coordinated deviations across information sets. -[^Mye1991]: Myerson, Roger B. (1991) Game Theory: Analysis of Conflict. +[Mye91]_: Myerson, Roger B. (1991) Game Theory: Analysis of Conflict. Cambridge: Harvard University Press. " diff --git a/catalog/reiley2008/fig1.efg b/catalog/reiley2008/fig1.efg index 9083ff0f6..d6947db78 100644 --- a/catalog/reiley2008/fig1.efg +++ b/catalog/reiley2008/fig1.efg @@ -1,14 +1,14 @@ EFG 2 R "Stripped-down poker (Reiley et al 2008)" { "Professor" "Student" } -"This is a one-card poker game used in [^Rei2008] as a teaching exercise. +"This is a one-card poker game used in [Rei2008]_ as a teaching exercise. See also -------- myerson1991/fig2_1 Another one-card poker game with slightly different rules. -[^Rei2008]: Reiley, David H., Urbancic, Michael B, and Walker, Mark. (2008) +[Rei2008]_: Reiley, David H., Urbancic, Michael B, and Walker, Mark. (2008) Stripped-Down Poker: A Classroom Game with Signaling and Bluffing. - _The Journal of Economic Education_ 4: 323-341. + The Journal of Economic Education 4: 323-341. " c "" 1 "" { "King" 1/2 "Queen" 1/2 } 0 diff --git a/catalog/selten1975/fig1.efg b/catalog/selten1975/fig1.efg index c966809b6..ea47ae88f 100644 --- a/catalog/selten1975/fig1.efg +++ b/catalog/selten1975/fig1.efg @@ -1,12 +1,12 @@ EFG 2 R "Selten's horse (Selten IJGT 1975, Figure 1)" { "Player 1" "Player 2" "Player 3" } -"This is a three-player game presented in Selten [^Sel1975], commonly referred +"This is a three-player game presented in Selten [Sel75]_, commonly referred to as \"Selten's horse\" owing to the layout in which it can be drawn. It is the motivating example for his definition of (trembling-hand) perfect equilibrium, by showing a game that has an equilibrium which is \"unreasonable\", but which is not ruled out by subgame perfection because this game has no proper subgames. -[^Sel1975]: Selten, Reinhard (1975). A reexamination of the perfectness concept +[Sel75]_: Selten, Reinhard (1975). A reexamination of the perfectness concept for equilibrium points in extensive games. International Journal of Game Theory 4(1): 25-55. " diff --git a/catalog/selten1975/fig2.efg b/catalog/selten1975/fig2.efg index 1d36cb21f..ab52adaa5 100644 --- a/catalog/selten1975/fig2.efg +++ b/catalog/selten1975/fig2.efg @@ -1,10 +1,10 @@ EFG 2 R "Selten (IJGT 1975) Figure 2" { "Player 1" "Player 2" } -"This is a counterexample presented in [^Sel1975], to show that extensive and +"This is a counterexample presented in [Sel75]_, to show that extensive and normal form concepts of perfectness do not coincide. This game has one perfect equilibrium in the extensive from, but a distinct (pure) strategy equilibrium is also perfect in the normal form. -[^Sel75]: Selten, Reinhard (1975). A reexamination of the perfectness concept +[Sel75]_: Selten, Reinhard (1975). A reexamination of the perfectness concept for equilibrium points in extensive games. International Journal of Game Theory 4(1): 25-55. " diff --git a/catalog/selten1975/fig3.efg b/catalog/selten1975/fig3.efg index 7df596906..25c123b05 100644 --- a/catalog/selten1975/fig3.efg +++ b/catalog/selten1975/fig3.efg @@ -1,10 +1,10 @@ EFG 2 R "Selten (IJGT 1975) Figure 3" { "Player 1" "Player 2" "Player 3" } -"This is a counterexample presented in [^Sel1975], to show that extensive and +"This is a counterexample presented in [Sel75]_, to show that extensive and normal form concepts of perfectness do not coincide. Specifically, there are two equilibria which are perfect in the normal form but not perfect in the extensive form. -[^Sel75]: Selten, Reinhard (1975). A reexamination of the perfectness concept +[Sel75]_: Selten, Reinhard (1975). A reexamination of the perfectness concept for equilibrium points in extensive games. International Journal of Game Theory 4(1): 25-55. " diff --git a/catalog/watson2013/exercise29_6.efg b/catalog/watson2013/exercise29_6.efg index 8ca0f7a3d..51862847c 100644 --- a/catalog/watson2013/exercise29_6.efg +++ b/catalog/watson2013/exercise29_6.efg @@ -1,5 +1,5 @@ EFG 2 R "Princess Bride signaling game (from Watson)" { "Wesley" "Prince" } -"This game is Exercise 29.6 from Watson [^Wat13], based on a scene from +"This game is Exercise 29.6 from Watson [Wat13]_, based on a scene from the Rob Reiner film, _The Princess Bride_: Wesley (the protagonist) confronts the evil prince Humperdinck. Wesley @@ -16,7 +16,7 @@ swordsman. Also, the weak Wesley must pay a cost to get out of bed. In the game in this file, the cost the weak Wesley pays to get out of bed is set to 2. -[^Wat13]: Watson, Joel. (2013) Strategy: An Introduction to Game Theory, +[Wat13]_: Watson, Joel. (2013) Strategy: An Introduction to Game Theory, third edition. W. W. Norton & Company. " diff --git a/catalog/watson2013/fig29_1.efg b/catalog/watson2013/fig29_1.efg index 1ec266fa2..debde3978 100644 --- a/catalog/watson2013/fig29_1.efg +++ b/catalog/watson2013/fig29_1.efg @@ -1,8 +1,8 @@ EFG 2 R "Job-market signaling game (version from Watson)" { "You" "Firm" } "This is a version of Spence's classic model of education being a job-market -signal, as presented in Figure 29.1 of Watson [^Wat13]. +signal, as presented in Figure 29.1 of Watson [Wat13]_. -[^Wat13]: Watson, Joel. (2013) Strategy: An Introduction to Game Theory, +[Wat13]_: Watson, Joel. (2013) Strategy: An Introduction to Game Theory, third edition. W. W. Norton & Company. " diff --git a/doc/_static/custom.css b/doc/_static/custom.css new file mode 100644 index 000000000..9a9155293 --- /dev/null +++ b/doc/_static/custom.css @@ -0,0 +1,22 @@ +/* Custom CSS for Gambit Documentation */ +.tight-table .figure img { + max-height: 500px; + width: auto; + display: block; + margin-left: auto; + margin-right: auto; +} + +table.tight-table th, +table.tight-table td { + text-align: center; +} + +table.tight-table td .highlight pre, +table.tight-table td .highlight { + text-align: left; +} + +table.tight-table td .sd-card-body { + text-align: left; +} diff --git a/doc/biblio.rst b/doc/biblio.rst index b84d341a8..58e91900c 100644 --- a/doc/biblio.rst +++ b/doc/biblio.rst @@ -1,10 +1,20 @@ +.. _bibliography: + Bibliography ============ +.. note:: + + To reference an entry in this bibliography, use the format ``[key]_``, for example, ``[Mye91]_`` will link to the Myerson (1991) textbook entry. + + Articles on computation of Nash equilibria ------------------------------------------ +.. [Bag1995] Bagwell, Kyle (1995) Commitment and observability in games. + Games and Economic Behavior 8: 271-280. + .. [BlaTur23] Bland, J. R. and Turocy, T. L., 2023. Quantal response equilibrium as a structural model for estimation: The missing manual. SSRN working paper 4425515. @@ -47,6 +57,10 @@ Articles on computation of Nash equilibria "Simple search methods for finding a Nash equilibrium." Games and Economic Behavior 664-669, 2004. +.. [Rei2008] Reiley, David H., Urbancic, Michael B, and Walker, Mark. (2008) + Stripped-Down Poker: A Classroom Game with Signaling and Bluffing. + The Journal of Economic Education 4: 323-341. + .. [Ros71] J. Rosenmuller, "On a generalization of the Lemke-Howson Algorithm to noncooperative n-person games", 73-79, SIAM Journal of Applied Mathematics, 21, 1971. @@ -66,6 +80,9 @@ Articles on computation of Nash equilibria complementarity problem on a product of unit simplices using a general labelling", 377-397, Mathematics of Operations Research , 1987. +.. [Wat13] Watson, Joel. (2013) Strategy: An Introduction to Game Theory, + third edition. W. W. Norton & Company. + .. [Wil71] Robert Wilson, "Computing equilibria of n-person games", 80-87, SIAM Applied Math, 21, 1971. @@ -89,6 +106,9 @@ General game theory articles and texts .. [KreWil82] David Kreps and Robert Wilson, "Sequential Equilibria", 863-894, Econometrica , 50, 1982. +.. [Kre90] David Kreps, 1990, A Course in Microeconomic Theory, + Princeton University Press. + .. [McKPal95] Richard McKelvey and Tom Palfrey, "Quantal response equilibria for normal form games", 6-38, Games and Economic Behavior , 10, 1995. diff --git a/doc/catalog.rst b/doc/catalog.rst index cf8d45e2c..a7d132c4a 100644 --- a/doc/catalog.rst +++ b/doc/catalog.rst @@ -1,8 +1,7 @@ Catalog of games ================ -.. csv-table:: - :file: catalog.csv - :header-rows: 1 - :widths: 20, 80 - :class: tight-table +Below is a complete list of games included in Gambit's catalog. +Check out the :ref:`pygambit API reference ` for instructions on how to search and load these games in Python, and the :ref:`Updating the games catalog ` guide for instructions on how to contribute new games to the catalog. + +.. include:: catalog_table.rst diff --git a/doc/conf.py b/doc/conf.py index 65760193b..668f99ccc 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -29,6 +29,8 @@ "IPython.sphinxext.ipython_directive", "sphinx_design", "nbsphinx", + "sphinxcontrib.tikz", + "jupyter_sphinx", ] # IPython directive configuration @@ -116,22 +118,10 @@ # documentation. html_theme_options = { "external_links": [ - { - "name": "GitHub", - "url": "https://github.com/gambitproject/gambit" - }, - { - "name": "Releases", - "url": "https://github.com/gambitproject/gambit/releases" - }, - { - "name": "Older releases", - "url": "https://sourceforge.net/projects/gambit/files/" - }, - { - "name": "Cite Gambit", - "url": "https://www.gambit-project.org/cite/" - } + {"name": "GitHub", "url": "https://github.com/gambitproject/gambit"}, + {"name": "Releases", "url": "https://github.com/gambitproject/gambit/releases"}, + {"name": "Older releases", "url": "https://sourceforge.net/projects/gambit/files/"}, + {"name": "Cite Gambit", "url": "https://www.gambit-project.org/cite/"}, ], "navbar_end": ["theme-switcher", "navbar-icon-links"], "icon_links": [ @@ -168,6 +158,11 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] +# Custom CSS files +html_css_files = [ + "custom.css", +] + # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' @@ -217,8 +212,7 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ("index", "Gambit.tex", "Gambit Documentation", - "The Gambit Project", "manual"), + ("index", "Gambit.tex", "Gambit Documentation", "The Gambit Project", "manual"), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/developer.catalog.rst b/doc/developer.catalog.rst index 349d1792c..d16c6ece4 100644 --- a/doc/developer.catalog.rst +++ b/doc/developer.catalog.rst @@ -1,3 +1,5 @@ +.. _updating-catalog: + Updating the Games Catalog ========================== @@ -5,6 +7,7 @@ This page covers the process for contributing to and updating Gambit's :ref:`Gam To do so, you will need to have the `gambit` GitHub repo cloned and be able to submit pull request via GitHub; you may wish to first review the :ref:`contributor guidelines `. You'll also need to have a developer install of `pygambit` available in your Python environment, see :ref:`build-python`. +You'll also need to have a developer install of `pygambit` available in your Python environment, see :ref:`build-python`. You can add games to the catalog saved in a valid representation :ref:`format `. Currently supported representations are: @@ -12,12 +15,13 @@ Currently supported representations are: - `.efg` for extensive form games - `.nfg` for normal form games -Add new games -------------- +Add new game files +------------------ 1. **Create the game file:** Use either :ref:`pygambit `, the Gambit :ref:`CLI ` or :ref:`GUI ` to create and save game in a valid representation :ref:`format `. + Make sure the game includes a description, with any citations referencing the :ref:`bibliography ` with the format ``[citation_key]_`` e.g. ``[Mye91]_``. 2. **Add the game file:** @@ -26,13 +30,19 @@ Add new games 3. **Update the catalog:** Reinstall the package to pick up the new game file(s) in the ``pygambit.catalog`` module. - Then use the ``update.py`` script to update Gambit's documentation & build files. + Then use the ``update.py`` script to update Gambit's documentation & build files, as well as generating images for the new game(s). .. code-block:: bash + pip install . pip install . python build_support/catalog/update.py --build + .. note:: + + Regenerate all images in the catalog with the ``--regenerate-images`` flag. + Update the ``draw_tree_args`` in ``build_support/catalog/update.py`` to change the default visualization parameters. + .. warning:: Running the script with the ``--build`` flag updates `Makefile.am`. If you moved games that were previously in `contrib/games` you'll need to also manually remove those files from `EXTRA_DIST`. @@ -42,3 +52,18 @@ Add new games .. warning:: Make sure you commit all changed files e.g. run ``git add --all`` before committing and pushing. + +Code new games & add game families +---------------------------------- + +1. **Add the game code:** + + Open `catalog/__init__.py` and create a new function, or modify an existing one. Ensure your function returns a ``Game`` object. + You may wish to vary the game title and/or description based on the chosen parameters. + +2. **Update the catalog:** + + Update the dictionary returned by ``family_games()`` in `catalog/__init__.py` with all variants of your game(s) you want in the catalog. + Ensure each entry has unique game slug as key (this will be used by ``pygambit.catalog.load('slug')``), and returns a call of the function with specific parameters. + +3. **Submit a pull request to GitHub with all changes.** diff --git a/doc/pygambit.api.rst b/doc/pygambit.api.rst index 7568cfd5a..7f8eea604 100644 --- a/doc/pygambit.api.rst +++ b/doc/pygambit.api.rst @@ -325,3 +325,17 @@ Computation of quantal response equilibria logit_estimate LogitQREMixedStrategyFitResult LogitQREMixedBehaviorFitResult + + +.. _pygambit-catalog: + +Catalog of games +~~~~~~~~~~~~~~~~ + +.. currentmodule:: pygambit.catalog + +.. autosummary:: + :toctree: api/ + + load + games diff --git a/doc/tutorials/01_quickstart.ipynb b/doc/tutorials/01_quickstart.ipynb index f41068e1b..388891ae0 100644 --- a/doc/tutorials/01_quickstart.ipynb +++ b/doc/tutorials/01_quickstart.ipynb @@ -311,7 +311,7 @@ }, { "cell_type": "markdown", - "id": "3dfbf327", + "id": "24f36b0d", "metadata": {}, "source": [ "Saving and reading strategic form games to and from file\n", diff --git a/doc/tutorials/advanced_tutorials/starting_points.ipynb b/doc/tutorials/advanced_tutorials/starting_points.ipynb index 24d568c6c..491667abf 100644 --- a/doc/tutorials/advanced_tutorials/starting_points.ipynb +++ b/doc/tutorials/advanced_tutorials/starting_points.ipynb @@ -25,7 +25,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "493cafb8", "metadata": {}, "outputs": [], diff --git a/pyproject.toml b/pyproject.toml index 71134753d..b9c98e9b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,9 @@ doc = [ "pickleshare", "jupyter", "open_spiel; sys_platform != 'win32'", - "draw-tree @ git+https://github.com/gambitproject/draw_tree.git@v0.4.0" + "draw-tree @ git+https://github.com/gambitproject/draw_tree.git@v0.4.1", + "sphinxcontrib-tikz", + "jupyter_sphinx", ] [project.urls] diff --git a/tests/test_catalog.py b/tests/test_catalog.py index c010c2a51..0c2a2d496 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -4,6 +4,11 @@ import pygambit as gbt +@pytest.fixture(scope="module") +def all_games(): + return gbt.catalog.games() + + @pytest.fixture def game_slugs(): """Fixture providing a set of all game slugs in the catalog.""" @@ -36,14 +41,144 @@ def test_catalog_load_invalid_slug(): gbt.catalog.load("invalid_slug") -def test_catalog_games(game_slugs): +def test_catalog_load_family_game(): + """Test loading a game generated from code with a game family func.""" + g = gbt.catalog.load("one_shot_trust") + assert isinstance(g, gbt.Game) + + +def test_catalog_games(game_slugs, all_games): """Test games() function returns df of game slugs and titles.""" - all_games = gbt.catalog.games() assert isinstance(all_games, pd.DataFrame) - # The games() function should return exactly the set of slugs found above - assert set(all_games["Game"]) == game_slugs + # The games() function should return set of slugs plus family games + fg = gbt.catalog.family_games().keys() + assert set(all_games["Game"]) == game_slugs.union(fg) # Test that standard columns are present assert "Game" in all_games.columns assert "Title" in all_games.columns + + +def test_catalog_games_filter_n_actions(all_games): + """Test games() function can filter on length of gbt.Game attribute 'actions'""" + filtered_games = gbt.catalog.games(n_actions=2) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.actions) == 2 + + +def test_catalog_games_filter_n_contingencies(all_games): + """Test games() function can filter on length of gbt.Game attribute 'contingencies'""" + filtered_games = gbt.catalog.games(n_contingencies=2) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.contingencies) == 2 + + +def test_catalog_games_filter_n_infosets(all_games): + """Test games() function can filter on length of gbt.Game attribute 'infosets'""" + filtered_games = gbt.catalog.games(n_infosets=2) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.infosets) == 2 + + +def test_catalog_games_filter_is_const_sum(all_games): + """Test games() function can filter on boolean gbt.Game attribute 'is_const_sum'""" + filtered_games = gbt.catalog.games(is_const_sum=True) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert g.is_const_sum + + +def test_catalog_games_filter_is_not_perfect_recall(all_games): + """Test games() function can filter on boolean gbt.Game attribute 'is_perfect_recall'""" + filtered_games = gbt.catalog.games(is_perfect_recall=False) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert not g.is_perfect_recall + + +def test_catalog_games_filter_is_not_tree(all_games): + """Test games() function can filter on boolean gbt.Game attribute 'is_tree'""" + filtered_games = gbt.catalog.games(is_tree=False) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert not g.is_tree + + +def test_catalog_games_filter_min_payoff_and_max_payoff(all_games): + """Test games() function can filter on min and max payoff values""" + filtered_games = gbt.catalog.games(min_payoff=0, max_payoff=10) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert g.min_payoff >= 0 + assert g.max_payoff <= 10 + + +def test_catalog_games_filter_n_nodes(all_games): + """Test games() function can filter on length of gbt.Game attribute 'nodes'""" + filtered_games = gbt.catalog.games(n_nodes=5) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.nodes) == 5 + + +def test_catalog_games_filter_n_outcomes(all_games): + """Test games() function can filter on length of gbt.Game attribute 'outcomes'""" + filtered_games = gbt.catalog.games(n_outcomes=3) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.outcomes) == 3 + + +def test_catalog_games_filter_n_players(all_games): + """Test games() function can filter on length of gbt.Game attribute 'players'""" + filtered_games = gbt.catalog.games(n_players=2) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.players) == 2 + + +def test_catalog_games_filter_n_strategies(all_games): + """Test games() function can filter on length of gbt.Game attribute 'strategies'""" + filtered_games = gbt.catalog.games(n_strategies=4) + assert isinstance(filtered_games, pd.DataFrame) + assert len(filtered_games) < len(all_games) + if len(filtered_games) > 0: + g = gbt.catalog.load(filtered_games.Game.iloc[0]) + assert len(g.strategies) == 4 + + +def test_catalog_games_filter_bad_filter(): + """Test games() function raises error on invalid filter key""" + with pytest.raises(TypeError): + gbt.catalog.games(invalid_filter=123) + + +def test_catalog_games_include_descriptions(): + """Test games() function can include descriptions""" + games_with_desc = gbt.catalog.games(include_descriptions=True) + assert "Description" in games_with_desc.columns + assert "Download" in games_with_desc.columns