aboutsummaryrefslogtreecommitdiff
path: root/go/game/state.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-21 08:36:36 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:27 +0200
commit4a64688d77096e198a1cca03948acdcf46bb0dfd (patch)
tree6545776ec0c53a6d831e53da549f777326788afe /go/game/state.go
parent4cfe2d81345bc3807bed3facd9a222dd6e789435 (diff)
downloadmuhqs-game-4a64688d77096e198a1cca03948acdcf46bb0dfd.tar.gz
muhqs-game-4a64688d77096e198a1cca03948acdcf46bb0dfd.zip
add comments and action assertion
Diffstat (limited to 'go/game/state.go')
-rw-r--r--go/game/state.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/go/game/state.go b/go/game/state.go
index 1c773618..d5a9bfc6 100644
--- a/go/game/state.go
+++ b/go/game/state.go
@@ -51,6 +51,7 @@ func (s *LocalState) Players() []*Player {
return s.players
}
+// PlayerById returns the player using its 1-based identifier.
func (s *LocalState) PlayerById(id int) *Player {
return s.players[id-1]
}
@@ -457,6 +458,7 @@ func (s *LocalState) declareAction(a Action) {
if err == nil {
t := a.Targets()
if t != nil {
+ // FIXME: seperate between targets choices implemented as target
s.events = append(s.events, newTargetEvent(a, t))
}
}
@@ -524,6 +526,8 @@ func (s *LocalState) allPassing(skipFirst bool) bool {
switch a := _a.(type) {
case *PassPriority:
log.Printf("%s passed %d/%d\n", p.Name, i+1, nPlayers)
+ case nil:
+ log.Fatal("received nil action from ", p.Name, " at ", s.activePhase)
default:
s.declareAction(a)
return false