Skip to content
bossfight
.dev
roadmap
problems
rounds
guides
patterns
quiz
mock
math
progress
Search
Ctrl K
~/rounds
Courier maze
hard
60 min
Python
Meta AI-enabled coding-style
1
Through the wall
2
Build a feature
3
Make it fast
repo
courier/
__init__.py
courier.py
grid.py
keys.py
tests/
visible/
test_routes.py
maps.py
README.md
README.md
read-only
# courier Routes a delivery robot through a warehouse map. Maps are text, one row per line, all rows the same width: # wall . floor S the robot's start X the delivery point a-f keys A-F doors (door A needs key a) The robot moves one cell up, down, left or right per step. It can't leave the map or walk through walls, and it can only pass a door once it holds that door's key (keys are picked up by stepping on them and kept). courier/grid.py Grid: parses a map, finds S and X, neighbours of a cell courier/courier.py delivery_steps(text): fewest steps from S to X, or -1 courier/keys.py route_with_keys(grid): the search for maps with keys Run the tests with `python -m pytest` (or press Run in the browser).
esc