4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

CodeCombat代码战记第一天

第一个场景是地牢,基础的15关比较简单,主要是学习下面这些知识点:

  • 四个移动函数: moveLeft moveRight moveUp moveDown
  • 攻击函数: attack(变量)
  • 循环语句: while True:
  • 变量和字符串的区分: 变量不带引号,字符串带引号
  • 找到最近敌人的函数:findNearestEnemy()
  • 建造围栏函数: buildXY("fence", x, y)

贴个第15关的代码:

hero.moveDown()
hero.buildXY("fence", 36, 34)
hero.buildXY("fence", 36, 30)
hero.buildXY("fence", 36, 26)
hero.moveRight()
hero.moveRight()
hero.moveRight()
hero.moveRight()

很简单吧!
明天继续!


5 upvotes $0.00

Replies (0)

Conversation

No replies yet

Replies will appear here as people join the conversation.

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: