Skip to content

simohammadi/TraficSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic simulation in Java

The main method will run a traffic simulation of one of the intersections in Uppsala

The simulations output will be of the following format.

  • ------------- Time = 1 ----------------------

(R)<[W, W, W, W, W, W, W, W]><[W, S, W, W, S, W, W, W, S, S]> Q [W, S, W, S]

(R)<[S, ., ., ., ., ., ., .]>

  • ------------- Time = 2 ----------------------

(R)<[W, W, W, W, W, W, W, W]><[W, S, W, W, S, W, W, W, S, S]> Q [W, S, W, S]

(G)<[S, ., ., ., ., ., ., .]>

The first line corresponds to the trafic lights beeing either (G)-green or (R)-red.

The letters inside the array gives the heading of the vehicle, either S-South or W-West.

The Q-queue array is where cars wait if both arrays are full.

Once the simulation has reached 100 steps the user can choose to quit or continue the simularion for another 100 steps.

About

Traffic simulation of a intersection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages