Skip to content

The "Road Intersection Simulation Project" is designed to tackle the challenge of traffic congestion in a simulated environment that represents a busy intersection in a capital city.

Notifications You must be signed in to change notification settings

abdotop/road_intersection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Road Intersection Simulation Project

Objectives

The primary goal of this project is to address the traffic congestion problem in a simulated environment representing a capital city's intersection. The project involves creating a traffic control strategy and visualizing it through a simulation using the SDL2 library.

Instructions

Environment and Rules

1. Roads

  • Construct two roads intersecting each other, each with one lane per direction.
  • Vehicles can turn left, right, or continue straight at the intersection.

2. Traffic Lights

  • Install traffic lights at each lane entering the intersection, with only red and green signals.
  • Implement an algorithm to manage these lights, ensuring minimal traffic congestion and preventing vehicle collisions.

3. Vehicles

  • Vehicles must be color-coded based on their intended route.
  • Vehicles cannot change their selected route once on the road.
  • Each vehicle maintains a fixed velocity and a safe following distance.
  • Vehicles must stop at red traffic lights and may proceed on green.

Commands

  • Use arrow keys to spawn vehicles from different directions.
  • Press 'r' to spawn a vehicle from a random direction.
  • Press 'Esc' to end the simulation.
  • Ensure vehicles maintain a safe distance to prevent spamming and collisions.

Example

An example of the road intersection can be viewed here.

Bonus Features (Optional)

Notions

For more information on using the SDL2 library, refer to the SDL2 documentation.

Conclusion

This simulation aims to provide a practical solution to traffic management at a busy city intersection, enhancing traffic flow and safety.

About

The "Road Intersection Simulation Project" is designed to tackle the challenge of traffic congestion in a simulated environment that represents a busy intersection in a capital city.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages