fly-in
Python project · graphs, pygame
Drone fleet routing: Dijkstra pathfinding, turn-based scheduling and a pygame replay.
- 16turns on capacity hell (target 35)
- 13on maze nightmare (target 30)
- 44on impossible dream (ref 45)
The problem
Move a fleet of drones from a start hub to an end hub in as few turns as possible, through zones with capacity limits, slow restricted zones and blocked ones.
What I built
- A parser for the custom map format with its own error types.
- Hand-rolled Dijkstra with costs by zone type (priority zones cost 0.9 so the heap prefers them without a tie-breaker).
- Several diverse lanes, found by re-running Dijkstra with a penalty on edges already used, then drones spread lem-in style so shorter lanes take more.
- A dry run of every possible split that keeps the fastest one, so using several paths can never be worse than one.
- A pygame replay with zoom, pan, stepping back and forth, and a frame-by-frame replay of Dijkstra itself.
The hard part
Getting the turn rules exactly right. A drone leaving a zone frees its slot before the next drone is checked in the same turn, which staggers the fleet down each lane, and a slot in a restricted zone is reserved at departure so two drones can never claim it in the same turn.
Built with
- Python 3.10+
- heapq
- Pydantic v2
- pygame-ce
- mypy --strict
More projects
- metro · Lisbon metro sim in pixel art: watch the four lines run, step into any station, board a train and ride it.
- call_me_maybe · Turns a sentence into a JSON function call with a 0.6B model using constrained decoding — parseable by construction, not by luck.
- codexion · Multithreaded twist on the Dining Philosophers: coders compete for shared dongles, with FIFO/EDF scheduling.
- a-maze-ing · Maze generator with multiple algorithms, pathfinding solvers and terminal visualization.
- push_swap · Highly optimized sorting with two stacks and a tiny set of allowed operations.
- ft_printf · printf rebuilt from scratch: chars, strings, pointers, decimals, unsigned and hex.
- get_next_line · Reads a file descriptor one line at a time with careful dynamic memory handling.
- Libft · My own C standard library — the foundation every later 42 project is built on.