【轉載】網易極客戰記官方攻略-地牢-Kithmaze 二度歷險

關卡鏈接:

https://codecombat.163.com/play/level/the-second-kithmaze編程

不少人試過,但只有少數人能穿過此迷宮。code

簡介:

記住,你只需 一個 while-true 循環。它會反覆執行!blog

默認代碼

# 使用while-true循環穿越迷宮!
while True:
    hero.moveRight()
    # 再輸入3條控制命令經過迷宮

概覽

請仔細數下在你的 while-true 循環 裏要多少移動才能走出這個迷宮!文檔

記住,每一關裏應該只用一個 while-true 循環 ,並確保代碼都在循環內部。get

將鼠標放在右下角的 while-true 循環 文檔上以查看示例。it

Kithmaze 二度歷險 解法

# 使用while-true循環穿越迷宮!
while True:
    hero.moveRight()
    # 再鍵入3條移動命令來完成這個迷宮:
    hero.moveUp()
    hero.moveRight()
    hero.moveDown()

 

相關文章
相關標籤/搜索