Skip to content

Commit 6ad7010

Browse files
committed
Corrects parsing problem in GUI with output of QRE tracing.
The parsing of the command-line output of the QRE tracers was not handling correctly the final (approximate Nash) profile. This corrects this problem. Closes #172.
1 parent ddc8cd2 commit 6ad7010

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [16.3.2] - unreleased
4+
5+
### Fixed
6+
- Parsing of output of `gambit-logit` in the graphical interface did not handle the
7+
terminal Nash profile correctly. (#172)
8+
9+
310
## [16.3.1] - 2025-08-18
411

512
### Fixed

src/gui/dlefglogit.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,14 @@ void gbtLogitBehavList::AddProfile(const wxString &p_text, bool p_forceShow)
174174
auto profile = std::make_shared<MixedBehaviorProfile<double>>(m_doc->GetGame());
175175

176176
wxStringTokenizer tok(p_text, wxT(","));
177-
178-
m_lambdas.push_back((double)Gambit::lexical_cast<Gambit::Rational>(
179-
std::string((const char *)tok.GetNextToken().mb_str())));
180-
177+
const auto next = tok.GetNextToken();
178+
if (next == "NE") {
179+
return;
180+
}
181+
m_lambdas.push_back(std::stod(next.ToStdString()));
181182
for (size_t i = 1; i <= profile->BehaviorProfileLength(); i++) {
182-
(*profile)[i] = Gambit::lexical_cast<Gambit::Rational>(
183-
std::string((const char *)tok.GetNextToken().mb_str()));
183+
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
184184
}
185-
186185
m_profiles.push_back(profile);
187186
if (p_forceShow || m_profiles.size() - GetNumberRows() > 20) {
188187
AppendRows(m_profiles.size() - GetNumberRows());

src/gui/dlnfglogit.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ void LogitMixedBranch::AddProfile(const wxString &p_text)
7474

7575
wxStringTokenizer tok(p_text, wxT(","));
7676

77-
m_lambdas.push_back(
78-
(double)lexical_cast<Rational>(std::string((const char *)tok.GetNextToken().mb_str())));
77+
const auto next = tok.GetNextToken();
78+
if (next == "NE") {
79+
return;
80+
}
81+
m_lambdas.push_back(std::stod(next.ToStdString()));
7982

8083
for (size_t i = 1; i <= profile->MixedProfileLength(); i++) {
81-
(*profile)[i] = lexical_cast<Rational>(std::string((const char *)tok.GetNextToken().mb_str()));
84+
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
8285
}
8386

8487
m_profiles.push_back(profile);

0 commit comments

Comments
 (0)