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-08-20 15:57:29 +0200
commitd8386510cef293f57cd8d066753c900420997740 (patch)
tree018ab99377d8ede7ff7631a691e67d21b439c978
parentbfec366ed246ad56860b564fc648a74d71d8ec10 (diff)
downloadmuhqs-game-d8386510cef293f57cd8d066753c900420997740.tar.gz
muhqs-game-d8386510cef293f57cd8d066753c900420997740.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
}
}