| You are here: | About>Computing & Technology>C / C++ / C#> Projects> Programming Challenges> Programming Challenge 3 - Controlling Elevators in a Building |
![]() | C / C++ / C# |
Programming Challenge 3 - Now ClosedHave you ever been in a tall building or skyscraper and wondered why the elevators are so quick at coming, or maybe why they're not quite so quick? This month's programming challenge is to write a program that manages three elevators in a building.
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
Download the simulation file. This is a comma separated file with three values per line.
This Challenge is Now Closed. No one completed it.
|
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


