diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-03 21:48:58 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-06 11:49:19 -0400 |
| commit | d4e6d843dc71b68a34f1aa2eed84e5fe20af3589 (patch) | |
| tree | ee25b7ef22ee4408325642c65d26784646f5ff37 /go/game/winCondition.go | |
| parent | fa5c66a13d7c182f44c9fa52c216e4d0f455ea29 (diff) | |
| download | muhqs-game-d4e6d843dc71b68a34f1aa2eed84e5fe20af3589.tar.gz muhqs-game-d4e6d843dc71b68a34f1aa2eed84e5fe20af3589.zip | |
support king games
Diffstat (limited to 'go/game/winCondition.go')
| -rw-r--r-- | go/game/winCondition.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/go/game/winCondition.go b/go/game/winCondition.go index 4204ccb1..d08f4135 100644 --- a/go/game/winCondition.go +++ b/go/game/winCondition.go @@ -4,6 +4,15 @@ import ( "golang.org/x/exp/slices" ) +// A WinCondition determines if there are winners using the current game state. +type WinCondition func(*LocalState) []*Player + +// DummyWinCondition always return an empty winner slice. +func DummyWinCondition(*LocalState) []*Player { + return []*Player{} +} + +// KingGame reports the winners of a game using kings. func KingGame(s *LocalState) []*Player { foundKings := map[*Player]struct{}{} for _, u := range s.Units() { |
