This is way too complicated. How could we simplify it? Or we could make it a 2-week problem, and have a blessing of the class diagrams after a week. =================================================================== Your task is to create a traffic simulation. Your simulation should perform an animation and collect some statistics about the simulation. The simulation involves cars, traffic lights, and a street. Cars enter the street at a regular rate and proceed from the left end of the street to the right end, where they travel off the screen. Cars stop for a red light, and when they reach the car ahead of them. A traffic light is a rectangle 60 pixels high and 20 pixels wide. It is either red or green. It is green 50% of the time, and red 50% of the time. A car is a rectangle 10 pixels high and 20 pixels long. It normally travels at 5 pixels per tick. If the front bumper of the car would enter a red traffic light, then the car stops at the traffic light. If the car is already in the intersection when the traffic light turns red, it keeps going (this is Boston, after all!). If the front bumper of the car would touch the car ahead of it, it stops 5 pixels short of the car, so there are no collisions (ok, so it's not a perfect model of Boston!). If the car is the first one stopped at a traffic light, it resumes moving one tick *after* the light turns green. If the car is stopped behind another car, it also resumes moving one tick *after* the car ahead of it starts moving. (Hence it will wind up 10 pixels behind the car ahead of it: it starts 5 pixels behind and waits 1 tick = 5 pixels before starting. The street is 1000 pixels long. There are two traffic lights, whose left edges are at the 300 and 700 pixel points. The first starts red and the second starts green. There are two parameters to the simulation: 1. The rate at which cars enter the simulation (every R ticks, starting at tick 0). 2. The length of the cycle for the traffic lights (they change state every C ticks). Design and implement this simulation using the idraw package. Your simulation should check, at every step, that no collision has occurred. Your simulation should end when 10 cars have reached the end of the street. When the simulation ends, it should report the average length of time (in ticks) that it took the 10 cars to get all the way down the street. Try varying R and C to see how fast you can get the cars through the simulation. Try varying them to see how slowly you can make them go.