Skip to content

Commit a311874

Browse files
committed
Merge branch 'maint16_4'
# Conflicts: # src/gui/dlefglogit.cc # src/gui/gamedoc.cc # src/gui/gamedoc.h # src/gui/gameframe.cc
2 parents 3aac0b0 + 9115592 commit a311874

16 files changed

Lines changed: 92 additions & 147 deletions

File tree

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
5454
steps:
5555
- uses: actions/checkout@v5
56-
- uses: actions/setup-python@v5
56+
- uses: actions/setup-python@v6
5757
with:
5858
python-version: "3.12"
5959
- uses: py-actions/flake8@v2
@@ -64,7 +64,7 @@ jobs:
6464
steps:
6565
- uses: actions/checkout@v5
6666
- name: Setup Python
67-
uses: actions/setup-python@v5
67+
uses: actions/setup-python@v6
6868
with:
6969
python-version: "3.12"
7070
- name: Install Python packages

.github/workflows/osxbinary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- run: make
3636
- run: sudo make install
3737
- run: make osx-dmg
38-
- uses: actions/upload-artifact@v4
38+
- uses: actions/upload-artifact@v5
3939
with:
4040
name: artifact-osx-13
4141
path: "*.dmg"

.github/workflows/python.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v5
2525
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v6
2727
with:
2828
python-version: ${{ matrix.python-version }}
2929
- name: Set up dependencies
@@ -50,7 +50,7 @@ jobs:
5050
steps:
5151
- uses: actions/checkout@v4
5252
- name: Set up Python ${{ matrix.python-version }}
53-
uses: actions/setup-python@v5
53+
uses: actions/setup-python@v6
5454
with:
5555
python-version: ${{ matrix.python-version }}
5656
- name: Set up dependencies
@@ -73,7 +73,7 @@ jobs:
7373
steps:
7474
- uses: actions/checkout@v4
7575
- name: Set up Python ${{ matrix.python-version }}
76-
uses: actions/setup-python@v5
76+
uses: actions/setup-python@v6
7777
with:
7878
python-version: ${{ matrix.python-version }}
7979
- name: Set up dependencies
@@ -96,7 +96,7 @@ jobs:
9696
steps:
9797
- uses: actions/checkout@v5
9898
- name: Set up Python ${{ matrix.python-version }}
99-
uses: actions/setup-python@v5
99+
uses: actions/setup-python@v6
100100
with:
101101
python-version: ${{ matrix.python-version }}
102102
- name: Set up dependencies

.github/workflows/tools.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- run: make
5555
- run: sudo make install
5656
- run: make osx-dmg
57-
- uses: actions/upload-artifact@v4
57+
- uses: actions/upload-artifact@v5
5858
with:
5959
name: artifact-osx-13
6060
path: "*.dmg"
@@ -73,7 +73,7 @@ jobs:
7373
- run: make
7474
- run: sudo make install
7575
- run: make osx-dmg
76-
- uses: actions/upload-artifact@v4
76+
- uses: actions/upload-artifact@v5
7777
with:
7878
name: artifact-osx-14
7979
path: "*.dmg"
@@ -101,7 +101,7 @@ jobs:
101101
cp gambit* installer
102102
"${WIX}bin/candle" gambit.wxs
103103
"${WIX}bin/light" -ext WixUIExtension gambit.wixobj
104-
- uses: actions/upload-artifact@v4
104+
- uses: actions/upload-artifact@v5
105105
with:
106106
name: artifact-msw
107107
path: "*.msi"

