/traffic-simulator

3rd place for LEC Hacks 2021

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Traffic simulator

Project for a hackathon. Built in less than 11 hours, Won 3rd place. Can be used here.

How it works

  • Traffic simulator, which lets you change settings, speed, and light algorithms
  • Simulates the movement of cars on screen
  • Gives results of live wait times and algorithm efficiency

Used Libraries

  • p5.js graphics library

Features

  • completely self-contained - the cars are controlled by their position and the status of their lights. The system controls itself, with algorithms only controlling the light state, and the cars being controlled by the lights.
  • Simulation is randomized - something essential for accurate simulations
  • Runs with 48 cars, pushes cars into arrays one in a while, controlled by settings
  • Lets user change timing, such as light timing and car speed
  • User can change tailgate, the distance that cars tailgate each other

Media