Swift Playground Code
some swift playground stages I made
This is a solve to r/swiftplayground’s top puzzle, written in swift.
It took me a while to realize the one if loop and two turnRight() are good enough though… Anyone has any simpler solutions?
if (!isBlockedLeft) {
turnLeft()
} else if (!isBlocked) {
// NULL - going to move forward
} else if (!isBlockedRight) {
turnRight()
} else {
// Turning around
turnRight()
turnRight()
}
moveForward()