Lab 5: Concurrency
Due Tuesday, October 5th at 11:59pm.
Work in groups of 3 or 4. These will be the same as your project 1 groups.
Write a simulation of a parking lot as specified below.
- The parking lot has N*M paking spots. Cars can drive around rows of
parked cars.
- The parking lot has a single entry/exit: left upper corner.
- A car is created with a randomly generated parking time between 1 and
4 hours.
- A car enters the parking lot and drives around until it finds a parking
spot. It parks there and waits for the specified time. After that it drives
towards the exit and exits the parking lot.
- No two cars can be on the same spot (parking or driving) at the same
time. If a car needs to drive, but there is another car blocking it, it must
wait or try a different route if available. Blocking is fine.
- Cars are not allowed to drive on parking spots, even if these spots
are empty. They should back up to get out of a parking spot (make it an instant
transformation)
- Start the simulation with some cars already parked at random spots with
random parking time
- The parking lot should be represented as refs and cars as agents.
- The visual representation can be very simple. Reuse the "ants" code
when it fits. Don't forget the license statement and the credit to the
author.
- Adjust the parameters (clock ticks, the number of cars, etc.) as best
fits your simulation.
UMM CSci 4409