Title: Busy Intersection
Student: Jason Smale, CAP4800 (Student Project)
Abstract:
This world is a model of an intersection with a traffic light. The traffic light runs on a
timer that automatically goes through 4 different states. The initial state is GR, which
means Green for the North-South street and Red for the East-West street. It holds there
for 15 time units, and then changes to AR (Amber and Red). Two time units later, the state
changes to RG, where it holds for another 15 time units. After that it changes to it's
final state of RA, which holds for two time units until returning to the initial GR state.
Each car has also been modeled to react to the traffic light and the cars around it. If
there are no cars in front of it, and the traffic light is green, the car moves at it's
maximum speed which is a factor of 3. If the traffic light has turned amber or red, and it
is within 1 space unit, the car slows to speed factor of 1 and comes to a stop in front of
the light. If there is another car in front of it, but there is more than 1 space units in
between them, the car will move at a speed factor of 2. If there is less than one space
unit between them, the car moves at a speed factor of 1. If there is no space between
them, the car comes to a halt.
Motivation: I enjoy driving, and I would also like to create
driving/racing simulations in my career.
Simulation: The world is self-starting, being controlled by the clock.
The only interaction that can be done is by changing views. The default view is an angled
view to see both roads and the traffic light clearly. The next view is to the top of the
traffic light where the FSM of the traffic signal sits. The last two views are down street
views of both the North-South, and the East-West streets.
Metaphors: The FSM is on top of the traffic light.
The states are stop signals, and the transitions are traffic
cones (done in green so they don't blend in with the traffic light).
Models: The model for the traffic signal is an FSM driven by the clock.
The model for the cars is also an FSM driven by input received from the traffic light and
the car in front of it. The actual state of each car is it's current speed factor (ranging
from 0 to 3).
Here is the World
Lessons: I had no real problems implementing my model. The most
complicated part was coding the behavior for each car, but a pen and paper analysis of the
problem helped me to arrive at a simple solution.