這關(guān)其實(shí)也是復(fù)習(xí)關(guān),不能再重復(fù)列單詞表了!
1 單詞(略)
2 相關(guān)技能
回顧一下我們已有的技能唄!
- findNearestEnemy()
- attack()
- moveUp(), moveDown(), moveRight(), moveLeft()
當(dāng)然,還有最最重要的while True循環(huán)!
3 通關(guān)思路
發(fā)現(xiàn)一個,干掉一個!還有,要找到路線的規(guī)律哦!
3.1 源代碼
# 使用while-true循環(huán)移動并攻擊目標(biāo)
while True:
hero.moveRight()
hero.moveUp()
enemy = hero.findNearestEnemy()
hero.attack(enemy)
hero.attack(enemy)
hero.moveRight()
hero.moveDown(2)
hero.moveUp()
pass
3.2 編程知識卡
這關(guān)出現(xiàn)了一個pass語句。我偷懶百度了一個pass語句的介紹如下:

pass語句
你是不是有點(diǎn)奇怪?既然pass什么都不做,為什么還要發(fā)明這個語句呢?
關(guān)于這點(diǎn)我先賣個關(guān)子,等我們看過了足夠多的程序,再慢慢體會它的好處吧!
其實(shí)學(xué)編程,甚至所有的學(xué)習(xí),很多時候都會這樣,需要一點(diǎn)點(diǎn)不求甚解!
A 附注
當(dāng)前地圖:Kithgard地牢
關(guān)卡鏈接:https://codecombat.163.com/play/level/the-final-kithmaze
B 同主題文章
極客戰(zhàn)記攻略——Kithgard地牢 | python
極客戰(zhàn)記攻略——深藏的寶石 | python
極客戰(zhàn)記攻略——幽影守衛(wèi) | python
極客戰(zhàn)記攻略——真名實(shí)姓 | python
極客戰(zhàn)記攻略——高舉之劍 | python
極客戰(zhàn)記攻略——焰中舞動 | python
極客戰(zhàn)記攻略——kithmaze二度冒險 | python
極客戰(zhàn)記攻略——老對手 | python
極客戰(zhàn)記攻略——名稱大師 | python
極客戰(zhàn)記攻略——矮人騷亂 | python