Live data from Hacker News

Elevator Saga – An elevator programming game

play.elevatorsaga.com

31–40 of 108 posts

Re: Elevator Saga – An elevator programming game

#31

Earlier quoted context omitted.

> I got to Challenge #5 by just having the elevators go to every floor like in the first example. Strange, that strategy doesn't allow me to get past challenge 2 (just going to every floor one after the other).

Guess, I got lucky, haha. I should probably go back to challenge 2 and learn how to program these then.

On six it takes you back to 4 floors with 2 elevators and the challenge is 40 people in under 60 elevator moves.

The first 5 are easy to "brute force" but six is making me think a bit more.

Re: Elevator Saga – An elevator programming game

#37
post #20

In challenge 3, I got the following error: There is a problem with your code: .init@ http://play.elevatorsaga.com/app.js line 66 > eval:12:9 createWorldController/controller.start@ http://play.elevatorsaga.com/world.js:185:13 app.startChallenge@ http://play.elevatorsaga.com/app.js:175:9 @ http://play.elevatorsaga.com/app.js:216:13 riot.observable/el.trigger@ http://play.elevatorsaga.com/libs/riot.js:45:1 pop@ http://…

The error messages are bad because eval()...but rest assured there is a problem in your code.

Re: Elevator Saga – An elevator programming game

#39

Need help on this. I tried registering a handler for the up_button_pressed and down_button_pressed events, but the handler doesn't seem to be passed any arguments. Is this correct? floor.on("up_button_pressed", function(event) { ... } );

I don't think you need an argument. Within the callback function you still hold a reference to floor, and you know the up button has been pressed. There doesn't seem to be any more information. Note that there is also down_button_pressed
Post reply on HN