Welcome to the Traffic Simulation project! π This simulation models a bustling intersection with two roads crossing each other, each featuring one lane in each direction. The goal? Keep vehicles moving smoothly and avoid collisions at all costs!
North
| β | β |
| β | β |
| | |
| | |
| | |
| | |
_______________| | |_______________
β β β β
East --------------- --------------- West
β β β β
_______________ _______________
| | |
| | |
| | |
| | |
| | |
| β | β |
| β | β |
South
- The simulation features two roads forming a crossroads.
- Each road has one lane in each direction.
- Vehicles choose their path by turning left, right, or going straight through the intersection.
- Traffic lights control traffic flow at each lane's entrance to the intersection.
- Lights cycle between red and green.
- Design your own algorithm to minimize congestion (max 8 vehicles) and prevent collisions.
- Vehicles follow specific rules:
- Each vehicle is color-coded based on its intended route.
- Fixed velocity and safe following distance are maintained.
- Vehicles stop at red lights and proceed on green.
- Routes cannot be changed mid-simulation.
- No special priority is given to emergency vehicles.
-
Use these keyboard commands to interact with the simulation:
- Arrow Keys:
- β (Up): Spawn a vehicle heading south.
- β (Down): Spawn a vehicle heading north.
- β (Right): Spawn a vehicle heading west.
- β (Left): Spawn a vehicle heading east.
- r: Spawn a vehicle in a random direction.
- Esc (Escape): End the simulation.
- Arrow Keys:
-
Vehicles spawn with adequate spacing to prevent collisions.
- Start the simulation and observe traffic dynamics at the intersection.
- Use arrow keys to introduce vehicles and witness their interactions.
- Manage traffic lights to optimize vehicle flow.
- Press Esc to gracefully conclude the simulation.
- Yassine Naanani
- Brice Delemos Dit Pereira
- Louis Pleintel
Contact us on: [email protected]
This project is licensed under the MIT License. See the MIT License file for details.
Enjoy managing your virtual intersection and keeping traffic flowing smoothly! π¦π