Skip to content

Instantly share code, notes, and snippets.

@D-32
Created September 15, 2015 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save D-32/a70005f59801d789479a to your computer and use it in GitHub Desktop.
Save D-32/a70005f59801d789479a to your computer and use it in GitHub Desktop.
Level 5 Solution
_levelNr = 5;
delay = 100;
function exec() {
// new function -> getX(); and getY();
// use these to check that you don't leave the playing field
var check = 9;
for (var i = 0; i < 200; i++) {
if (getX() == check) {
if (check == 9) {
check = 0;
turnRight();
move();
turnRight();
} else {
check = 9;
turnLeft();
move();
turnLeft();
}
} else {
m();
}
}
}
function m() {
if (isFacingHole()) {
turnRight();
move();
turnLeft();
move();
move();
turnLeft();
move();
turnRight();
} else {
move();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment