Live data from Hacker News

So You Think You Can Program an Elevator

github.com

41–50 of 118 posts

Re: So You Think You Can Program an Elevator

#43

This 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…

I believe the afore-mentioned http://play.elevatorsaga.com/ let's you experiment with optimizing algorithms.

Re: So You Think You Can Program an Elevator

#44
post #14

This was was posed as the the first homework assignment in my first undergrad CS class (15 years ago). I don't think a single person managed to do it. It's a classic example of a problem that you think is appropriate to throw at new programmers but find out it goes terribly wrong because the hard part is designing a suitable state machine first. If you just start coding without a full model that covers all the edge c…

Same exact thing, about 16 years ago for me. He presented it (I think) to see who procrastinated on the project, knowing it'd take way longer than it sounded.

Same as me, 16 years as well. Was this kind of assignment in vogue at the time, discussed between professors / grad students at academic conferences?

My assignment involved writing assembly on some virtual machine with a weird byte/word size and dozens of addressing modes, as well as a (virtual) tape device. I think it was called CUSP but I can't find any references for it now.

Re: So You Think You Can Program an Elevator

#45
post #41

I've always wanted to see the option to deselect a floor if you press a button twice. Is there a good reason why this doesn't happen?

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.

Re: So You Think You Can Program an Elevator

#46
post #41

I've always wanted to see the option to deselect a floor if you press a button twice. Is there a good reason why this doesn't happen?

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.

Re: So You Think You Can Program an Elevator

#47
post #41

I've always wanted to see the option to deselect a floor if you press a button twice. Is there a good reason why this doesn't happen?

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.

Or in a crowded elevator a 'malicious' user blocking the view to the buttons deselects all but their own floor.

Re: So You Think You Can Program an Elevator

#50
post #14

This was was posed as the the first homework assignment in my first undergrad CS class (15 years ago). I don't think a single person managed to do it. It's a classic example of a problem that you think is appropriate to throw at new programmers but find out it goes terribly wrong because the hard part is designing a suitable state machine first. If you just start coding without a full model that covers all the edge c…

I had no idea that it was a common problem assigned to students, but it makes sense. Somebody on reddit also mentioned that Knuth also covers it.
Post reply on HN