博客
关于我
极客战记 魔幻的考试(magic exam)通关代码
阅读量:326 次
发布时间:2019-03-04

本文共 1236 字,大约阅读时间需要 4 分钟。

这一关并没有什么难度,控制移动时也可以找出规律使用循环结构。但是想要完美通关还需要注意以下几点:

  1. 需要给不同的对象使用合适的技能,才能获取最多的金币奖励
  2. 判断类型时,所有的都应该小写,大写无法识别
  3. 最后一个房间想要吃掉毒药不死亡,获取到最后四枚金币, 需要给自己施加grow的技能让自己变大(增加血量)。

代码如下:

# Try to get the best grade (gold) at the magic exam.# Move to each X mark, then use a spell.def healFriendOrEliminateEnemyOrPickItem():    friend = hero.findNearestFriend()    enemy = hero.findNearestEnemy()    item = hero.findNearestItem()    if friend:        if friend.type == "soldier":            hero.cast("heal", friend)        if friend.type == "goliath":            hero.cast("grow", friend)        if friend.type == "paladin":            hero.cast("regen", friend)    if enemy:        if enemy.type == "ogre":            hero.cast("force-bolt", enemy)        if enemy.type == "brawler":            hero.cast("shrink", enemy)        if enemy.type == "scout":            hero.cast("poison-cloud", enemy)    if item:        if item.type == "potion":            hero.moveXY(item.pos.x, item.pos.y)        else:            hero.cast("grow", hero)            hero.moveXY(item.pos.x, item.pos.y)            for i in range(4):    hero.moveXY(18 + i * 16, 40)    healFriendOrEliminateEnemyOrPickItem()    hero.moveXY(18 + i * 16, 24)    healFriendOrEliminateEnemyOrPickItem()

转载地址:http://apuh.baihongyu.com/

你可能感兴趣的文章
MySQL该如何将月增上亿条数据的单表处理方案优雅落地?
查看>>
MySQL详解:索引的介绍和原理分析
查看>>
MYSQL语句。
查看>>
MySQL调优是程序员拿高薪的必备技能?
查看>>
MySQL调大sort_buffer_size,并发量一大,查询排序为啥又会变慢
查看>>
Mysql账号权限查询(grants)
查看>>
mysql转达梦7_达梦7的子查询分解示例说明
查看>>
MYSQL输入密码后闪退的解决方法
查看>>
MySQL迁移到达梦:如何轻松、高质量完成迁移任务
查看>>
mysql返回的时间和实际数据存储的时间有误差(java+mysql)
查看>>
mysql还有哪些自带的函数呢?别到处找了,看这个就够了。
查看>>
Mysql进入数据库
查看>>
mysql进阶 with-as 性能调优
查看>>
mysql进阶-查询优化-慢查询日志
查看>>
wargame narnia writeup
查看>>
MySQL进阶篇SQL优化(InnoDB锁问题排查与解决)
查看>>
Mysql进阶索引篇03——2个新特性,11+7条设计原则教你创建索引
查看>>
mysql远程连接设置
查看>>
MySql连接出现1251Client does not support authentication protocol requested by server解决方法
查看>>
Mysql连接时报时区错误
查看>>