.github/workflows/wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v5
2121
- name: Set up Python
22-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v6
2323
with:
2424
python-version: '3.x'
2525
- name: Set up dependencies
@@ -31,6 +31,6 @@ jobs:
3131
python -m cibuildwheel --output-dir wheelhouse/
3232
env:
3333
CIBW_SKIP: "pp*"
34-
- uses: actions/upload-artifact@v4
34+
- uses: actions/upload-artifact@v5
3535
with:
3636
path: ./wheelhouse/*.whl

ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@
1212
### Fixed
1313
- Fixed a regression in which null outcomes in strategic game tables were not handled correctly
1414
when changing the number of strategies in the game (#571)
15+
- Fixed improper shared pointer handling when writing a .nfg file based on a game in
16+
extensive form.
17+
18+
19+
## [16.3.2] - unreleased
20+
21+
### Fixed
22+
- Parsing of output of `gambit-logit` in the graphical interface did not handle the
23+
terminal Nash profile correctly. (#172)
24+
- Improved sizing of list of logit profiles computed for normal form games.
25+
26+
### Changed
27+
- Removed Ctrl/Cmd-X accelerator for closing program, as this clashes with modern standard
28+
expectations. (#507)
29+
30+
### Removed
31+
- Undo and redo have been removed from the graphical interface. (These were meant to be
32+
removed previously as they did not work properly and gave unpredictable behaviour.) (#505)
1533

1634

1735
## [16.4.0] - 2025-09-05
@@ -41,6 +59,7 @@
4159
by the order encountered in a depth-first traversal of the tree - can now be obtained by calling
4260
`SortInfosets` (C++) or `sort_infosets` (Python) on the game. (#483)
4361

62+
4463
## [16.3.1] - 2025-08-18
4564

4665
### Fixed

src/games/behavmixed.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ template <class T> class MixedBehaviorProfile {
226226
template <class Generator>
227227
MixedBehaviorProfile<double> GameRep::NewRandomBehaviorProfile(Generator &generator) const
228228
{
229-
auto profile = MixedBehaviorProfile<double>(Game(const_cast<GameRep *>(this)));
229+
auto profile =
230+
MixedBehaviorProfile<double>(std::const_pointer_cast<GameRep>(shared_from_this()));
230231
std::exponential_distribution<> dist(1); // NOLINT(misc-const-correctness)
231232
for (auto player : GetPlayers()) {
232233
for (auto infoset : player->GetInfosets()) {
@@ -242,7 +243,8 @@ template <class Generator>
242243
MixedBehaviorProfile<Rational> GameRep::NewRandomBehaviorProfile(int p_denom,
243244
Generator &generator) const
244245
{
245-
auto profile = MixedBehaviorProfile<Rational>(Game(const_cast<GameRep *>(this)));
246+
auto profile =
247+
MixedBehaviorProfile<Rational>(std::const_pointer_cast<GameRep>(shared_from_this()));
246248
for (auto player : GetPlayers()) {
247249
for (auto infoset : player->GetInfosets()) {
248250
std::list<Rational> dist =

src/games/game.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ void GameRep::WriteNfgFile(std::ostream &p_file) const
213213
p_file << "}" << std::endl;
214214
p_file << std::quoted(GetComment()) << std::endl << std::endl;
215215

216-
for (auto iter :
217-
StrategyContingencies(StrategySupportProfile(Game(const_cast<GameRep *>(this))))) {
216+
for (auto iter : StrategyContingencies(
217+
StrategySupportProfile(std::const_pointer_cast<GameRep>(shared_from_this())))) {
218218
p_file << FormatList(
219219
players,
220220
[&iter](const GamePlayer &p) {

src/gui/dlefglogit.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ void LogitBehavList::AddProfile(const wxString &p_text, bool p_forceShow)
165165
const auto profile = std::make_shared<MixedBehaviorProfile<double>>(m_doc->GetGame());
166166

167167
wxStringTokenizer tok(p_text, wxT(","));
168-
169-
m_lambdas.push_back(
170-
(double)lexical_cast<Rational>(std::string((const char *)tok.GetNextToken().mb_str())));
171-
168+
const auto next = tok.GetNextToken();
169+
if (next == "NE") {
170+
return;
171+
}
172+
m_lambdas.push_back(std::stod(next.ToStdString()));
172173
for (size_t i = 1; i <= profile->BehaviorProfileLength(); i++) {
173-
(*profile)[i] = lexical_cast<Rational>(std::string(tok.GetNextToken().mb_str()));
174+
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
174175
}
175-
176176
m_profiles.push_back(profile);
177177
if (p_forceShow || m_profiles.size() - GetNumberRows() > 20) {
178178
AppendRows(m_profiles.size() - GetNumberRows());

src/gui/dlnfglogit.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,14 @@ void LogitMixedBranch::AddProfile(const wxString &p_text)
7070

7171
wxStringTokenizer tok(p_text, wxT(","));
7272

73-
m_lambdas.push_back(
74-
(double)lexical_cast<Rational>(std::string((const char *)tok.GetNextToken().mb_str())));
73+
const auto next = tok.GetNextToken();
74+
if (next == "NE") {
75+
return;
76+
}
77+
m_lambdas.push_back(std::stod(next.ToStdString()));
7578

7679
for (size_t i = 1; i <= profile->MixedProfileLength(); i++) {
77-
(*profile)[i] = lexical_cast<Rational>(std::string((const char *)tok.GetNextToken().mb_str()));
80+
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
7881
}
7982

8083
m_profiles.push_back(profile);
@@ -111,7 +114,8 @@ class LogitMixedSheet final : public wxSheet {
111114

112115
LogitMixedSheet::LogitMixedSheet(wxWindow *p_parent, GameDocument *p_doc,
113116
LogitMixedBranch &p_branch)
114-
: wxSheet(p_parent, wxID_ANY), m_doc(p_doc), m_branch(p_branch)
117+
: wxSheet(p_parent, wxID_ANY, wxDefaultPosition, wxSize(800, 600)), m_doc(p_doc),
118+
m_branch(p_branch)
115119
{
116120
CreateGrid(p_branch.NumPoints(), p_doc->GetGame()->MixedProfileLength() + 1);
117121
SetRowLabelWidth(40);
@@ -224,7 +228,7 @@ LogitBranchDialog::LogitBranchDialog(wxWindow *p_parent, GameDocument *p_doc,
224228
m_sheet->AutoSizeCol(0);
225229

226230
auto *sizer = new wxBoxSizer(wxVERTICAL);
227-
sizer->Add(m_sheet, 0, wxALL, 5);
231+
sizer->Add(m_sheet, 0, wxEXPAND | wxALL, 5);
228232
sizer->Add(CreateButtonSizer(wxOK), 0, wxALL | wxEXPAND, 5);
229233

230234
SetSizer(sizer);

0 commit comments

Comments
 (0)