Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A couple of problems with the API.

First, why do you have to call checkDestinationQueue after modifying the queue? It's awfully redundant. I assume this is due to some kind of limitation.

And second, goingUpIndicator and goingDownIndicator are kind of sketchy. Can you activate both at the same time? What effect would that have? There should be a single property, directionIndicator of an enum type with the possible values up, down, and none. I don't think you can make enums in javascript though, but I don't know the language very well. I'm just explaining this in terms that I know; there probably is a suitable javascript equivalent or replacement.



I'm not a developer of the game but:

DestinationQueue handling: It is not redundant, those are different options. Just to give an valid example: Add something to the queue, sort the queue, make the elevator run the updated and sorted queue.

Having both goingUpIndicator and goingDownIndicator is probabaly necessary to get this abritrary third state (both enabled / both disabled) which essentially indicates that the elevator will go in both directions.


correct, those works as flag with 'accept passenger in these direction' meaning. also note that if you change those values while you are at a floor, you need to go to that floor again for passenger to notice.


Yeah this is basically correct. There is nothing really preventing an elevator from reporting that it's going both up and down. The up/down indicators are used for two things: 1. To shut off the up/down request indicators correctly on the floor when the elevator arrives. 2. By passengers to decide whether to get on an elevator or not.


Thanks, I'm having a hard time with those indicators as well. One question. If I never set the indicators in my code, do they automatically get set? Or are the passengers getting on the car when there is no indicator?. (So far I've been having a lot of people refuse to get on my car, and I assume it's because my code is setting the wrong indicator).

BTW, this is a game that will haunt me for a long time to come. Even when I pass a level, I stay on it trying to reduce the metrics rather than accept that I "lucked out" with my naive algorithm. You did a fantastic job on this.


I think they are automatically set to true at the start, and will never change unless you change them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: