← cd ~
~/42-firenze/fly-in
42 firenze · milestone 3 · python
Fly-In
A fleet of drones has to get from a start hub to an end hub through a graph of zones, in the fewest possible turns. Every zone has a movement cost and a capacity, and links can be capacity-limited too. A restricted zone takes two turns to cross, and the drone can't stop halfway. All drones move at the same time, and the engine resolves conflicts turn by turn.
normalpriorityrestricted (2 turns)blockeddrone in transit×n = zone capacity
Replay of the real output of : . Every map in the repo's data/maps, from easy to custom.
how it works
- Parser: a custom
.mapformat, checked for syntax, metadata and referential integrity, with errors reported by line number. Pydantic models hold the parsed schema. - Pathfinding: a weighted Dijkstra written without graph libraries. Zone type sets the cost, and priority zones win ties.
- Scheduling: k-distinct paths spread the fleet across alternative routes, so everyone isn't queuing on the same shortest path.
- Simulation: each turn enforces zone capacity, link capacity and the in-flight rule for restricted zones, and detects deadlocks. Drones wait strategically instead of colliding.
- Quality: each stage is its own class (parser, graph, pathfinder, engine, visualizer). Tested with pytest and type-checked with mypy --strict.