[HN Gopher] Elevator Saga - An elevator programming game ___________________________________________________________________ Elevator Saga - An elevator programming game Author : warpech Score : 63 points Date : 2021-06-12 20:08 UTC (2 hours ago) (HTM) web link (play.elevatorsaga.com) (TXT) w3m dump (play.elevatorsaga.com) | spicybright wrote: | Are real elevators ever coded with logic like mentioned in this | thread? Or do they just keep it a simple as possible? | bombcar wrote: | 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. | asiachick wrote: | I don't remember the article but I remember reading about a | building management game where the reviewer believed the entire | game was based around the elevator management code and that | writing that code was fun for the programmer but the game itself | was not fun for the player. | | It looks like this highlights the "fun for the programmer" part. | aidenn0 wrote: | Maybe Sim Tower? The game was pretty boring, but building and | managing elevators to keep people happy was a fun challenge. | adenozine wrote: | I used to interview programmers with an elevator programming | problem. Neat to see it expanded so excellently and cleanly in | this piece. Well done! | alasdair_ wrote: | 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. | dang wrote: | One past discussion, plus a one-commenter: | | _Elevator Saga: The Elevator Programming Game_ - | https://news.ycombinator.com/item?id=21425054 - Nov 2019 (1 | comment) | | _Elevator Saga - An elevator programming game_ - | https://news.ycombinator.com/item?id=8929314 - Jan 2015 (104 | comments) | voldemort1968 wrote: | I was thinking of creating this very thing on several occasions | being in an elevator. The logic of elevators is very intriguing | and more complicated than people realize. | 7373737373 wrote: | 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, | first come first served | | https://en.wikipedia.org/wiki/Elevator_algorithm | dialogbox wrote: | That is true only for the single elevator system. If there | are multiple elevators, the system could be extremely | complicated. | falldmg wrote: | 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. | disposedtrolley wrote: | 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 | TheRealNGenius wrote: | Ah disk scheduling algorithms :) | https://en.wikipedia.org/wiki/Elevator_algorithm | lloydatkinson wrote: | 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? | mercora wrote: | i likely ran into the same or a related issue. i dont know much | about javascript though. for(var i = 0; i | < elevators.length; i++) { | elevators[i].on("idle", function() { | for(var j = 0; j < floors.length; j++) { | elevators[i].goToFloor(j); } | }) } | | it only works for "i < 1" and then only the second elevator | moves... its kinda sad as i immediately enjoyed playing ... | Jun8 wrote: | 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) 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. Never worked on that problem again. Miss that guy. | Get a copy of his book 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. ___________________________________________________________________ (page generated 2021-06-12 23:00 UTC)