summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-01-25 13:26:47 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-25 13:29:53 +0100
commit4ff58fadf5b6158dfb5f89f2545f21131661bb3d (patch)
tree5fef3e8a22596be1589452e7e6ffd688d8721ebb
parent947cb4236b76468341f3e476b6a345945afd38f9 (diff)
downloadrommel-in-the-desert-4ff58fadf5b6158dfb5f89f2545f21131661bb3d.tar.gz
Fix bug in initial supply outward scan.
TRACE_TRACK_2 is worse than TRACE_TRAIL_1, stopping us early in some cases. See game 57264 at move 934 where the initial trace stops at Sidi Mufta and does not continue to Bri Hacheim because we reached it via the track before the trail.
-rw-r--r--rules.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/rules.js b/rules.js
index 1c64aac..a436101 100644
--- a/rules.js
+++ b/rules.js
@@ -1179,8 +1179,8 @@ function is_supply_line_blocked(here, next, side) {
const TRACE_HIGHWAY = 0
const TRACE_TRACK_1 = 1
-const TRACE_TRACK_2 = 2
-const TRACE_TRAIL_1 = 3
+const TRACE_TRAIL_1 = 2
+const TRACE_TRACK_2 = 3
const TRACE_STOP = 7
const TRACE_ABORT = 8
@@ -1241,12 +1241,9 @@ function trace_supply_network_1(start)
if (next_move === TRACE_ABORT)
continue
- if (side_road[side] === HIGHWAY)
- supply_line[side] = 1
- else
- supply_line[side] = 1
+ supply_line[side] = 1
- // already seen
+ // already seen (at same or better)
if (next_move >= supply_visited[next])
continue
@@ -1255,10 +1252,8 @@ function trace_supply_network_1(start)
next_move = TRACE_HIGHWAY
supply_visited[next] = next_move
- if (side_road[side] === HIGHWAY)
- supply_net[next] = 1
- else
- supply_net[next] = 1
+
+ supply_net[next] = 1
if (next_move !== TRACE_STOP)
queue.push((next << 3) | next_move)
@@ -1483,6 +1478,7 @@ function trace_supply_network(start) {
}
trace_supply_network_3()
+
supply_net[start] = 1
}