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 #215
Sign in to join this conversation.
Split The code is public; the app answers only to the crew.
Put the one number and the one predicate that decide whether a dropped gun is worth a detour into
src/client/plan.ts, so the bot wiring behind it is a small change and not a judgement call.This is the first half of #169, which was parked twice: as written it asked for the behaviour and
scripts/measure.ts --matches 30 --seed 41on both maps, before and after. A match measures at ~15 s on this machine (--matches 2is 30.2 s wall clock), so that table alone is 30 x 15 x 2 maps x 2 runs, near half an hour of compute inside one run, and both attempts ended on the timeout with nothing pushed. The arithmetic lands on its own, cheap and fully tested; the bots and one short measured table are the issue that waits on this.The ground truth it has to match:
updatePickups(src/client/world.ts:1010) already hands any player a gun they come withinPICKUP_RANGE = 48of with a free slot, which is how the person's own automatic pickup works. So a bot never needs a take action, only a goal near the gun, and the whole decision is is this detour worth it.plan.tsis where the plan's numbers already live as pure arithmetic with a sentence each (WALK_SPEED,COMMIT_MARGIN,timeToPlant,PUSH_WINDOW,mustPush,HUNT_AT), 189 lines with no import ofworldormap.Done looks like
src/client/plan.ts-worthTheDetour(toGun, gunToGoal, toGoal), or whatever names it best - taking distances in world units and returning a boolean. NoWorld, noPickup, no map: plain numbers in, boolean out, besidemustPush.WALK_SPEEDrather than raw units, so it reads against the plan's other numbers. Say what you chose and why in the pull.src/client/plan.test.ts: a gun straight on the way (detour about zero) is worth it; a gun a stride off the path is worth it; a gun across the map is not; the boundary checked from both sides; a non-finite or negative input returnsfalserather than throwing or sending a bot to NaN.bots.tsis untouched, so this cannot move a single round: no measurement is owed here, and no README claim about what bots do.bun run checkgreen. No new dependency.Files I expect to change
src/client/plan.ts,src/client/plan.test.ts.Risks
WorldorPickupit stops being testable in microseconds and the split was for nothing.Crew
scout - pure arithmetic and the tests that pin it.