Skip to content

Commit f748a34

Browse files
committed
STLize IsSubgameRoot check
1 parent 5f17628 commit f748a34

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/games/gametree.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,11 @@ bool GameNodeRep::IsSubgameRoot() const
373373
for (auto infoset : player->GetInfosets()) {
374374
const bool precedes =
375375
infoset->m_members.front()->IsSuccessorOf(const_cast<GameNodeRep *>(this));
376-
for (size_t mem = 0; mem < infoset->m_members.size(); mem++) {
377-
if (infoset->m_members[mem]->IsSuccessorOf(const_cast<GameNodeRep *>(this)) != precedes) {
378-
return false;
379-
}
376+
if (std::any_of(std::next(infoset->m_members.begin()), infoset->m_members.end(),
377+
[this, precedes](GameNodeRep *m) {
378+
return m->IsSuccessorOf(const_cast<GameNodeRep *>(this)) != precedes;
379+
})) {
380+
return false;
380381
}
381382
}
382383
}

0 commit comments

Comments
 (0)