Javascript game program

  • Status Closed
  • Budget $30 - $250 USD
  • Total Bids 7

Project Description

A program using Javascript to simulate 3 cars on a road and a stoplight. Each car is either moving at full speed, which is one unit per second, or it is stopped because of the stoplight. The stoplight is either green or red. If a car is at the same position as the stoplight (i.e. 50), and the stoplight is red, the car stops until the light turns green. You can assume that cars can occupy the same space without regard for each other.

The cars initially start at positions 24, 12, and 0. The stoplight is at position 50, is initially green, and switches every 10 seconds.

This program should simulate 100 seconds of operation. For each second, it should print out a line with the second number, the state of the stoplight and the positions of all three cars. The 'seconds' are simulated, and they can advance through a mechanism of your choosing (eg clicking a button, interval timer, keystroke, etc)

Get free quotes for a project like this
Awarded to:

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online