magwo / elevatorsaga

The elevator programming game!
http://play.elevatorsaga.com
MIT License
2.43k stars 319 forks source link

Expose whether or not a floor's up/down button is illuminated #57

Open apaloma opened 9 years ago

apaloma commented 9 years ago

It would be handy to know whether or not a floor's up or down button is illuminated for making a decision in events like passing_floor. I could track it myself, but it's a pain especially since the simulation is clearly already tracking it. Right now I'm using floor.buttonStates.up/down, but I feel like that's cheating since it's not explicitly mentioned in the API.

roryokane commented 9 years ago

A pair of methods like this would be a natural complement to the recently-added elevator.getPressedFloors method, which was added for #35 “Add direct way to get an array of pressed floor numbers”. I think this should be implemented, for the same reason #35 was implemented.

sanscore commented 8 years ago

When I was playing with the "passing_floor" event, I had expected "direction" to be the state of the illuminated buttons for the floor. I don't think that's as absurd as it sounds. The first argument is floorNum and I am already working with an elevator, so if I wanted the direction, then I just check elevator.destinationDirection().

@apaloma's comment is very helpful (thank you), it's very pertinent information that should be documented. I don't feel that's cheating nor is it hackish, rather it's expected information.

Rybadour commented 8 years ago

Can we please have this? It's hard to optimize with just the events because you have no idea when those floors have been satisfied.