# Lift Simulator ## Implementation Details: ### Added Semaphores: 1. **Print statement wrapped in a semaphore**, to control printing to the console. (There is a possibility that the console print position could be changed if the currently printing thread was interrupted) 2. Added a `queueInteraction` semaphore to the `floor_info` struct. The idea of this is that only one lift-call button can be pressed at a time; this prevents more than one person in the queue interacting with the lift. 3. `addToStop` added to the `lift_thread` - this semaphore communicates if the lift is currently adding someone. Used primarily to prevent the lift moving while still loading someone (which would cause an non-loaded person to be unloaded). Very unlikely that this would occur, due to the number of statements that need executing first, but still could potentially occur 4. `targetLiftSelect` allows a lift to set itself as the target lift on a specific floor for a person thread. The person thread releases this semaphore when they load. ### Added Variables: 1. `targetLift[]` added to keep track of the currently set target lift for a floor. Used in conjunction with semaphore `4`. ### Other Changes: 1. Added a `POPULATION` preprocessor definition that will print the current counts of people on each floor, and the current floor positions of all people threads. Useful for detecting if someone is stuck. 2. Changed the speed settings to allow a wider range of debug values