maudnals / trams

JS coding challenge: crossing tramways

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trams

JS coding challenge: crossing tramways

Challenge

3 trams are moving on different railways from one station to another, with the same speed. They need to circulate from end to end on their own railway.

Every tram has assigned different number of people. In case 2 trams or more arrive to a cross at the same time, the one with the higher number of persons should pass first. We need to make the trams circulate on their railways avoiding collisions and following the priority rules.

A graphical solution for the problem is required.

Notes:

  • The space between stations are the same.
  • A tram avoids a collision stopping in the previous station and letting the tram with higher priority to get the next station.

Solution

https://maudnals.github.io/trams/index.html

About

JS coding challenge: crossing tramways


Languages

Language:JavaScript 82.8%Language:HTML 9.4%Language:CSS 7.8%