News for hackers. Stuff that matters.
Re:Show HN: JSRobot – A platform game you play by coding in ... by IanCal on Monday October 23, 2017 @06:40AM (#15532118)
That's not right. You can put more than one action in the loop. This slowly completes the level:

    function loop(robot){
      // your code here
      robot.move(1)
      robot.jump()
    }
Re:Show HN: JSRobot – A platform game you play by coding in ... by kaoD on Monday October 23, 2017 @07:22AM (#15532304)
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/478848147a080d8b...

Re:Show HN: JSRobot – A platform game you play by coding in ... by IanCal on Monday October 23, 2017 @03:58PM (#15536441)
Ah I stand corrected, thanks. So I guess it's performing the last valid action.