magwo / elevatorsaga

The elevator programming game!

Home Page:http://play.elevatorsaga.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

elevator.on "passing_floor" gives floorNum = -1

threldor opened this issue · comments

I have found that the passing_floor event sometimes has floorNum = -1
Often (every 200s or so) on the challenge 18 when the elevator comes from a high floor to ground floor it seems that the passing_floor is triggered twice

using the code snippet similar to below the log shows

LOG
prevfloor:1 floorNum:0 dir:down
prevfloor:0 floorNum:-1 dir:down
elevator.on("passing_floor", function(floorNum, direction) {
    console.log('prevfloor:' + prevFloor + ' floorNum:' + floorNum + ' dir:' + direction);
    prevFloor = floorNum;
});

Pretty sure this is related to, or same bug as #61