aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-24 05:28:56 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-07-24 12:22:10 -0400
commit9175de76012680eb10807380c64156a723d48fae (patch)
tree5904d8bd4932ac796ed51078608c73d444953ea6
parente78e8fb6ae67e9cd188515c1c806dfa2751327c4 (diff)
downloadmuhqs-game-9175de76012680eb10807380c64156a723d48fae.tar.gz
muhqs-game-9175de76012680eb10807380c64156a723d48fae.zip
panic if unit ai posts a nil action
-rw-r--r--go/game/ai.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/go/game/ai.go b/go/game/ai.go
index 07440899..abdebba4 100644
--- a/go/game/ai.go
+++ b/go/game/ai.go
@@ -577,7 +577,6 @@ func TargetOrientedAI(ai *UnitAI) {
// If there is no special case for a unit, a rough heuristic is used to determinw the AI.
// Units with full actions are shy and everything else is aggresive.
func SuggestUnitAI(unit *Unit) string {
- log.Println(unit.card.Name)
switch unit.card.Name {
case "King":
return "shy"
@@ -660,6 +659,9 @@ func (ai *SimpleAiControl) handlePriority() Action {
u.tap()
continue
}
+ if a == nil && more {
+ log.Fatal(uAi, "returned a nil action")
+ }
return a
}
}