View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Highway Simulation Application

Problem Description:

The problem is to simulate a highway. The highway has 2 lanes and is only one-directional. Vehicles cannot go back, only forward. Most vehicles can change lanes and speed.

There are 4 different types of vehicles that can travel on the highway: Cars, Pickups, Semi-trucks and Cops. There are three different speeds that a vehicle can travel. Let's call them speed1 speed2 speed3, where speed1 speed2 speed3, i.e. speed3 is the fastest speed. If the car has a speed0 it means it is at rest (stopped). Unfortunately not every vehicle can travel at all speeds.

CARS:travel at speed1 and speed2;
generally stay in their lanes.
PICKUPS:travel at speed1 and speed2, and don't stay in their lanes.
SEMI-TRUCKS:go slow, but run cars and pickup trucks over by touching them;
if the car is ran over, it vanishes and prints a message to transcript saying it was ran over.
COPS:can go any speed
can stop all vehicles (cars, pickups, semi-trucks) by touching them;
a stopped vehicle can only restart after a time delay


Additional requirements

We should be able to specify the initial number of cars, pickups, semi-trucks and cops.
A simulation will take care of the rest. If there will be too few vehicles left, it should generate more of them. A log file should be generated with all of the messages from the assumptions sections.

Sample log file:

Simulation started with 2 cars, 2 pickups, 1 semi-truck, 1 cop.

Car1 created running at speed1.
Car2 created running at speed2.
Pickup1 created running at speed 2.
Pickup2 created running at speed 2.
Semi-truck1 created running at speed1.
Cop1 created running at speed3.
Car2 passed Car1.
Pickup1 changed left lane to right lane.
Car1 changed speed1 to speed2.
Pickup2 changed speed2 to speed0.
Semi-truck1 ran over Pickup2.
Pickup2 is destroyed.
Cop1 stopped Pickup2 for 15 time ticks.
Cop1 changed speed3 to speed1.
Car1 changed speed2 to speed0.
Semi-truck1 ran over Car1.
Car1 is destroyed.
Car3 created running at speed1.

Solution You are to Test

Written by Andy Fortier and Cindy Puett, Summer 2000
Missing File (/cs2340/uploads/
To run the application:
In a workspace, type RoadSystemUI start.


The file should file in without any problem.

Link to this Page