codecombat攻略サイト

無課金攻略のススメ

【codecombat】おススメ・買うべき装備

 

このページではcodecombatの買っておいたほうがいい装備について書いていきます。

 

 

 どのゲームでもいえることですが、不必要に装備を買いすぎると

後半、石が足りなくなってきてしまいます。

なので、どの装備を買うべきか、筆者の独断と偏見で書いておきます。

 

中盤からのステージ攻略は ↓ からどうぞ

co-decom.hatenablog.com

 

注意 - 筆者は無課金勢なのですべてのアイテムを試しているわけではありません。

 

・靴 - 優先度☆☆

   買いたいなら買ってください

 

・剣 - 優先度☆☆☆

   序盤に買えるルーンソード

   攻撃頻度の高いダークスチールブレード or グレートソード

   最強の神殿の番人の剣

   あたりは買っておいたほうがいいかもしれません。

 

・手袋 - 優先度☆☆

   なくてもいいです。買うとしたら帝王の軍手がおススメです。

 

・時計 - 優先度☆

   どうしても買いたいんなら買ってください。

 

・ベルト - 優先度*

   いりません。ご自由にどうぞ。

 

・指輪 - 優先度☆

   速さの指輪はおススメ。

   それ以外はどうしても買いたいんなら買ってください。

 

・眼鏡 - 優先度☆☆

   詰んだら買ってもいいと思います。安いんで。

   魔法のレンズ < トワイライト眼鏡 は買ってください。

 

・石 - 優先度☆*

   詰んだら買ってください。

   無課金では青いやつが最強です。

 

・腕輪(?) - 優先度☆

   曇った銅のバンドがおススメです。

   それ以外は買いたいんなら買ってください。

 

・旗 - 優先度*

   ご自由に。

 

//ここから ヘルメット < 盾 < 胸当て です。

//買いすぎ注意

 

・ヘルメット - 優先度☆☆☆*

   体力増強の貴重な手段ですが、値段が高いわりに効果が少ないので

   すりきれたドラゴンのだけにしておいたほうがいいかもしれません。

 

・盾 - 優先度☆☆☆☆

   なぜかヘルメットよりもお手軽な品。

   攻撃力よりも体力を重視して買ってください。

 

・胸当て - 優先度☆☆☆☆*

   詰んだら最優先で買ってください。

   ただ、いいお値段するので本当に詰んだらにしてください。

   ドラゴンシリーズの2つは買ってもいいと思います。

 

 

魔法系は、扱いがかなり難しいので、基本おススメしたやつ以外買わなくてもいいと思われます。

その他強いものとかがあれば教えていただけると幸いです。

【codecombat】クラウドリップ山~

codecombatというプログラミング学習サイトの攻略です。他のサイトではあまり掲載されていない「クラウドリップ山」から載せていきます。間違えている箇所、よくわからない箇所などは、コメントで教えてくれるとありがたいです。

 

注意:はてなブログの仕様でコピー&ペーストを行うとバグってしまいます。

   移すときは手入力をおすすめします。

   コピペがしたい人はコピペ後、空白を入力しなおしてください。

 

もとから載っている文をかなり利用しているつもりです。

なので、付け足すという形だと楽だと思います

 

装備についてはコチラ ↓ から

co-decom.hatenablog.com

 

随時更新中

 

クラウドリップ山

Crag Tag

while True:
    pender = hero.findNearest(hero.findFriends())
    if pender:
        hero.move(pender.pos)

 

Slalom

for i in range(4):
    gems = hero.findItems()
    num = 10 * i
    while hero.pos.x < 20 + num:
        hero.move({'x': 20 + num, 'y': 35})
    while hero.pos.x < 25 + num:
        gem0 = gems[0]
        hero.move(gem0.pos)

 

Ogre Gorce Gouger

while hero.time < 19:
    item = hero.findNearestItem()
    hero.move(item.pos)
while hero.pos.x > 16:
    hero.move({"x": 15, "y": 36 })
hero.buildXY("fence", 21, 36)

 

ボーナスは諦めてください。

たまにバグで最初からコインを持ってたりもしますが、、、

 

Cloudrip Commandre

while hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")
soldiers = hero.findFriends()
soldierIndex = 0
while soldierIndex < 5:
    soldier = soldiers[soldierIndex]
    hero.command(soldier, "move", {"x": 50, "y": 40})
    soldierIndex += 1
hero.moveXY(51, 41)

 

Mountain Mercena

enemy = hero.findNearestEnemy()
while True:
    item = hero.findNearestItem()
    hero.move(item.pos)
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
    enemy = hero.findNearestEnemy()
    if enemy:
        soldiers = hero.findFriends()
        for soldier in soldiers:
            hero.command(soldier, "attack", enemy)

 

運悪く最初から大群に押し寄せられないように祈りましょう。

 

Timber Guard

while True:
    coin = hero.findNearestItem()
    if coin:
        hero.move(coin.pos)
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            if enemy:
                hero.command(friend, "attack", enemy)
            else:
                hero.command(friend, "move", {"x": 70, "y": 39})

 

飼育員

points = [{"x": 33, "y": 42},
          {"x": 47, "y": 42},
          {"x": 33, "y": 26},
          {"x": 47, "y": 26}]
while hero.gold < 80:
    item = hero.findNearestItem()
    hero.move(item.pos)
for i in range(4):
    hero.summon("soldier")
hero.moveXY(46, 32)
while True:
    friends = hero.findFriends()
    for j in range(len(friends)):
        point = points[j]
        friend = friends[j]
        enemy = friend.findNearestEnemy()
        if enemy and enemy.team == "ogres" and friend.distanceTo(enemy) < 5:
            hero.command(friend, "attack", enemy)
        else:
            hero.command(friend, "move", point)

 

Noble Sacrifice

while hero.gold < 80:
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)
hero.summon("soldier")
hero.summon("soldier")
hero.summon("soldier")
hero.summon("soldier")
points =
points[0] = { "x": 13, "y": 73 }
points[1] = { "x": 51, "y": 73 }
points[2] = { "x": 51, "y": 53 }
points[3] = { "x": 90, "y": 52 }
friends = hero.findFriends()
for i in range(4):
    friend = friends[i]
    points[i]
    hero.command(friend, "move", points[i])
    points[i] += 1

 

Hunting Party

while True:
    friends = hero.findFriends()
    for friend in friends:
        enemy = friend.findNearestEnemy()
        if enemy:
            hero.command(friend, "attack", enemy)
        else:
            X = friend.pos.x + 0.4
            hero.command(friend, "move", {"x":X, "y":friend.pos.y})

 

”0.4” ← ここがミソです。剣士と弓兵の歩幅を合わせています

 

Vital Powers

def pickUpNearestCoin():
    items = hero.findItems()
    nearestCoin = hero.findNearest(items)
    if nearestCoin:
        hero.move(nearestCoin.pos)
def summonSoldier():
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
    pass
def commandSoldiers():
    for soldier in hero.findFriends():
        enemy = soldier.findNearestEnemy()
        if enemy:
            hero.command(soldier, "attack", enemy)
while True:
    pickUpNearestCoin()
    summonSoldier()
    commandSoldiers()

 

ボーナスは、魔法や強い装備がないときびしい

 

The Two Flowers

def summonSoldiers():
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
peasant = hero.findByType("peasant")[0]
while True:
    summonSoldiers()
    soldiers = hero.findByType("soldier")
    for soldier in soldiers:
        enemy = soldier.findNearestEnemy()
        if enemy:
            hero.command(soldier, "attack", enemy)
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)

 

The Geometry of Flow

def drawCircle(x, y, size):
    angle = 0
    hero.toggleFlowers(False)
    while angle <= Math.PI * 2:
        newX = x + (size * Math.cos(angle))
        newY = y + (size * Math.sin(angle))
        hero.moveXY(newX, newY)
        hero.toggleFlowers(True)
        angle += 0.2
def drawSquare(x, y, size):
    hero.toggleFlowers(False)
    cornerOffset = size / 2
    hero.moveXY(x - cornerOffset, y - cornerOffset)
    hero.toggleFlowers(True)
    hero.moveXY(x + cornerOffset, y - cornerOffset)
    hero.moveXY(x + cornerOffset, y + cornerOffset)
    hero.moveXY(x - cornerOffset, y + cornerOffset)
    hero.moveXY(x - cornerOffset, y - cornerOffset)
redX = {"x": 28, "y": 36}
whiteX = {"x": 44, "y": 36}
hero.setFlowerColor("red")
drawCircle(28, 36, 10)
hero.setFlowerColor("purple")
drawSquare(44, 36, 10)

 

Mountain Flower Grove

while True:
    hero.moveXY(84, 70)
    hero.moveXY(85, 70)

 

謎。

 

Hunters and Prey

def pickUpCoin():
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)
def summonTroops():
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
def commandSoldier(soldier):
    enemy = soldier.findNearestEnemy()
    if enemy:
        hero.command(soldier, "attack", enemy)
def commandArcher(archer):
    hero.command(archer, "move", archer.pos)
while True:
    pickUpCoin()
    summonTroops()
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "soldier":
            commandSoldier(friend)
        elif friend.type == "archer":
            commandArcher(friend)

 

「そこにいろ」っていう命令がないと味方は勝手に動いて行ってしまうそうです。

 

Library Tactician

def commandSoldier(soldier, soldierIndex, numSoldiers):
    angle = Math.PI * 2 * soldierIndex / numSoldiers
    defendPos = {"x": 41, "y": 40}
    defendPos.x += 10 * Math.cos(angle)
    defendPos.y += 10 * Math.sin(angle)
    hero.command(soldier, "defend", defendPos);
def findStrongestTarget():
    mostHealth = 0
    bestTarget = None
    enemies = hero.findEnemies()
    for enemy in enemies:
        if bestTarget == None or (enemy.health > bestTarget.health):
            bestTarget = enemy
    if bestTarget and bestTarget.health > 15:
        return bestTarget
    else:
        return None
def commandArcher(archer):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)
archerTarget = None
while True:
    if not archerTarget or archerTarget.health <= 0:
        archerTarget = findStrongestTarget()
    friends = hero.findFriends()
    soldiers = hero.findByType("soldier")
    archers = hero.findByType("archer")
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        if soldier.health <= 40:
            hero.command(soldier, "move", {"x": 43, "y": 43})
        else:
            commandSoldier(soldier, i, len(soldiers));
    for archer in archers:
        commandArcher(archer)

 

なかなか面倒くさいですね。

基本は円形で守り、defendコマンドで近くに来た敵を攻撃してるっていう感じです。

 

Uneasy Truce

def findSouthernUnits(units):
    southernUnits =
    for unit in units:
        if unit.pos.y < hero.pos.y:
            southernUnits.append(unit)
    return southernUnits
while True:
    friends = hero.findFriends()
    enemies = hero.findEnemies()
    us = findSouthernUnits(enemies)
    b = 0
    c = 0
    for a in us:
        b += 1
    for i in friends:
        c += 1
    if b > c:
        hero.summon("soldier")

 

The Spy Among Us

def letterInWord(word, letter):
    for i in range(len(word)):
        character = word[i]
        if character == letter:
            return True
    return False
spyLetter = "z"
friends = hero.findFriends()
for friend in friends:
    friendName = friend.id
    if letterInWord(friendName, spyLetter):
        hero.say(friendName + " is a spy!")
    else:
        hero.say(friendName + " is a friend.")

 

名前に"z"が入っている奴がスパイらしいです。

 

Ice Hunter

def isSubstring(word, substring):
    rightEdge = len(word) - len(substring)
    for i in range(rightEdge + 1):
        for j in range(len(substring)):
            shiftedIndex = i + j
            if word[shiftedIndex] != substring[j]:
                break
            if j == len(substring) - 1:
                return True
    return False
while True:
    enemies = hero.findEnemies()
    for e  in range(len(enemies)):
        enemy = enemies[e]
        if isSubstring(enemy.id, "bos"):
            hero.attack(enemy)

 

名前に"bos"が入っている奴がちっさいヤクなので倒しましょう。

 

攻撃的な擬態

def startsWith(text, word):
    if len(word) > len(text):
        return False
    for index in range(len(word)):
        if word[index] != text[index]:
            return False
    return True
ogreNameStart = "Zog"
while True:
    suspectFriend = hero.findNearest(hero.findFriends())
    suspectName = suspectFriend.id
    if startsWith(suspectName, "Zog"):
        hero.attack(suspectFriend)
    enemy = hero.findNearestEnemy()
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(27, 27)

 

Loud Quietness

def onHear(event):
    words = event.message.split(" ")
    volume = words[0]
    password = words[1]
    if volume == "Loud":
        pet.say(words[1].toUpperCase())
    if volume == "Quiet":
        pet.say(words[1].toLowerCase())
    pet.moveXY(pet.pos.x+ 24, pet.pos.y)
def passDoor():
    guard = hero.findNearest(hero.findFriends())
    password = guard.password
    if guard.isLoud:
        hero.say(guard.password.toUpperCase())
        pass
    elif guard.isQuiet:
        hero.say(guard.password.toLowerCase())
        pass
    hero.moveXY(hero.pos.x+ 24, hero.pos.y)
pet.on("hear", onHear)
hero.moveXY(10, 14)
passDoor()
passDoor()

 

Convenient Enemy

for x in range(8, 73, 16):
    hero.moveXY(x, 22)
    peasant = hero.findNearest(hero.findFriends())
    message = peasant.message
    hero.say(message)
    if message:
        words = message.split(" ")
        if words[2] == "soldier" or words[2] == "archer":
            t = words[2]
        elif words[3] == "soldier" or words[3] == "archer":
            t = words[3]
        elif words[1] == "soldier" or words[1] == "archer":
            t = words[1]
        else:
            t = words[0]
        hero.summon(t)
for i in range(len(hero.built)):
    unit = hero.built[i]
    hero.command(unit, "defend", unit.pos)
hero.moveXY(72, 40)
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)

 

完璧な組み合わせ

def findValuePair(items):
    for i in range(len(items)):
        itemI = items[i];
        for j in range(len(items)):
            if i == j:
                continue
            itemJ = items[j];
            if itemI.value == itemJ.value:
                return [itemI, itemJ]
    return None
while True:
    gems = hero.findItems()
    gemPair = findValuePair(gems)
    if gemPair:
        gemA = gemPair[0]
        gemB = gemPair[1]
        hero.moveXY(gemA.pos.x, gemA.pos.y)
        hero.moveXY(40, 44)
        hero.moveXY(gemB.pos.x, gemB.pos.y)
        hero.moveXY(40, 44)

 

Reindeer Wakeup

deerStatus = [ 'asleep', 'asleep', 'asleep', 'asleep', 'asleep' ]
friends = hero.findFriends()
for deerIndex in range(len(friends)):
    reindeer = friends[deerIndex]
    if reindeer.pos.y > 30:
        deerStatus[deerIndex] = "awake"
for statusIndex in range(len(deerStatus)):
    hero.say("Reindeer" + statusIndex + "is" + deerStatus[statusIndex])

 

人間砲弾部隊

landingMap = hero.findNearest(hero.findFriends()).landingMap
cell = landingMap[0][0]
hero.say("行 0 列 0 " + cell)
hero.say("行 3 列 2 " + landingMap[3][2])
cell = landingMap[2][1]
hero.say("行 2 列 1 " + cell)
cell = landingMap[1][0]
hero.say("行 1 列 0 " + cell)
cell = landingMap[0][2]
hero.say("行 0 列 2 " + cell)
cell = landingMap[1][3]
hero.say("行 1 列 3 " + cell)

 

パワーポイント

spell = "VENI"
wizard = hero.findNearest(hero.findFriends())
powerMap = wizard.powerMap
def convert(row, col):
    return {'x': 16 + col * 12, 'y': 16 + row * 12}
for i in range(len(powerMap)):
    for j in range(len(powerMap[i])):
        pointValue = powerMap[i][j]
        if pointValue > 0:
            a=convert(i,j)
            hero.moveXY(a.x,a.y)
            hero.say("VENI")
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)

 

Perimeter Defense

for x in range(40, 81, 20):
    hero.moveXY(x, 60)
    hero.say("Here")
for y in range(40, 19, -20):
    hero.moveXY(80, y)
    hero.say("Here")
for x in range(60, 20, -20):
    hero.moveXY(x, 20)
    hero.say("Here")
