Here is the challenge. A 25 storey building (ground floor plus floors 1-25) has three elevators. To keep this simple, each elevator can move at 5M/second and each storey in the building is 3M high. When an elevator stops it takes 10 seconds from doors opening until they close. Elevators remain with their doors open at the floor until moved away. So if I got into an elevator on the ground (call it floor 0) and went to the top (floor 25) it would take 15 seconds to get to the top (=25 x 3/5) and 10 seconds. So after 25 seconds that elevator is available for use again. If I was on the 5th floor and the nearest elevator was on the 7th then it would take it 2 x 3/5 = 1.2 seconds to reach me and then 10 seconds to open, close and be ready to move off.
You have to write a program which (a) simulates the movement of the elevators. (b) reads in a text file of requests and handles them. (c) Outputs a list of elevator movements and how long it took to move each person to their destination and keep a total of the total passenger time. The shortest overall total passenger time is the winner.
Each request is one line in a text file (you can download this further on down the page). Each line has three comma separated numbers.
Time,from floor,to floor
Where time is in seconds from the start. Eg 567, and the two floor values are ints in the range 0 to 25. Examples 120,0,15 At time 120 a call to the ground floor to go to the 15th. 121,2,0 At time 121 a call to floor 2 to go to the ground.
Some Guidelines
- Elevators start at random floors.
- If an elevator is in motion it can answer calls in the direction it is moving in.
- You can have uncalled lifts move to a default floor.
- Each elevator is big so no problems about being full.
- Don't worry about doors opening and closing, just treat it as a ten second delay.
- Acceleration and deceleration are considered instantaneous. Ignore speeding up and slowing down.
- The winning entry has the least total time to satisfy requests.
- If a lift is descending it should not stop for a passenger who wants to go up or vice versa!
- The journey time for the passenger stops when the elevator arrives at the desired floor.
- Time 4248.0 Floor 7 Passenger Pressed up (Going to Floor 10).
- Time 4248.0 Call Response to Floor 7. Elevator 1 on Floor 1. Ascending to Floor 7.
- Time 4251.6 Elevator 1 arrived Floor 7. Waited 10 seconds. Moving to Floor 10.
- Time 4263.4 Elevator 1 arrived Floor 10. Waited ten seconds.
- Passenger on Floor 7 - Total time 15.4, total all passengers is 346.8.
Download the simulation file. This is a comma separated file with three values per line.
This Challenge is Now Closed. No one completed it.
Previous and Future Programming Challenges
- Link to Rock, Scissors and Paper Bot Ongoing Programming Challenge - Runs weekly until 2008.
- Link to Programming Challenge 1 - Completed
- Link to Programming Challenge 2 - Completed
- Link to Programming Challenge 4 - Completed
- Link to Programming Challenge 6 - Search a Linked List Fast- Completed
- Link to Programming Challenge 7 - Validate Chess Positions - (Deadline December 31 2007)
- Link to Programming Challenge 8 - Score Texas Holdem Poker Hands - (Deadline January 31 2008)
Have fun!

