- It contains a 4-way traffic intersection with traffic signals controlling the flow of traffic in each direction.
- Each signal has a timer on top of it which shows the time remaining for the signal to switch from green to yellow, yellow to red, or red to green.
- Vehicles such as cars, bikes, buses, and trucks are generated, and their movement is controlled according to the signals and the vehicles around them.
- This simulation can be further used for data analysis or to visualize AI or ML applications.
Find a step-by-step guide to build this simulation here.
The video below shows the final output of the simulation.
- Step I: Clone the Repository
$ git clone https://github.com/mihir-m-gandhi/Basic-Traffic-Intersection-Simulation
- Step II: Install the required packages
# On the terminal, move into Basic-Traffic-Intersection-Simulation directory
$ cd Basic-Traffic-Intersection-Simulation
$ pip install pygame
- Step III: Run the code
# To run simulation
$ python simulation.py
Mihir Gandhi - mihir-m-gandhi
This project is licensed under the MIT - see the LICENSE file for details.