Live data from Hacker News

Elevator Saga: An elevator programming game (2015)

play.elevatorsaga.com

11–20 of 103 posts

Re: Elevator Saga: An elevator programming game (2015)

#12

I used to interview programmers with an elevator programming problem. Neat to see it expanded so excellently and cleanly in this piece. Well done!

I had this question during a Google interview. The interviewer became annoyed when I suggested that an elevator that sometimes went backwards to pick ip someone on a just-missed floor could at least be interesting, if not perfectly efficient.

They had a preconceived idea that they wanted a stateless system and didn’t like my stateful approach, even if it was potentially better for end users.

Re: Elevator Saga: An elevator programming game (2015)

#13

Are real elevators ever coded with logic like mentioned in this thread? Or do they just keep it a simple as possible?

They can be. Express elevators and such. But mainly the programs are limited to what floor the elevators idle at because more complicated programs even if more efficient overall often piss people off.

Re: Elevator Saga: An elevator programming game (2015)

#15
Made me remember an interesting anecdote: During my PhD at Purdue I had the good luck to take the Pattern Recognition (nowadays would be called ML) course from Prof. Fukunaga, one of the pioneers in the field (https://en.m.wikipedia.org/wiki/Keinosuke_Fukunaga). In one of his classes he mentioned that years ago a company came to him, requesting his expertise in optimizing movement of a bank of elevators. He thought it would be trivial :-) After telling us that all his approaches failed miserably, he had one of his impish laughs and told us that he never worked on that problem again. Miss that guy. Get a copy of his book (https://books.google.com/books/about/Introduction_to_Statist...) if you can, it’s written in the “old style” but very informative.

Interesting fact: Gen Fukunaga (https://en.m.wikipedia.org/wiki/Gen_Fukunaga), founder of anime company Funimation, is his son.

Re: Elevator Saga: An elevator programming game (2015)

#16
post #10

Earlier quoted context omitted.

I'm not sure if this is true. I think all elevators I've encountered followed the elevator/SCAN algorithm: > the elevator continues to travel in its current direction (up or down) until empty, stopping only to let individuals off or to pick up new individuals heading in the same direction. with the elevator staying on its last location if there are no new requests and there being no buffering time after a request, fi…

Have you ever seen elevators where you select a floor from the outside and it gets assigned to one of multiple elevators? Those seem like they might be doing something more sophisticated.

I used to have those elevators where I worked and everybody hated them. I think the algorithm was tuned for efficiency, so you’d be waiting for an elevator for minutes as it tries to batch everyone up, while a dozen other elevators sit idle.

This was made worse through the need to specify the number of people who are travelling to a specific floor so the algorithm can allocate enough space in each elevator. Large groups often ignored this so you’d often find that an elevator you’ve waited minutes for is full, and start the dance all over again.

https://en.wikipedia.org/wiki/Destination_dispatch

Re: Elevator Saga: An elevator programming game (2015)

#17

What am I doing wrong? for(elevator of elevators) { elevator.on('idle', () => { //do some logic with elevator }) } It only seems to run for the second elevator rather than both of them?

i likely ran into the same or a related issue. i dont know much about javascript though.

        for(var i = 0; i 
it only works for "i < 1" and then only the second elevator moves... its kinda sad as i immediately enjoyed playing ...

Re: Elevator Saga: An elevator programming game (2015)

#18
post #10

Earlier quoted context omitted.

Have you ever seen elevators where you select a floor from the outside and it gets assigned to one of multiple elevators? Those seem like they might be doing something more sophisticated.

I used to have those elevators where I worked and everybody hated them. I think the algorithm was tuned for efficiency, so you’d be waiting for an elevator for minutes as it tries to batch everyone up, while a dozen other elevators sit idle. This was made worse through the need to specify the number of people who are travelling to a specific floor so the algorithm can allocate enough space in each elevator. Large gro…

This is the problem - if the system goes beyond “what floor should I idle at” and “do I idle door open” people get mad at it because of apparent unfairness and inefficiency even if it is actually more efficient overall.

Same thing happens with traffic lights.

Re: Elevator Saga: An elevator programming game (2015)

#19

I used to interview programmers with an elevator programming problem. Neat to see it expanded so excellently and cleanly in this piece. Well done!

I had this question during a Google interview. The interviewer became annoyed when I suggested that an elevator that sometimes went backwards to pick ip someone on a just-missed floor could at least be interesting, if not perfectly efficient. They had a preconceived idea that they wanted a stateless system and didn’t like my stateful approach, even if it was potentially better for end users.

That’s an example of a thing that may work well but would piss users off - it apparently reversing would annoy.

Re: Elevator Saga: An elevator programming game (2015)

#20
post #17

What am I doing wrong? for(elevator of elevators) { elevator.on('idle', () => { //do some logic with elevator }) } It only seems to run for the second elevator rather than both of them?

i likely ran into the same or a related issue. i dont know much about javascript though. for(var i = 0; i it only works for "i < 1" and then only the second elevator moves... its kinda sad as i immediately enjoyed playing ...

I think this was discussed there: https://news.ycombinator.com/item?id=8933979
Post reply on HN