Skip to content

Instantly share code, notes, and snippets.

@itsJarrett
Created September 21, 2016 04:27
Show Gist options
  • Save itsJarrett/326b144030a8a805306ea1753fe37e79 to your computer and use it in GitHub Desktop.
Save itsJarrett/326b144030a8a805306ea1753fe37e79 to your computer and use it in GitHub Desktop.
Karel Maze Walker :)
public void mazeWalker() {
while (!facingEast()) {
turnLeft();
}
while (!nextToABeeper()) {
if(!frontIsClear()) {
turnLeft();
} else {
move();
turnRight();
if(frontIsClear()) {
move();
turnRight();
if(frontIsClear()) {
move();
} else {
turnLeft();
}
} else {
turnLeft();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment