From 4ff58fadf5b6158dfb5f89f2545f21131661bb3d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 25 Jan 2024 13:26:47 +0100 Subject: 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. --- rules.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'rules.js') 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 } -- cgit v1.2.3