diff options
| -rw-r--r-- | go/game/ai.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/go/game/ai.go b/go/game/ai.go index 38823257..ac6fb29a 100644 --- a/go/game/ai.go +++ b/go/game/ai.go @@ -277,11 +277,14 @@ out: } a := fullActions[idx] - options := a.Targets().NextOptions() - if len(options) > 1 { - idx = ai.s.Rand.Intn(len(options) - 1) + for options := a.Targets().NextOptions(); options != nil; options = a.Targets().NextOptions() { + idx = 0 + if len(options) > 1 { + idx = ai.s.Rand.Intn(len(options) - 1) + } + a.Targets().AddTarget(options[idx]) } - a.Targets().AddTarget(options[idx]) + ai.actions <- a } |
