Saturday, April 14, 2012


Christina and I recently watched "Kate and Leopold", which is allegedly about the inventor of the elevator, so I've been thinking about elevators for an unusually large amount of time. Yesterday, I summoned the elevator to my floor, and then decided to run down the stairs to get my laundry, instead of waiting for the elevator.

When I got down to the basement (where the laundry room is), I called the elevator again, so that it would come back down to me when I was ready for it. Then I went and took my laundry out of the dryer - and came back to find that the elevator still hadn't come down yet (the light was still on). This turned out to be because there was someone else in the elevator with their laundry when it came down.

So, like the nerd I am, on the way back up I started thinking about how you might program an elevator. My guess, from Data Structures, is to use a Priority Queue. You'd have to have some way to differentiate between when you were headed up and when you were headed down. You need a tracker to follow which floor you're on. No one wants to get on an elevator to go up before they can go down, so that's another factor you'd have to consider when assigning priority to commands.

There's one last thing with an elevator. It's an embedded system, so you don't have the regular coding that you normally have. So maybe programming an elevator isn't really programming, but only circuit control, in which case I'll have to hit up one of my computer engineering friends for advice.

I'll bet you've never thought so much about elevators, have you? :)

No comments: