def hasEnemy():
e = hero.findNearestEnemy()
if e:
return True
else:
return False def enemyTooClose():
e = hero.findNearestEnemy()
if e:
return hero.distanceTo(e) < 30
else:
return False def healthTooLow():
return hero.health < 200 def nearestEnemyHook(hook):
if not hook:
return False e = hero.findNearestEnemy()
if e:
hook(e)
return True
return False def attackNearestEnemy():
nearestEnemyHook(hero.attack) def bashNearestEnemy():
nearestEnemyHook(hero.bash) def attackByType(eType):
t = hero.findNearest([x for x in hero.findEnemies() if x.type == eType])
if t:
hero.attack(t)
return True
else:
return False def bashByType(eType):
t = hero.findNearest([x for x in hero.findEnemies() if x.type == eType])
if t:
hero.bash(t)
return True
else:
return False def moveTo(i):
if i:
hero.moveXY(i.pos.x, i.pos.y)
return True
return False def collectNearestItem():
i = hero.findNearestItem()
if i:
moveTo(i)
return True
return False def moveToFlag(color):
f = hero.findFlag(color)
if f:
hero.pickUpFlag(f)
return True
return False def desert_SarvenSiege():
# Defend your towers in this replayable challenge level!
# Step on an X if you have 20 gold to build a soldier. def attack():
attackNearestEnemy() def passiveAttack():
f = hero.findFlag("black")
if f:
hero.pickUpFlag(f)
attackNearestEnemy()
return True
return False def buildSoldier():
pass while True:
if not move():
attack()
if hero.gold >= 20:
buildSoldier() def forest_backwoodsBrawl_lv0():
# Stay alive for one minute.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed. while True:
attackNearestEnemy() def forest_backwoodsBrawl_lv1():
# Stay alive for one minute.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed. while True:
if not attackByType('thrower'):
attackNearestEnemy() def forest_backwoodsBrawl_lv2():
# Stay alive for one minute.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed. while True:
if not attackByType('thrower'):
attackNearestEnemy() def forest_backwoodsBrawl_lv3():
# Stay alive for one minute.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed. while True:
attackByType('thrower') or attackByType('orge') or attackNearestEnemy() # Backwoods Treasure
# Gather gleaming gold from ogre-guarded groves in this player-created replayable level by Kevin Holland.
# It gets harder (and more lucrative) each time you win! But if you lose, you must wait a day to resubmit
#
# Goals
# Collect 100 gold
#
# Collect 100 gold from two or three groves.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed. def forest_backwoodsTreasure_lv0():
while True:
attackNearestEnemy() or collectNearestItem() def forest_backwoodsTreasure_lv1():
while True:
if hasEnemy():
if enemyTooClose() and healthTooLow():
attackNearestEnemy()
continue
collectNearestItem() # Thoktar's clone army guards the gate to the Cloudrip Mountains. # equip the 'simple sword' (6 damage) (have to equip one sword), only use bash. so that the cloned one use 'simple sword' too
# painted steel shield, 740 gold, 73.4 damage def desert_clashofClones_v1():
# You'll need good strategy to win this one!
# Your clone will have the same equipment you have!
# But, they're not very skilled at using special powers. def ass(e, t):
for i in e:
if i and i.type == t:
if t == 'scout' and hero.distanceTo(i) >= 10:
continue
hero.attack(i)
return True
return False def has(e, t):
for i in e:
if i.type == t:
return True
return False def fn(e, t): # find nearest
n = None
nd = 999999999 for i in e:
d = hero.distanceTo(i)
if i.type == t and d < nd:
n = i
nd = d
return (n, nd) def a():
while True:
e = hero.findEnemies() # scout first
if has(e, 'scout'):
(sc, scd) = fn(e, 'scout')
if has(e, 'archer'):
(ar, ard) = fn(e, 'archer')
if ard < scd:
hero.attack(ar)
hero.attack(sc) # if ass(e, 'scout') or ass(e, 'archer'):
# pass while True:
g = hero.findFlag("green")
if g:
hero.pickUpFlag(g)
continue v = hero.findFlag("violet")
if v:
hero.pickUpFlag(v)
hero.shield() b = hero.findFlag("black")
if b:
hero.pickUpFlag(b)
es = hero.findEnemies()
if False:#has(es, 'alejandro'):
(a, ad) = fn(es, 'alejandro')
hero.attack(a)
else:
e = hero.findNearestEnemy()
if e:
if hero.isReady("cleave"):
hero.cleave()
hero.attack(e) def desert_clashofClones_v2():
while True:
moveToFlag('green') or bashByType('alejandro') def desert_clashofClones_v3():
while True:
moveToFlag('green') or bashNearestEnemy() def desert_clashofClones():
desert_clashofClones_v3() # Sarven Treasure
# Gather 150 gold while evading ogres and running through teleporters. It gets harder (and more lucrative) each time you win! But if you lose, you must wait a day to resubmit.
# #Basic Syntax #Reading the Docs
#
# Goals
# Collect 150 gold
# Survive
#
# Collect 150 gold while evading ogres with teleporters.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed.
def desert_sarvenTreasure_lv0():
while True:
attackNearestEnemy() or collectNearestItem() def desert_sarvenTreasure_lv1():
while True:
attackNearestEnemy() or collectNearestItem() desert_clashofClones()

2017-11-04 Sa OCT codecombat的更多相关文章

  1. [软件工程基础]2017.11.04 第八次 Scrum 会议

    具体事项 项目交接燃尽图 每人工作内容 成员 已完成的工作 计划完成的工作 工作中遇到的困难 游心 #10 搭建可用的开发测试环境:#9 阅读分析 PhyLab 后端代码与文档:#8 掌握 Larav ...

  2. 2017-11-11 Sa Oct 消参

    2017-11-11 Sa Oct 消参 Prior versions: 2017-11-04 Sa Oct 消参 2017-11-10 Fr Oct 消参 2017-11-04 Sa $ P(-3, ...

  3. 2017-11-11 Sa Oct How to open a browser in Python

    2017-11-11 Sa Oct How to open a browser in Python python -m webbrowser "http://www.example.com/ ...

  4. How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新)

    How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新) 重要通知: 最近开题报告已差不多告一段落, ...

  5. 安装qt5.3.2后,qtcreator在ubuntu 11.04无法启动的问题

    在官方网站下载.run文件安装后,qtcreator启动失败,然后找到命令行启动,失败原因如下: shr@shr-Sieyuan:~/Qt5.3.2/Tools/QtCreator/bin$ ./qt ...

  6. ubuntu 11.04 源 更新不了,全显示ign、404

    原文地址:http://blog.csdn.net/enjio/article/details/11603373   ubuntu 11.04 源 更新不了 分类: 开发相关2013-09-12 14 ...

  7. ubuntu 11.04安装笔记

    首先,本文查询了网络中各位大大的经验共享,特别是<UltraISO制作U盘启动Ubuntu 8.10 LiveCD>,地址在http://blog.sina.com.cn/s/blog_5 ...

  8. 怎么样ubuntu 64 11.04 在执行32位程序

    上网一查非常多的信息,头发上的今天ubuntu 64 11.04 在执行32位程序安装ia32-libs包,可执行例如,下面的命令.但提示无法安装 apt-get install ia32-libs ...

  9. u盘安装ubuntu10.04 、11.04 server

    10.04 先将 ubuntu server 的 iso 放到优盘上,然后在提示无法找到光驱时,按 alt+f2 打开一个新的 console 窗口,将 iso mount 上,具体操作如下: ls ...

随机推荐

  1. Springmvc 简单入门1

    导入jar包 下载路径: 在web.xml里面配置 <servlet> <servlet-name>Springmvc</servlet-name> <!-- ...

  2. phpcms 路由配置

    这是一个由apache多站点配置引发的"血案",本以为是本地多站点配置的问题,结果找了半天没找到相关配置,最后还是问的大腿,同时也了解一些关于c盘hosts文件的映射作用以及使用 ...

  3. Python学习笔记(day23更新)

    第一章 计算机基础 1.1 硬件 计算机基本的硬件由:CPU / 内存 / 主板 / 硬盘 / 网卡 / 显卡 等组成,只有硬件但硬件之间无法进行交流和通信. 1.2 操作系统 作用:操作系统用于协同 ...

  4. 测试那些事儿—postman入门介绍

    1.postman入门介绍 一款功能强大的网页调试与发送网页HTTP请求的工具. 1)模拟各种HTTP请求,如get,post,put,delete 2)测试集合Collection    Colle ...

  5. webpack的入门教程

    webpack是模块打包工具/前端资源加载.它是根据模块的依赖关系进行静态分析,然后将这些模块按照指定的规则生成对应的静态资源. webpack可以将css.less.js转换为一个静态文件,减少了页 ...

  6. python while循环案例

    1.while循环语句基本结构? while condition: loop body 2.利用while语句写出猜大小的游戏: 设定一个理想数字比如:66,让用户输入数字,如果比66大,则显示猜测的 ...

  7. 基于 Jenkins 构建持续集成任务

    1.1 Jenkins 配置使用心得 我是在windows10上安装的,安装过程很简单,从官网上下载下来msi安装包,双击执行就好了.安装程序完成后会自动打开http://localhost:8080 ...

  8. PythonStudy1——Python 值拷贝 浅拷贝 深拷贝

    拷贝:对值进行复制的过程 # 值拷贝:应用场景最多  ls = [1, 'abc', [10]] ls1 = ls # ls1直接将ls中存放的地址拿过来  # ls内部的值发生任何变化,ls1都会随 ...

  9. 第一章 HTML+CSS(上)

    HTML 网页的组成 HTML简介 HTML的语法 HTML的常用标签 HTML中的表格和表单 CSS的简单应用 我们这里使用WebStorm开发工具 配置浏览器 常用插件: CodeGlance 代 ...

  10. 新系统centos7重启网络报错

    场景: 在不知名云上新弄的centos7,改了IP之后启动不起来,使用systemctl status network查看结果如下:       排查过程:   1)NetworkManager是否关 ...