天天看點

CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關

CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -

for b in bananas
    if  b.frozen()
        goat.goto b
        goat.hit()
    goto b
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
goat.goto(bridge)
for b in bananas
    if b.frozen()
        goat.goto(b)
        goat.hit(b)
    goto b
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
for t in turtles
    t.step 

for b in bananas
    if b.frozen()
        goat.goto(b)
        goat.hit(b)
    goto b

           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
x = 

times ->
    if bananas[x].frozen()
        goat.goto bananas[x]
        goat.hit()


    x = x - 


goto turtle
turtle.step 
for b in bananas
    goto b
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
#你知道演習嗎?誰先去?
for b in bananas
    if b.frozen()
        turtle.goto b
        goat.hit()
        turtle.step -
step 
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
i = 
times ->
    if bananas[i].frozen()
        goats[i].goto bananas[i]
        goats[i].hit()
    monkey.goto bananas[i]
    i = i + 
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
for b in bananas
    if b.frozen()
        turtle.goto b
        goat.hit()
        turtle.step -
    goto b
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
#提示:這裡我們有多少隻烏龜?

for b in bananas
    if b.frozen()
        goat.hit()
    goto b
    goto turtles[]
    for t in turtles
        t.step 
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
#提示:猴子可以等待山羊完成
#首先撞擊所有的冰凍香蕉

for b in bananas
    if b.frozen()
        goat.goto b
        goat.hit()
#現在讓我們獲得那些香蕉。
#我們應該從哪裡開始?并且多少次?
x = 
times ->
    goto bananas[x]
    x = x - 

           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
x = 
for g in goats
    times ->
        g.goto bananas[x]
        if bananas[x].frozen()
            g.hit()
        x = x + 
for b in bananas
    goto b
           
CodeMonkey過關學習筆記系列:特技關卡 9-1 ~ 9-11 關
特技關卡 -
x = 
times ->
    times ->
        if bananas[x].frozen()
            goat.goto bananas[x]
            goat.hit()
        goto bananas[x]
        x = x + 
    goat.goto bridge
    goto bridge
           

繼續閱讀