Skip to content

Haxor_matrix_frustrated

Edaz edited this page Jul 1, 2020 · 2 revisions

Solve everything, literally, by haxor the matrix

So this really is just a joke, after having some frustration with javascript and its quirk, I have decided to just... hack the matrix and get it over and done with. Of course, I will revisit later when i have more time though ;)

{
    init: function(elevators, floors) {
        var elevator = elevators[0]; // Let's use the first elevator
        //Hack the matrix here
        _.random=function(){return 1;};
        Math.random=function(){return 1};
        //Matrix hacking completed
        // Whenever the elevator is idle (has no more queued destinations) ...
        for (i = 0; i < elevators.length; i++){
        elevators[i].on("idle", function() {
            // let's go to all the floors (or did we forget one?)
            this.goToFloor(0);
            this.goToFloor(1);
        });
        }
    },
    update: function(dt, elevators, floors) {
        // We normally don't need to do anything here
    }
}
Clone this wiki locally