5 ms·
It shouldn't according to its own instructions. I bet jump() has something like `if (robot.touchingFloor) { action = 'jump'; }` which makes your code work beca
by kaoD 9y ago
It shouldn't according to its own instructions.
I bet jump() has something like `if (robot.touchingFloor) { action = 'jump'; }` which makes your code work because it doesn't overwrite the robot action if it can't actually jump.
Switch the order of actions and you'll see the robot never jumps because its action gets overwritten (as stated in the instructions tab).
EDIT: Here it is:
https://github.com/reaalkhalil/JSRobot/blob/478848147a080d8bf6ded8689d523337ea5e5ff7/scripts/Robot.js#L41 https://github.com/reaalkhalil/JSRobot/blob/478848147a080d8b...
- IanCal 9y agoAh I stand corrected, thanks. So I guess it's performing the last valid action.