Created
September 21, 2016 04:27
-
-
Save itsJarrett/326b144030a8a805306ea1753fe37e79 to your computer and use it in GitHub Desktop.
Karel Maze Walker :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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