From 7b148fe16cd87a6043c3350b92a479d78f6415c5 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 24 Jul 2025 05:42:50 -0400 Subject: check the wincondition after the state based actions --- go/game/stack.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'go/game/stack.go') diff --git a/go/game/stack.go b/go/game/stack.go index a4ba6a49..62783bf2 100644 --- a/go/game/stack.go +++ b/go/game/stack.go @@ -45,11 +45,22 @@ func (s *Stack) pop() { } } -func (s *Stack) resolve() { +func (s *Stack) resolve() []*Player { for !s.IsEmpty() { - for !s.gameState.allPassing(false) { + for { + passing, w := s.gameState.allPassing(false) + if len(w) > 0 { + return w + } + if passing { + break + } } s.pop() - s.gameState.stateBasedActions() + w := s.gameState.stateBasedActions() + if len(w) > 0 { + return w + } } + return nil } -- cgit v1.2.3