Skip to content

Commit a5d2ac4

Browse files
committed
Merge branch 'master' into issue_660
2 parents d231a8c + 4c9c461 commit a5d2ac4

41 files changed

Lines changed: 7675 additions & 3805 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
**Gambit** is the package for doing computation in (non-cooperative) game theory.
1212

13-
- See our [documentation](https://gambitproject.readthedocs.io/)
14-
- Check our [project website](https://www.gambit-project.org/)
13+
- **Documentation:** for the package is hosted at [gambitproject.readthedocs.io](https://gambitproject.readthedocs.io/).
14+
- **The Gambit project:** Find out more about the project at [gambit-project.org](https://www.gambit-project.org/)
15+
- **Contributors:** Please read the [code of conduct and contribution guidelines](https://gambitproject.readthedocs.io/en/latest/developer.contributing.html) before posting on GitHub.
1516

1617
Gambit provides:
1718

build_support/osx/Info.plist.in

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
3-
<plist version="0.9">
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
44
<dict>
55
<key>CFBundleInfoDictionaryVersion</key>
66
<string>6.0</string>
77
<key>CFBundleIdentifier</key>
88
<string>org.gambit-project.gambit</string>
99
<key>CFBundleDevelopmentRegion</key>
10-
<string>English</string>
10+
<string>en</string>
1111
<key>CFBundleExecutable</key>
1212
<string>gambit</string>
1313
<key>CFBundleIconFile</key>
1414
<string>gambit</string>
1515
<key>CFBundleName</key>
1616
<string>Gambit</string>
17+
<key>CFBundleDisplayName</key>
18+
<string>Gambit</string>
1719
<key>CFBundlePackageType</key>
1820
<string>APPL</string>
19-
<key>CFBundleSignature</key>
20-
<string>????</string>
2121
<key>CFBundleVersion</key>
2222
<string>@GAMBIT_VERSION@</string>
2323
<key>CFBundleShortVersionString</key>
2424
<string>@GAMBIT_VERSION@</string>
2525
<key>CFBundleGetInfoString</key>
26-
<string>Gambit version @GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project</string>
27-
<key>CFBundleLongVersionString</key>
28-
<string>@GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project</string>
26+
<string>Gambit version @GAMBIT_VERSION@, (c) 1994-2026 The Gambit Project</string>
2927
<key>NSHumanReadableCopyright</key>
30-
<string>Copyright 1994-2025 The Gambit Project</string>
31-
<key>LSRequiresCarbon</key>
32-
<true/>
33-
<key>CSResourcesFileMapped</key>
34-
<true/>
28+
<string>Copyright 1994-2026 The Gambit Project</string>
3529
<key>CFBundleDocumentTypes</key>
3630
<array>
3731
<dict>

build_support/osx/gambit.icns

137 KB
Binary file not shown.

doc/developer.contributing.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,25 @@ Contributing to Gambit
66
This section provides guidelines for contributing to Gambit, including how to report bugs, suggest features, and contribute code.
77
It includes information relevant to both core developers and external contributors.
88

9+
.. _code-of-conduct:
10+
11+
Code of Conduct
12+
---------------
13+
14+
All participants in the Gambit community are expected to show respect and courtesy to others.
15+
We are committed to fostering a welcoming and harassment-free environment for everyone, regardless of background or identity.
16+
Please be kind and considerate in your interactions. We are all here to build a better tool for game theory research and education.
17+
Disagreements may happen, but they should be handled with respect and a focus on constructive resolution.
18+
19+
To raise any concerns, please contact `Ted Turocy <mailto:ted.turocy@gmail.com>` or `Rahul Savani <mailto:rahul.savani@gmail.com>`.
20+
921
.. _github-issues:
1022

1123
GitHub issues
1224
-------------
1325

26+
Newcomer to the project? Please read the :ref:`code of conduct <code-of-conduct>` and :ref:`new contributors section <new-contributors>` sections before posting on GitHub.
27+
1428
In the first instance, bug reports, feature requests and improvements to the Gambit documentation should be
1529
posted to the Gambit issue tracker, located at
1630
`<http://github.com/gambitproject/gambit/issues>`_.
@@ -39,6 +53,44 @@ latest development version. New development should in general always
3953
be based off this branch. Branches labeled ``maintX_Y``, where ``X`` is the major version number and ``Y`` is the minor version number, point to the latest commit on a stable
4054
version.
4155

56+
.. _new-contributors:
57+
58+
A Note for New Contributors
59+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
We warmly welcome new contributors to the Gambit project! Your help is valuable to us.
62+
63+
Before you start working on a contribution, we encourage you to familiarize yourself with the project.
64+
Gambit is a mature and complex codebase. Even issues marked as "good first issue" may require some understanding of the context and how different parts of the project interact.
65+
66+
We have always valued thoughtful contributions. A common issue for open-source projects is receiving pull requests that are not well-aligned with the project's needs or coding standards. To avoid unproductive effort on your part and on ours, we strongly encourage you to engage with us before you spend a lot of time on implementation.
67+
68+
A great way to start is by:
69+
70+
1. Looking through the code to understand the relevant parts for your intended change.
71+
2. Contacting the maintainers via commenting with a question on an open issue, or opening a Discussion on GitHub.
72+
3. After your discussion with the maintainers, open a draft pull request early in your process. This allows for discussion and feedback before you've invested too much time.
73+
74+
We are happy to answer questions and provide guidance. Engaging with the maintainers early ensures that your contribution is likely to be accepted and integrated smoothly.
75+
76+
.. _ai-policy:
77+
78+
Policy on AI-Assisted Contributions
79+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80+
81+
We recognize that generative AI tools can be a useful aid in software development. We also expect authentic and thoughtful engagement from our contributors.
82+
83+
- **You are responsible for your contributions.** If you use generative AI to help you write code or documentation, you must fully understand the output. You should be able to explain the changes and why they are the correct approach for the project.
84+
- **Add value.** Simply taking a prompt, feeding it to an AI, and posting the result as a contribution is not helpful. We expect you to use your own expertise to verify, test, and refine any AI-generated content. Out of respect for everyone's time, we reserve the right to rigorously reject low-value contributions, whether AI-generated or not.
85+
- **No AI-generated comments.** Please do not post output from Large Language Models (LLMs) or similar tools as comments on GitHub issues or pull requests. Such comments are often generic and do not add to the discussion.
86+
- **Humans over bots.** We discourage the use of automated tools, such as bots or agents, to post AI-generated content to issues or pull requests, without the advance approval of the core development team.
87+
88+
89+
How to submit a contribution
90+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91+
92+
To contribute code, please follow these steps:
93+
4294
1. To get started contributing code in the `Gambit GitHub repo <https://github.com/gambitproject/gambit>`__, do one of the following:
4395

4496
- Core developers: request contributor access from one of the `team <https://www.gambit-project.org/team/>`__

doc/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
##########################
21
Gambit: User documentation
3-
##########################
2+
^^^^^^^^^^^^^^^^^^^^^^^^^^
43

54
**Gambit** is a library of game theory software and tools for the
65
construction and analysis of finite extensive and strategic games.
7-
We recommended most new users install the PyGambit Python package and read the associated documentation, which includes tutorials and a complete API reference.
6+
7+
- **Users:** We recommend most newcomers install the PyGambit Python package and read the associated documentation, which includes tutorials and a complete API reference.
8+
- **Contributors:** Please read the :ref:`code of conduct and contribution guidelines <contributing>` before posting on GitHub.
89

910
.. grid::
1011

doc/tutorials/interoperability_tutorials/openspiel.ipynb

Lines changed: 28 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -816,143 +816,51 @@
816816
"source": [
817817
"Games loaded from EFG in OpenSpiel do not take advantage of the full functionality of the package, for example, it is not possible to carry out training with RL algorithms on these games, as in the example above with Tiny Hanabi. The OpenSpiel documentation explains [how to submit new games to the library](https://openspiel.readthedocs.io/en/latest/developer_guide.html#adding-a-game) if you wish to add your own games.\n",
818818
"\n",
819-
"We can however use the state representation and play through the game step by step:"
819+
"We can however use the state representation to simulate a playthrough of the game:"
820820
]
821821
},
822822
{
823823
"cell_type": "code",
824824
"execution_count": null,
825-
"id": "c01c4d6f",
825+
"id": "97913fe5",
826826
"metadata": {},
827827
"outputs": [],
828828
"source": [
829-
"ops_one_card_poker.num_distinct_actions()"
830-
]
831-
},
832-
{
833-
"cell_type": "markdown",
834-
"id": "9986860c",
835-
"metadata": {},
836-
"source": [
837-
"The one-card poker game has 4 distinct actions, 2 are for the first player (Alice in the example game): \"Bet\" and \"Fold\", and 2 for the second player (Bob): \"Call\" and \"Fold\".\n",
829+
"players = {0: \"Alice\", 1: \"Bob\", -1: \"Chance\"}\n",
838830
"\n",
839-
"Initialising the game state, we can see the current player at the start is the chance player, who deals the cards:"
840-
]
841-
},
842-
{
843-
"cell_type": "code",
844-
"execution_count": null,
845-
"id": "3b9cc43b",
846-
"metadata": {},
847-
"outputs": [],
848-
"source": [
831+
"# Create an initial game state, then play through to completion\n",
849832
"state = ops_one_card_poker.new_initial_state()\n",
850-
"state"
851-
]
852-
},
853-
{
854-
"cell_type": "code",
855-
"execution_count": null,
856-
"id": "e23df723",
857-
"metadata": {},
858-
"outputs": [],
859-
"source": [
860-
"state.legal_actions()"
861-
]
862-
},
863-
{
864-
"cell_type": "markdown",
865-
"id": "7b0959f9",
866-
"metadata": {},
867-
"source": [
868-
"Let's make the chance player's action dealing a King (action 0):"
869-
]
870-
},
871-
{
872-
"cell_type": "code",
873-
"execution_count": null,
874-
"id": "4dd5d504",
875-
"metadata": {},
876-
"outputs": [],
877-
"source": [
878-
"state.apply_action(0)\n",
879-
"state"
880-
]
881-
},
882-
{
883-
"cell_type": "code",
884-
"execution_count": null,
885-
"id": "be557706",
886-
"metadata": {},
887-
"outputs": [],
888-
"source": [
889-
"state.legal_actions()"
890-
]
891-
},
892-
{
893-
"cell_type": "markdown",
894-
"id": "b4291f07",
895-
"metadata": {},
896-
"source": [
897-
"As expected, it's now the first player's (Alice's) turn.\n",
898-
"Let's have Alice choose to \"Bet\" (action 0):"
899-
]
900-
},
901-
{
902-
"cell_type": "code",
903-
"execution_count": null,
904-
"id": "bd15369f",
905-
"metadata": {},
906-
"outputs": [],
907-
"source": [
908-
"state.apply_action(0)\n",
909-
"state"
910-
]
911-
},
912-
{
913-
"cell_type": "markdown",
914-
"id": "cd63f7d7",
915-
"metadata": {},
916-
"source": [
917-
"As expected, the current player is now player 2 (Bob), let's check the legal actions available to Bob:"
918-
]
919-
},
920-
{
921-
"cell_type": "code",
922-
"execution_count": null,
923-
"id": "8d81ff6b",
924-
"metadata": {},
925-
"outputs": [],
926-
"source": [
927-
"state.legal_actions()"
928-
]
929-
},
930-
{
931-
"cell_type": "markdown",
932-
"id": "fdb5194f",
933-
"metadata": {},
934-
"source": [
935-
"Player 2 (Bob) now has the option to \"Call\" (action 1) or \"Fold\" (action 2).\n",
936-
"Let's have Bob choose to \"Fold\":"
937-
]
938-
},
939-
{
940-
"cell_type": "code",
941-
"execution_count": null,
942-
"id": "97913fe5",
943-
"metadata": {},
944-
"outputs": [],
945-
"source": [
946-
"state.apply_action(2)\n",
947-
"state"
833+
"while not state.is_terminal():\n",
834+
"\n",
835+
" # Store legal actions of current player in a dict\n",
836+
" legal_actions = {}\n",
837+
" for action in state.legal_actions():\n",
838+
" legal_actions[action] = state.action_to_string(state.current_player(), action)\n",
839+
"\n",
840+
" # If player is chance, choose an action according to probability\n",
841+
" if state.is_chance_node():\n",
842+
" outcomes_with_probs = state.chance_outcomes()\n",
843+
" action_list, prob_list = zip(*outcomes_with_probs, strict=True)\n",
844+
" action = np.random.choice(action_list, p=prob_list)\n",
845+
" print(\"Dealt card: \", legal_actions[action])\n",
846+
" state.apply_action(action)\n",
847+
"\n",
848+
" # Regular players pick a random legal action.\n",
849+
" else:\n",
850+
" action = np.random.choice(state.legal_actions())\n",
851+
" print(players[state.current_player()], \" action: \", legal_actions[action])\n",
852+
" state.apply_action(action)\n",
853+
" print()\n",
854+
"\n",
855+
"print(\"Alice receives: \", state.player_return(0), \", Bob receives: \", state.player_return(1))"
948856
]
949857
},
950858
{
951859
"cell_type": "markdown",
952860
"id": "1bf09576",
953861
"metadata": {},
954862
"source": [
955-
"Since Bob Folded, Alice takes the small win and we reach a terminal state."
863+
"Run the code cell above to simulate different possible playthroughs of the game."
956864
]
957865
}
958866
],

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies = [
3232
]
3333

3434
[project.optional-dependencies]
35-
test = ["pytest", "nbformat", "nbclient", "ipykernel"]
35+
test = ["pytest", "pytest-subtests", "nbformat", "nbclient", "ipykernel"]
3636
doc = [
3737
"pydata-sphinx-theme",
3838
"sphinx_design",
@@ -99,6 +99,16 @@ markers = [
9999
"nash_lcp_behavior: tests of lcp_solve in mixed behaviors",
100100
"nash_lp_strategy: tests of lp_solve in mixed strategies",
101101
"nash_lp_behavior: tests of lp_solve in mixed behaviors",
102+
"nash_logit_strategy: tests of logit_solve in mixed strategies",
103+
"nash_logit_behavior: tests of logit_solve in behavior strategies",
104+
"nash_gnm_strategy: tests of gnm_solve in mixed strategies",
105+
"nash_ipa_strategy: tests of lpa_solve in mixed strategies",
106+
"nash_simpdiv: tests of simpdiv_solve (in mixed strategies)",
107+
"nash_liap_strategy: tests of liap_solve (in mixed strategies)",
108+
"nash_liap_agent: tests of liap_agent_solve (in mixed behaviors)",
109+
"qre_logit: tests of logit_solve and related methods",
110+
"qre_logit_lambda: tests of logit_solve_lambda",
111+
"qre_logit_branch: tests of logit_solve_branch",
102112
"nash: all tests of Nash equilibrium solvers",
103113
"slow: all time-consuming tests",
104114
]

0 commit comments

Comments
 (0)