village-builder

VB-236: The route cache is cleared when a tile’s cost changes

Status: done (2026-11-15) Priority: 3 Size: S Arch: yardstick Phase: implement Design ref: none (code structure). AGENTS.md, Rules for cost, 8 (bound every cache). Goal: refreshRoutes (src/sim/routes.js) tests every cached route each night against the tiles whose walking cost changed, with unrolled hex arithmetic and a test in two bounds, to drop about 130 of 30,000. Emptying the cache when any tile changed takes the same time a game day at the late fixtures, with a tenth of the routes held. Replace the selective refresh with the clear, and lower ROUTE.cacheMax to what the clear leaves in use. Acceptance criteria:

Implementation and validation (14-15 Nov 2026, agent)