Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/gui/dlnash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ bool RequiresStrategicRepresentation(const NashMethodSpec &p_method)
p_method);
}

bool RequiresStrategicRepresentation(const NashMethodSpec &p_method, bool p_recommended)
{
return RequiresStrategicRepresentation(p_method) ||
(p_recommended && std::holds_alternative<LCPNashSpec>(p_method));
}

bool UsesRationalOutput(const NashMethodSpec &p_method)
{
return std::visit([]<typename Method>(const Method &) { return RationalOutputMethod<Method>; },
Expand Down Expand Up @@ -426,7 +432,8 @@ void NashChoiceDialog::UpdateRepresentationChoice()
}
const auto method = ResolveMethod(m_methodChoice->GetStringSelection(),
GetTarget(m_countChoice->GetSelection()), m_doc->GetGame());
if (RequiresStrategicRepresentation(method)) {
if (RequiresStrategicRepresentation(method,
m_methodChoice->GetStringSelection() == s_recommended)) {
m_repChoice->SetSelection(1);
m_repChoice->Enable(false);
}
Expand All @@ -444,12 +451,12 @@ NashComputationSpec NashChoiceDialog::GetComputation() const
{
const auto target = GetTarget(m_countChoice->GetSelection());
auto method = ResolveMethod(m_methodChoice->GetStringSelection(), target, m_doc->GetGame());
const auto representation =
!m_repChoice || m_repChoice->GetSelection() == 1 || RequiresStrategicRepresentation(method)
? NashRepresentation::Strategic
: NashRepresentation::Behavior;
return {representation, target, std::move(method),
m_methodChoice->GetStringSelection() == s_recommended};
const bool recommended = m_methodChoice->GetStringSelection() == s_recommended;
const auto representation = !m_repChoice || m_repChoice->GetSelection() == 1 ||
RequiresStrategicRepresentation(method, recommended)
? NashRepresentation::Strategic
: NashRepresentation::Behavior;
return {representation, target, std::move(method), recommended};
}

std::shared_ptr<AnalysisOutput> NashChoiceDialog::GetCommand() const
Expand Down
Loading