Elevator Saga – An elevator programming game
41–50 of 108 posts
Re: Elevator Saga – An elevator programming game
#42Re: Elevator Saga – An elevator programming game
#43{ 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
#44Accessibility to non-programmers though as a good and inspiring learning tool? Or is that not an intended purpose?
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
#45I wonder how much more efficient you could be, if people didn't just call for going up/down, but their destination floor.
Re: Elevator Saga – An elevator programming game
#46 {init:function(){world.transportedCounter=999999},update:eval}Re: Elevator Saga – An elevator programming game
#47My attempt at a basic smart algorithm. Not so easy... https://gist.github.com/kballenegger/e275a99d50de2ee07f97
Re: Elevator Saga – An elevator programming game
#48Re: Elevator Saga – An elevator programming game
#49Re: Elevator Saga – An elevator programming game
#50Wow. 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!