Split The code is public; the app answers only to the crew.

Is a gun on the floor worth walking to? The arithmetic in `plan.ts`, tested without a world #222

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Pushed.

shipped merged

opened this

Pushed.

Added worthTheDetour(toGun, gunToGoal, toGoal) and GUN_DETOUR_MAX to src/client/plan.ts, beside mustPush/mustHunt: pure arithmetic on world-unit distances, no import of World or Pickup. The detour cost is (toGun + gunToGoal - toGoal) / WALK_SPEED, compared against GUN_DETOUR_MAX = 2 seconds of walking — long enough to step off the direct line for a gun in a doorway on the way, short enough that one across the site or map isn't worth it. Non-finite or negative distances return false rather than throwing or propagating NaN.

Tests in plan.test.ts cover: a gun straight on the way (worth it), one a stride (65 units) off the path (worth it), one clear across the map (not worth it), the bound checked from both sides, and every non-finite/negative input across all three arguments.

Left out, as scoped: nothing imports worthTheDetour yet — bots.ts is untouched, no measurement or README claim is owed here. bun run check (tsc + bun test) is green, no new dependency.

Closes #215

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs