Live data from Hacker News

Elevator Saga – An elevator programming game

play.elevatorsaga.com

41–50 of 108 posts

Re: Elevator Saga – An elevator programming game

#43
// works well enough:

{ currentFloor: 0,

    init: function(elevators, floors) {
        var elevator = elevators[0]; // Let's use the first elevator
        elevator.on("idle", function() {
            // The elevator is idle, so let's go to all the floors (or did we forget one?)
            var nextFloor; 
            do nextFloor = Math.round(Math.random() * 2); while (nextFloor == this.currentFloor); 
            elevator.goToFloor(this.currentFloor = nextFloor);
        });
    },
    update: function(dt, elevators, floors) {
        // We normally don't need to do anything here
    }, 
    vendor: 'Sirius Cybernetics Corporation'
}

Re: Elevator Saga – An elevator programming game

#44
post #29

Accessibility to non-programmers though as a good and inspiring learning tool? Or is that not an intended purpose?

Non-programmer here playing. It gamifies coding for sure. Intended purpose unknown.

If the makers read this, firstly this is brilliant. Second my feature request would be to have some record of history to watch how I improve (or not) each simulation.

Re: Elevator Saga – An elevator programming game

#47
post #41

My attempt at a basic smart algorithm. Not so easy... https://gist.github.com/kballenegger/e275a99d50de2ee07f97

Why do you have conditionals written like this: if (elevator.goingUpIndicator() == true)? Why not just: if (elevator.goingUpIndicator())?

Re: Elevator Saga – An elevator programming game

#49
Here's a fairly simple strategy for beating challenges 1 - 5. Basically drop off people in the elevator according to whoever's floor is closest. Then once the elevator is empty go to the closest floor that has people waiting to be picked up.

https://gist.github.com/cspags/93f18a2fe505bf4f1686

Re: Elevator Saga – An elevator programming game

#50

Wow. I want so many more of these kind of things for my kids. It's so close to using code to solve real problems. How about an assembly line version where many parts have to come together in the correct order? Or an air traffic control one? Subway scheduling? Pizza delivery? More please!

It isn't quite programming, but your assembly line comment reminded me of http://pleasingfungus.com/Manufactoria/ which is a game about making state automata.
Post reply on HN