PlayGround/코딩배우기 2

PlayGrounds [ 총 개수 모으기 ]

동빠기 2020. 2. 27. 17:41

 

let totalGems = randomNumberOfGems

var gemCounter = 0


while gemCounter < totalGems {

	while !isBlocked {

		if is OnGem {

			collectGem()

			gemCounter += 1

		}

		moveForward()

	}

	if isBlocked && isBlockedLeft {

		turnRingt()

	}

	else if isBlocked && isBlockedRight {

		turnLeft()

	}

}