for y in range(20, 80, 20):
    hero.moveXY(20, y)
    hero.say("Here")
hero.moveXY(50, 40)

 

格子状の地雷原

for x in range(12, 12 + 8 * 6, 8):
    for y in range(12, 12 + 8 * 7, 8):
        hero.buildXY("fire-trap", x, y)
    hero.moveXY(hero.pos.x + 8, hero.pos.y)
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        d = hero.distanceTo(enemy)
        if d <= 20:
            hero.moveXY(52, 55)

 

鋼牙の峡谷

defendPoints = [{"x": 35, "y": 63},{"x": 61, "y": 63},{"x": 32, "y": 26}]
summonTypes = ["soldier","soldier","soldier","soldier","archer","archer","archer","archer"]
def summonTroops():
    type = summonTypes[len(hero.built) % len(summonTypes)]
    if hero.gold >= hero.costOf(type):
        hero.summon(type)
def commandTroops():
    friends = hero.findFriends()
    for i in range(len(friends)):
        friend = friends[i]
        if friends[i].type == "soldier":
            if defendPoints[i % 3].x > 40:
                hero.command(friends[i], "defend", {"x": defendPoints[i % 3].x + 3, "y": defendPoints[i % 3].y})
            else:
                hero.command(friends[i], "defend", {"x": defendPoints[i % 3].x - 3, "y": defendPoints[i % 3].y})
        else:
            hero.command(friends[i], "defend", defendPoints[i % 3])
for i in range(16):
    summonTroops()
commandTroops()
hero.moveXY(69, 25)
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        if enemy.pos.x > 50 and enemy.pos.y < 40:
            hero.attack(enemy)
    friends = hero.findFriends()
    for friend in friends:
        if friend.health < 100 and friend.type == "soldier":
            hero.command(friend, "move", {"x": 50, "y": 40})

 

指示通りにするとボーナスがもらえないので、

・仲間で三か所を守り、自分が一か所を守る

・剣士を前進させる

などしました。

 

資源の谷

def commandPeasant(peasant, coins):
    item = peasant.findNearestItem()
    if item:
        hero.command(peasant, "move", item.pos)
friends = hero.findFriends()
peasants = {
    "Aurum": friends[0],
    "Argentum": friends[1],
    "Cuprum": friends[2]
}
while True:
    items = hero.findItems()
    goldCoins =
    silverCoins =

    bronzeCoins = []
    for item in items:
        if item.value == 3:
            goldCoins.append(item)
        if item.value == 2:
            silverCoins.append(item)
        if item.value == 1:
            bronzeCoins.append(item)
    commandPeasant(peasants.Aurum, goldCoins)
    commandPeasant(peasants.Argentum, silverCoins)
    commandPeasant(peasants.Cuprum, bronzeCoins)

 

混成部隊の戦略

hero.summon("soldier")
summonTypes = ["archer","archer","archer","soldier"]
def summonTroops():
    type = summonTypes[len(hero.built) % len(summonTypes)]
    if hero.gold >= hero.costOf(type):
        hero.summon(type)
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        distance = hero.distanceTo(enemy)
        if distance < 5:
            hero.shield()
        else:
            item = hero.findNearestItem()
            if item:
                hero.move(item.pos)
    else:
        item = hero.findNearestItem()
        if item:
            hero.move(item.pos)
    summonTroops()
    friends = hero.findFriends()
    for friend in friends:
        enemy = friend.findNearestEnemy()
        if enemy:
            hero.command(friend, "attack", enemy)
        elif friend.type == "soldier":
            hero.command(friend, "move", {"x": 50, "y": 35})
        elif friend.type == "archer":
            hero.command(friend, "move", {"x": 30, "y": 35})

 

基本弓兵、たまに剣士。最後は気合で耐えましょう。

 

薙ぎ払う炎

def chooseStrategy():
    enemies = hero.findEnemies()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    FangRiders = hero.findByType("Fang Rider")
    if FangRiders:
        return "fight - back"
    else:
        return "collect-coins"
def commandAttack():
    griffinriderrs = hero.findByType("griffin-rider")
    for griffinriderr in griffinriderrs:
        enemy = griffinriderr.findNearestEnemy()
        if enemy:
            hero.command(griffinriderr, "attack", enemy)
        else:
            hero.command(griffinriderr, "move", {"x": 80, "y": 40})
def pickUpCoin():
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)
def heroAttack():
    fangriders = hero.findByType("fangrider")
    for fangrider in fangriders:
        if fangrider.pos.x < 34:
            hero.attack(fangrider)
while True:
    commandAttack()
    strategy = chooseStrategy()
    commandAttack()
    heroAttack()
    chooseStrategy()
    pickUpCoin()
    if hero.time > 52:
        break
while True:
    hero.shield()

 

申し訳ありません。運&装備ゲーです。

これしか思いつきませんでした。

 

苦労と災難

def chooseTarget(friend):
    if friend.type == "soldier":
        witches = friend.findByType("witch")
        if witches[0]:
            hero.command(friend, "attack", friend.findNearest(witches))
    else:
        enemy = friend.findNearestEnemy()
        if enemy:
            hero.command(friend, "attack", enemy)
while True:
    friends = hero.findFriends()
    for friend in friends:
        chooseTarget(friend)

 

How much?

price = 0
fencePrice = 3
lawnPrice = 2
foreman = hero.findNearest(hero.findFriends())
corners = foreman.corners
bottomLeft = corners.bottomLeft
topRight = corners.topRight
width = topRight.x - bottomLeft.x
height = topRight.y - bottomLeft.y
perimeter = (width + height) * 2
price += perimeter * fencePrice
area = width * height
price += area * lawnPrice
hero.say("The total price is " + price)
foreman.bill(price)

 

Volcano Fighters

def findMostLeft(units):
    if len(units) == 0:
        return None
    mostLeft = units[0]
    for unit in units:
        if unit.pos.x < mostLeft.pos.x:
            mostLeft = unit
    return mostLeft
def findMostBottom(units):
    if len(units) == 0:
        return None
    mostBottom = units[0]
    for unit in units:
        if unit.pos.y < mostBottom.pos.y:
            mostBottom = unit
    return mostBottom
paladins = hero.findByType("paladin")
u = findMostLeft(paladins)
s = findMostBottom(paladins)
X = u.pos.x
Y = s.pos.y
hero.moveXY(X, Y)
while True:
    hero.shield()

 

Rectangle Formation

step = 8
sergeant = hero.findNearest(hero.findByType("soldier"))
soldierX = 8
soldierY = 8
width = sergeant.rectWidth
height = sergeant.rectHeight
for x in range(soldierX, soldierX + width + 1, 8):
    for y in range(soldierY, soldierY + height + 1, 8):
        hero.summon("soldier")
        lastUnit = hero.built[len(hero.built)-1]
        hero.command(lastUnit, "move", {"x":x, "y":y})
sniper = hero.findNearest(hero.findByType("archer"))
archerX1 = 48
archerY1 = 8
archerX2 = sniper.archerX2
archerY2 = sniper.archerY2
for x in range(archerX1, archerX2 + 1, 8):
    for y in range(archerY1, archerY2 + 1, 8):
        hero.summon("archer")
        lastUnit = hero.built[len(hero.built)-1]
        hero.command(lastUnit, "move", {"x":x, "y":y})

 

Humantron

def summonAndSend(type, x, y):
    hero.summon(type)
    unit = hero.built[len(hero.built)-1]
    hero.command(unit, "move", {"x": x, "y": y})
centerUnit = hero.findNearest(hero.findFriends())
center = centerUnit.pos
rectWidth = centerUnit.rectWidth
rectHeight = centerUnit.rectHeight
leftBottomX = center.x - rectWidth / 2
leftBottomY = center.y - rectHeight / 2
summonAndSend("soldier", leftBottomX, leftBottomY)
leftTopX = center.x - rectWidth / 2
leftTopY = center.y + rectHeight / 2
summonAndSend("archer", leftTopX, leftTopY)
summonAndSend("soldier", leftTopX + rectWidth, leftTopY)
summonAndSend("archer", leftTopX + rectWidth, leftBottomY)
hero.buildXY("fire-trap", 40, 15)
hero.moveXY(68, 37)
while True:
    hero.shield()

 

Clumsy Circle

