I think all gays are so clever because my code may be so long:
func nevigateAroundWall() {
if isBlocked && isBlockedLeft {
turnRight()
}else if isBlocked && isBlockedRight {
turnLeft()
}else if isBlockedRight || isBlockedLeft {
moveForward()
}else {
turnLeft()
}
}
while !isBlocked !isBlockedLeft !isBlockedRight{
nevigateAroundWall()
if isOnGem {
collectGem()
}else if isOnClosedSwitch {
toggleSwitch()
}
}