aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ct1986.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/ct1986.c b/include/ct1986.c
index 1d1d253..5e1c0fc 100644
--- a/include/ct1986.c
+++ b/include/ct1986.c
@@ -217,7 +217,12 @@ ct1986_minimax(const uint8_t cur_depth, const uint8_t max_depth,
carry = 0;
drops[idx]++;
do {
- if (carry) { drops[++idx]++; carry = 0;}
+ if (carry) {
+ idx++;
+ if (idx >= steps) break;
+ drops[idx]++;
+ carry = 0;
+ }
if (drops[idx] > count || drops[idx] > 5) {
drops[idx] = 1; carry = 1;
}