Earlier quoted context omitted.
One thought comes to mind. What if the button light is not working? Hit the N button once, and you are on your way to floor N. But if the light is busted, you would hit the light again, and now you have deselected your destination. I think button presses should be indempotent for this reason alone.
This is why the standard practice of picking up the elevator phone and requesting a floor cancellation exists.
So You Think You Can Program an Elevator
111–118 of 118 posts
Re: So You Think You Can Program an Elevator
#112Very similar immediately playable JavaScript version. http://play.elevatorsaga.com/ Which I'm now closing as I lost too much time to this the first time I saw it.
Somehow I find this API counter-intuitive and painful to use. - Why currentFloor() is a function not a property? - Why both goingUpIndicator() and goingDownIndicator() instead of .direction property? - Why name destinationDirection() instead of currentDirection? - Why only floor_button_pressed but no in-door button press event? I gave up.
Re: So You Think You Can Program an Elevator
#113This is both cool and disappointing. I'm sure this is more challenging than it looks, and it's cool to see emergent complexity from a (seemingly) simply set of conditions to satisfy. However, the reason I think about elevator programming isn't to make an elevator behave the way they do today. It's to make an elevator behave better than they do today. For example: * I don't want an elevator to close and reopen its doo…
Re: So You Think You Can Program an Elevator
#114Very similar immediately playable JavaScript version. http://play.elevatorsaga.com/ Which I'm now closing as I lost too much time to this the first time I saw it.
I stuck at challenge #10, can anybody help?
Re: So You Think You Can Program an Elevator
#115This is both cool and disappointing. I'm sure this is more challenging than it looks, and it's cool to see emergent complexity from a (seemingly) simply set of conditions to satisfy. However, the reason I think about elevator programming isn't to make an elevator behave the way they do today. It's to make an elevator behave better than they do today. For example: * I don't want an elevator to close and reopen its doo…
THIS. However, the criterion you're optimizing for is still unclear. Should it be: a) the total number of steps the elevator takes b) the average number of steps each user has to wait c) the maximum number of steps each user has to wait d) the 90th percentile of user waiting steps Note: here, I'm counting the steps spent waiting for an elevator as well as the steps spent in the elevator till the destination as the sa…
Re: So You Think You Can Program an Elevator
#116Earlier quoted context omitted.
so are you saying that, similar to the elevator programming challenge itself, writing the elevator programming challenge was more difficult than it looked? cool. that probably put a bigger smile on my face than it should've, but still cool.
Yeah, but that can't be surprising. Software estimation is hard.
Re: So You Think You Can Program an Elevator
#117Earlier quoted context omitted.
This is fantastic. Are there other good programming challenge / games like this? I'd love to see a collection of other similar games.
Robocode is another one: http://robocode.sourceforge.net/