Skip to content
jessesmidtPublic

About

42 school project about drones.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

This project has been created as part of the 42 curriculum by jsmidt.

🚁 Fly-in — Drone Routing Simulation

Description

Fly-in is a drone routing simulation that navigates a fleet of drones through a network of connected zones from a start hub to an end hub in the fewest possible turns. The simulation handles zone capacity constraints, restricted zones with movement costs, priority zones, blocked zones, and connection capacity limits.

The project implements Dijkstra's algorithm from scratch for pathfinding, with a turn-based simulator that moves all drones simultaneously while respecting all constraints.

Algorithm

Pathfinding uses a weighted Dijkstra implementation where zone costs are:

  • normal — 10
  • priority — 9 (preferred over normal)
  • restricted — 20 (costs 2 turns to enter)
  • blocked — unreachable

Drones are assigned paths sequentially each turn, with earlier assignments reserving their next zone to spread drones across different routes. The simulator processes movement in two passes — first determining which drones can move, then executing all moves simultaneously to prevent order-dependent conflicts.

Usage Example

Given the following map file maps/easy/01_linear_path.txt:

nb_drones: 2

start_hub: start 0 0 [color=green]
hub: waypoint1 1 0 [color=blue]
hub: waypoint2 2 0 [color=blue]
end_hub: goal 3 0 [color=red]

connection: start-waypoint1
connection: waypoint1-waypoint2
connection: waypoint2-goal

Running make run and selecting the map produces:

D0-waypoint1
D0-waypoint2 D1-waypoint1
D0-goal D1-waypoint2
D1-goal
Simulation complete in 4 turns

Each line represents one simulation turn. D0-waypoint1 means drone 0 moved to waypoint1 that turn. Drones that don't move are omitted from the output.

Instructions

Prerequisites

  • Python 3.10+
  • uv — install with curl -LsSf https://astral.sh/uv/install.sh | sh

Installation

make install

Run

make run

This will present a file picker to select a map from the maps/ directory. The simulation runs with a pygame visualizer by default.

Other commands

make debug       # run with pdb debugger
make lint        # run flake8 + mypy
make lint-strict # run mypy --strict
make clean       # remove caches

Visual Representation

The pygame visualizer was built by rmoll and displays the drone network as an interactive graph with:

  • Zones rendered as colored circles matching their map color
  • Connections shown as lines between zones
  • Drones animated as 🚁 moving between zones
  • Capacity bars showing zone occupancy in real time
  • Turn counter and delivery progress bar
  • Speed control with + and - keys
  • R to restart, Q or ESC to quit

Resources

AI Usage

Claude (Anthropic) was used throughout this project for guidance on OOP design decisions, debugging simulation logic, and understanding algorithm implementation. All code was written and understood by the author — AI was used as a learning tool and sounding board, not a code generator.

About

42 school project about drones.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages