CodeMonkey过关学习笔记系列:120-128关
第 120 关挑战
until tiger.sleeping()
wait()
goto banana
第 121 关挑战
until bear.sleeping()
wait()
goto banana
第 122 关挑战
for b in bananas
until bear.sleeping()
wait() //#等待,什么?
goto b
第 123 关挑战
until bear.sleeping() and tiger.sleeping()
wait()
goto banana
第 124 关挑战
until bear.sleeping() and tiger.sleeping()
wait()
goto banana
第 125 关挑战
until bear.sleeping() and tiger.sleeping() //#并且...
wait()
for b in bananas
goto b
第 126 关挑战
for b in bananas
until bear.sleeping() and tiger.sleeping() //#并且...
wait()
if b.green()
goat.goto b
monkey.goto b
第 127 关挑战
waitForSafety = () ->
until bear.sleeping() and tiger.sleeping()
wait()
for b in bananas
waitForSafety()
goto b
第 128 关挑战
for b in bananas
until bear.sleeping() and tiger.sleeping()
wait()
if b.frozen()
goat.goto b
goat.hit()
until bear.sleeping() and tiger.sleeping()
wait()
monkey.goto b
CodeMonkey过关学习笔记系列:129-135关
第 129 关挑战
until tiger.sleeping() or tiger.playing()
wait()
goto banana
第 130 关挑战
或者 or 指令能够让小猴等到许多个判断式其中之一的条件成立了之后,就开始下个行动.
until tiger.sleeping() or tiger.playing()
wait()
goto banana
第 131 关挑战
//你可以在所有的判断式里面都使用 或者 or 指令
until tiger.sleeping() or tiger.playing()
wait()
step 10
//#这里等待 wait
熊玩耍或睡着
until bear.sleeping() or bear.playing()
wait()
step 10
第 132 关挑战
until bear.playing() or bear.sleeping()
wait()
goat.goto banana
第 133 关挑战
for b in bananas
until tiger.playing() or tiger.sleeping()
wait()
if b.green()
goat.goto b
else
monkey.goto b
第 134 关挑战
for b in bears
until b.sleeping() or b.playing()
wait()
step 10
第 135 关挑战
waitFor = (t) ->
until t.sleeping() or t.playing()
wait()
for t in tigers
for stepper in [monkey, goat]
waitFor t
stepper.step 10
CodeMonkey过关学习笔记系列:136-141关
第 136 关挑战
//这个开始是否逻辑了。
//not 这个否定指令会把原先是 肯定yes 的结果变成 否定no 的结果。此外,它也会把原先就 否定的no 结果变成 yes 的结果.
if not banana.green()
//#你只能修改这里的代码:
goto banana
第 137 关挑战
请试试看使用 烂掉的 rotten() 来识别烂掉的香蕉并且不要靠近它们!
rotten英 [ˈrɒtn] 美 [ˈrɑ:tn] adj.腐烂的;恶臭的;堕落的;极坏的
for b in bananas
turnTo b
if b.rotten()
say "Yuck!"
else
goto b
第 138 关挑战
goto bush
goto bananas[0]
第 139 关挑战
if not banana.rotten()
goto banana
第 140 关挑战
for b in bananas
#修复这里的条件:
if not b.rotten()
goto b
第 141 关挑战
for b in bananas
if not b.rotten()
goto b
goto bush