Skip to content

A simulation developed from scratch using Pygame to simulate a 4-way traffic intersection having traffic lights with timer.

License

Notifications You must be signed in to change notification settings

amit2011/Basic-Traffic-Intersection-Simulation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simulation output

Basic Traffic Intersection Simulation

Python version License: MIT

A simulation developed from scratch using Pygame to simulate the movement of vehicles across a traffic intersection having traffic lights with a timer.


Description

  • 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.


Demo

The video below shows the final output of the simulation.


Prerequisites

Python 3.1+


Installation

  • 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

Author

Mihir Gandhi - mihir-m-gandhi


License

This project is licensed under the MIT - see the LICENSE file for details.

About

A simulation developed from scratch using Pygame to simulate a 4-way traffic intersection having traffic lights with timer.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%