So you think you can program an elevator

Posted on .

So You Think You Can Program An Elevator is a very interesting programming exercise that reached the front page of Hacker News a couple of weeks ago.

It’s about programming the logic controlling an elevator and responding to elevator passengers and people outside the elevator pressing buttons by deciding if you must stop when you reach a given floor, or start going up or down.

The exercise itself requires some basic Python knowledge, but the interesting part is how it may be able to surprise you and be much harder to solve than you expect (or maybe you nail it on the first try, who knows?). There’s also some difficulty in distilling the logic requirements from the long description and the unit tests themselves, which contain cases that the main description lacks. In this sense, it’s a wonderful insight into capturing software requirements from a client, for example.

So if you have some spare minutes or hours, I recommend you fork the repository and try to follow the instructions and code snippets carefully. You’ll probably have some frustrating fun!

comments powered by Disqus