circleRadius = 20
def onCircle(unit, radius):
    distance = hero.distanceTo(unit)
    inaccuracy = 2
    minDistance = radius - inaccuracy
    maxDistance = radius + inaccuracy
    return distance <= maxDistance and distance >= minDistance
while True:
    soldiers = hero.findByType("soldier")
    for soldier in soldiers:
        if not onCircle(soldier, circleRadius):
            hero.say(soldier)

 

Circumference of Yaks

yak1 = hero.findNearestEnemy()
radius1 = hero.distanceTo(yak1)
circumference1 = 2 * Math.PI * radius1
hero.say(circumference1)
hero.moveXY(60, 34)
yak2 = hero.findNearestEnemy()
radius2 = hero.distanceTo(yak2)
circumference2 = 2 * Math.PI * radius2
hero.say(circumference2)

 

イェティ地帯

chosen = hero.findFriends()[0]
radius = chosen.distanceTo(chosen.findNearestEnemy())
area = radius * radius * Math.PI
hero.say(area)
while True:
    enemy = hero.findNearestEnemy()
    while True:
        enemy = hero.findNearestEnemy()
        if enemy:
            hero.attack(enemy)

 

断固たる決意

def findwarlock_enemy(friend):
    enemies = friend.findEnemies()
    while enemies[0]:
        if friend.findNearest(enemies).type != "warlock":
            return friend.findNearest(enemies)
        else:
            enemies.remove(friend.findNearest(enemies))
def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = hero.findFriends()
    for friend in friends:
        if friend.type != "paladin":
            continue
        if friend.health < lowestHealth and friend.health < friend.maxHealth:
            lowestHealth = friend.health
            lowestFriend = friend
    return lowestFriend
def commandPaladin(paladin):
    if lowestHealthPaladin() and lowestHealthPaladin().health < 300 and paladin.canCast("heal",lowestHealthPaladin()):
        hero.command(paladin, "cast", "heal", lowestHealthPaladin())
    else:
        enemy = findwarlock_enemy(paladin)
        if enemy:
            enemies = hero.findEnemies()
            if paladin.health < 200:
                hero.command(paladin, "shield")
            else:
                hero.command(paladin, "attack", enemy)
def commandFriends():
    friends = hero.findFriends()
    for friend in friends:
        if friend.type == "peasant":
            commandPeasant(friend)
            pass
        elif friend.type == "griffin-rider":
            commandGriffin(friend)
            pass
        elif friend.type == "paladin":
            commandPaladin(friend)
def commandGriffin(friend):
    enemy = findwarlock_enemy(friend)
    if enemy:
        hero.command(friend, "attack", enemy)
def commandPeasant(friend):
    item = friend.findNearestItem()
    if item:
        hero.command(friend, "move", item.pos)
while True:
    if hero.costOf("griffin-rider") <= hero.gold:
        hero.summon("griffin-rider")
    commandFriends()

 

運が良ければ勝てます、

 

The Hunt Begins

def averageSize(burls):
    sum = sumSize(burls)
    return sum / burls.length
def sumSize(burls):
    sumSizeBurls = 0
    for enemy in burls:
        sumSizeBurls = sumSizeBurls + enemy.size
    return sumSizeBurls
while True:
    burls = hero.findByType("burl")
    averageSize(burls)
    hero.say(averageSize(burls))

 

Yeti Eater

wizard = hero.findNearest(hero.findFriends())
yetis = wizard.findEnemies()
for i in range(5, -1, -1):
    while yetis[i].health > 0:
        hero.attack(yetis[i])

 

よく広告で見ますね。ごり押しも可。

 

空白を数えろ

def moveNSteps(n):
    hero.moveXY(hero.pos.x + 8 * n, hero.pos.y)
riddle = hero.findNearestEnemy().riddle
trimmed = riddle.trim(" ")
a = len(riddle)
b = len(trimmed)
moveNSteps(a - b)
hero.say("message")
while True:
    item = hero.findNearestItem()
    if item:
        hero.moveXY(item.pos.x, item.pos.y)

 

頂上の門

最難関です。装備をそろえなければ厳しいでしょう。

幸いなことに"乱数がない"ので、スマートなコードなどは心がけず、

このステージ専用のめちゃくちゃなコードを書きましょう!!!!