Playgroods:学習コード1,While loop,懸賞地

404 ワード

while !isBlocked {

moveForward()
if isOnClosedSwitch {
    toggleSwitch()
    
}
else if isBlockedLeft && isBlocked {
    turnRight()
    moveForward()
    turnRight()
    
}

if isOnGem {
    collectGem()
    
}
else if !isBlockedLeft && !isBlockedRight && isBlocked {
    turnLeft()
    moveForward()
    turnLeft()
    
}
}