目录

Traffic Simulation System

A simple Python command-line traffic simulation for a four-way intersection.

Run

python traffic_simulation.py

Example with custom options:

python traffic_simulation.py --steps 20 --arrival-rate 0.45 --green-time 4 --cars-per-step 2 --seed 7

What It Simulates

  • Four roads: north, south, east, and west.
  • A traffic light that alternates between north/south and east/west.
  • Random vehicle arrivals.
  • Queues for each road.
  • Basic statistics: created vehicles, passed vehicles, waiting vehicles, and average wait time.
关于

这是我们开源软件设计的小项目:交通仿真系统

50.0 KB
邀请码