Skip to content

eugeneglova/simplified-traffic-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

A Simplified Traffic Simulation

Consider a 4-lane traffic junction, controlled by one set of traffic lights which are located at position 50. When a vehicle reaches the same position as the traffic lights, it must obey the state of the lights. If the lights are red, the vehicle cannot move forward. If the lights are green, the vehicle can move forward. The traffic lights change every 10 seconds.

Assumptions

All traffic is moving in the same direction. When traveling, all vehicles move at the same, constant speed, of one vehicle length per second. Initial vehicle positions are 0, 12, 20, 24 The simulation runs until all vehicles pass through the traffic lights.

Solution

  • written using pure JavaScript
  • function as expected without any defects
  • make good use of OO design principles
  • represent the type of code that you would produce

Run

node app

About

A Simplified Traffic Simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published