Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

eugeneglova/simplified-traffic-simulation

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
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

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.