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.

  1. The parking lot has N*M paking spots. Cars can drive around rows of parked cars.
  2. The parking lot has a single entry/exit: left upper corner.
  3. A car is created with a randomly generated parking time between 1 and 4 hours.
  4. 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.
  5. 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.
  6. 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)
  7. Start the simulation with some cars already parked at random spots with random parking time
  8. The parking lot should be represented as refs and cars as agents.
  9. 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.
  10. Adjust the parameters (clock ticks, the number of cars, etc.) as best fits your simulation.

UMM CSci 4409

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.