Traffic simulation in Javascript