Python · hackathon
Robot Router
Our team's entry for the Amazon Robotics Hackathon 2026, built with Jaden and Liam as team CookieLovers. Warehouse robots carry shelves of inventory to pick stations through narrow aisles, and our code decides every robot's next move so they don't jam each other up.
try it
Three robots, fourteen pods, one-lane aisles
Pods show up at the storage areas on the left over time, and each one needs to get to the dock that matches its colour. Only one robot fits on an aisle spot or a dock at a time. Pick a brain and press play.
The demo is a small JavaScript version of the same idea so it can run here: the hackathon's movement and scoring rules, a simpler search, and every move takes one step. The real router is Python and is in the repo.
how it works
The challenge
The floor is a graph of storage spots, stations and aisles. Every time step the game asks our function where each idle robot should go next. Pickups and drop-offs happen on their own. Each pod scores 100 × e−time/50, so slow deliveries lose points and a pod that never arrives scores nothing.
A planner, not a reflex
The game is fully predictable and hands us the whole floor, so instead of reacting ("go to the closest pod") we plan. Each step we work out a full plan for every robot, test it, improve it, and play only its first move. Next step we do it again with whatever changed.
Booking the floor ahead of time
A reservation table records who will be where and when: "robot 2 is in this aisle during steps 10 to 13." It follows the game's capacity rules exactly, including that the lower-numbered robot wins a tie. That lets us see a traffic jam before it happens.
A* through time
Normal A* finds which places to visit. Ours searches over (place, time) pairs, so its answer can be "wait here two steps, then take the narrow aisle once the other robot is through." Robots are routed one at a time in a priority order, each one around the bookings of the ones before it.
Check the plan by playing it
We wrote an exact copy of the game's step loop. Every candidate plan gets played out on it and scored with the real formula. Since the game is deterministic, that score isn't a guess, so plans are compared by what they'd actually earn.
Making the plan better
New pods are slotted into the best spot in some robot's to-do list. Then a local search keeps trying changes (hand a pod to another robot, swap two pods, reorder stops, change who goes first) and keeps whatever scores higher. The best plan carries over to the next step, so work isn't thrown away.
Staying under the clock
Each call has to answer within 1 second and each test case within 2 minutes. The planner works on a budget: 0.25 s for the first plan, less when nothing new happened, and 45 s total per case. If anything ever goes wrong, a simple shortest-path move takes over, so it never sends the robot something invalid.
the tricky parts
Testing like a grader
The final score came from hidden test cases, so we built our own: a generator that made 130+ random floors, ten nasty hand-made ones (pods nobody can reach, robots starting on a dock, one-way loops), and a benchmark that compares every run to the best score possible. On the provided cases we scored 84.2 against 58.7 for the example driver and delivered every pod.
Knowing when to stop
We tested whether more effort would help: three times the thinking time, a search that tries every possible plan, even letting it see future pods. None gained more than half a point. The remaining gap was robots getting in each other's way and travel time, not a weak search, so we stopped tuning.