# \[SOLVED\] Sarven Brawl 7 help

**URL:** <https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127>\
**Category:** Level Help\
**Created:** [June 8, 2022, 9:29pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127 "2022-06-08T21:29:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![NezyPlayz\_3102](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nezyplayz_3102/32/28856_2.png) [@NezyPlayz\_3102](https://discourse.codecombat.com/u/NezyPlayz_3102)\
**Post date:** [June 8, 2022, 9:29pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/1 "2022-06-08T21:29:58Z")

</div>

For some reason, as it started, it said “success” but when I submitted it, it went lag mode.

Is this a bug or is my internet bad?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/c/5/c54e6c814a02a7ba701edcfc91fa83b9908dd325.png)  
This is the code:

```python
# Stay alive for two minutes.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Reme
'''
while True:
    friends = hero.findByType("peasant")
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag()
    if hero.isReady("heart-shield"):
        hero.heartShield()
        hero.shield()
        hero.shield()
        hero.shield()
        hero.shield()
        
        hero.shield()
        hero.shield()
        
    for friends in friends:
        coin = friends.findNearestItem()
        if coin:
            
            hero.command(friends, "move", coin.pos)
    if enemy and hero.canCast("chain-lightning"):
        hero.cast("chain-lightning", enemy)
    if hero.gold >= 20:
        hero.summon("soldier")
    if hero.isReady("flash"):
        hero.flash()
        
    if hero.canCast("earthskin"):
        hero.cast("earthskin", hero)
'''

hero.cast("invisibility", hero)
hero.moveXY(77, 68)
hero.summon("soldier")
hero.summon("soldier")
hero.summon("soldier")

def findInRangeEnemies():
    enemies = hero.findEnemies()
    inRange = []
    if enemies:
        for enemy in enemies:
            if enemy and hero.isPathClear(hero.pos, enemy.pos):
                inRange.append(enemy)
    return inRange
def findEnemy(units):
    goodOne = None
    goodOnes = []
    for unit in units:
        if unit.pos.x < 75 and unit.type != "sand-yak":
            goodOnes.append(unit)
    goodOne = hero.findNearest(goodOnes)
    return goodOne
while True:
    enemy = hero.findNearestEnemy()
    
    if hero.canCast("summon-undead"):
        hero.cast("summon-undead")
    elif hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
    friends = hero.findFriends()
    soldiers = hero.findByType("soldier", friends)
    skells = hero.findByType("skeleton", friends)
    sacrifices = skells + soldiers
    enemies = hero.findEnemies()
    enemy = findEnemy(enemies)
    lameEnemy = hero.findNearestEnemy()
    nearest = hero.findNearest(sacrifices)
    for sol in soldiers:
        enemyS = sol.findNearestEnemy()
        if enemyS:
            hero.command(sol, "attack", enemyS)
    if hero.canCast("raise-dead"):
        hero.cast("raise-dead")
    if enemy and hero.canCast("poison-cloud"):
        hero.cast("poison-cloud", enemy)
    if nearest and hero.canCast("sacrifice"):
        hero.cast("sacrifice", nearest, hero)
    if enemy and hero.canCast("chain-lightning"):
        hero.cast("chain-lightning", enemy)
    elif enemy and hero.canCast("lightning-bolt"):
        hero.cast("lightning-bolt", enemy)
    elif enemy:
        hero.attack(enemy)
    elif lameEnemy:
        hero.attack(lameEnemy)
'''
hero.moveXY(45, 69)
hero.cast("invisibility", hero)
hero.moveXY(87, 71)

while True:
    if hero.time > 1000:
        break
    inRangeEnemies = findInRangeEnemies()
    if inRangeEnemies:
        enemy = hero.findNearest(findInRangeEnemies())
    soldiers = hero.findByType("soldier")
    if hero.canCast("invisibility", hero):
        hero.cast("invisibility", hero)
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
    for soldier in soldiers:
        soldierE = soldier.findNearest(findInRangeEnemies())
        if soldierE:
            hero.command(soldier, "attack", soldierE)
    if hero.isReady("heal") and hero.health <= hero.maxHealth - 200:
        hero.heal(hero)
    elif enemy:
        if hero.canCast("chain-lightning", enemy):
            hero.cast("chain-lightning", enemy)
        elif hero.isReady("throw") and hero.distanceTo(enemy) < hero.throwRange:
            if hero.distanceTo(enemy) >= 10:
                hero.throw(enemy)
            else:
                continue
            
        elif hero.distanceTo(enemy) < hero.attackRange:
            hero.scattershot(enemy)
enemy = hero.findNearestEnemy()
hero.cast("shockwave", enemy)
hero.cast("invisibility", hero)
targets = hero.findByType("soldier")[0]
hero.cast("swap", targets)
hero.moveXY(67, 83)
hero.resetCooldown("swap")
hero.buildXY("soldier", 60, 86)
hero.cast("swap", soldier)
while True:
    hero.cast("windstorm", hero)
enemy = hero.findNearestEnemy()
hero.cast("chain-lightning", enemy)
hero.moveXY(50, 69)
hero.moveXY(92, 69)
while True:
    enemy = hero.findNearestEnemy()
    friend = hero.findFriends()
    if enemy:
        hero.cast("drain-life", enemy)
    if hero.canCast("summon-undead"):
        hero.cast("summon-undead")
    if hero.canCast("summon-burl"):
        hero.cast("summon-burl")
    if hero.canCast("poison-cloud",enemy):
        hero.cast("poison-cloud", enemy)
        hero.cast("raise-dead")
        
    if hero.gold >= 35 and hero.isReady("drink"):
        hero.drink("heal")
    if hero.isReady("earthskin"):
        hero.cast("earthskin", hero)
    if hero.canCast("chain-lightning", enemy):
        hero.cast("chain-lightning", enemy)    
hero.drink("damage")
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    if hero.isReady("heal"):
        hero.heal(hero)

```

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [June 8, 2022, 9:51pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/2 "2022-06-08T21:51:11Z")

</div>

This is just CoCo being stupid, try putting a

```python
for i in range(3):
    hero.wait(0);

```

at the end of the while loop

---

<div class="post-metadata">

**Author:** ![NezyPlayz\_3102](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nezyplayz_3102/32/28856_2.png) [@NezyPlayz\_3102](https://discourse.codecombat.com/u/NezyPlayz_3102)\
**Post date:** [June 8, 2022, 9:54pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/3 "2022-06-08T21:54:56Z")

</div>

Ok, and I just found out all I had to do is watch it for 2 minutes. I guess I did it the hard way. 😓

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [June 8, 2022, 10:03pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/4 "2022-06-08T22:03:55Z")

</div>

Nope, I think. I think, the harder brawl level gets the bigger quantity of enemies are spawning. So the more resourses it needs and computer just freezes.

---

<div class="post-metadata">

**Author:** ![NezyPlayz\_3102](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nezyplayz_3102/32/28856_2.png) [@NezyPlayz\_3102](https://discourse.codecombat.com/u/NezyPlayz_3102)\
**Post date:** [June 8, 2022, 10:05pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/5 "2022-06-08T22:05:25Z")

</div>

Oh. Well, my computer (or should I say PC) is compatible with codes though. But that does make sense, as the computer might overwork, trying to process all the data

---

<div class="post-metadata">

**Author:** ![Watamelon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/watamelon/32/43741_2.png) [@Watamelon](https://discourse.codecombat.com/u/Watamelon)\
**Post date:** [June 8, 2022, 11:40pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/6 "2022-06-08T23:40:56Z")

</div>

You just have to submit and wait there all the time. If you press skip, then it will only holds until level 6. If you submit and wait all the way, you can even pass level 10

---

<div class="post-metadata">

**Author:** ![Watamelon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/watamelon/32/43741_2.png) [@Watamelon](https://discourse.codecombat.com/u/Watamelon)\
**Post date:** [June 8, 2022, 11:41pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/7 "2022-06-08T23:41:36Z")

</div>

Didn’t see that message, but that’s what I do too 🙂

---

<div class="post-metadata">

**Author:** ![NezyPlayz\_3102](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nezyplayz_3102/32/28856_2.png) [@NezyPlayz\_3102](https://discourse.codecombat.com/u/NezyPlayz_3102)\
**Post date:** [June 9, 2022, 2:49am UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/8 "2022-06-09T02:49:53Z")

</div>

Oh, and Backwoods Brawl 11 too. I used the code and put it at the end, but it says the same error message, only this time, there’s no submitting. I just happens. 😑

And when I submit it, it just “ends” at 33.9 s. Why? Is it CoCo being, well, like what moonwatcher348 said?

---

<div class="post-metadata">

**Author:** ![PeterPalov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/peterpalov/32/45280_2.png) [@PeterPalov](https://discourse.codecombat.com/u/PeterPalov)\
**Post date:** [June 9, 2022, 5:46am UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/9 "2022-06-09T05:46:01Z")

</div>

> [@NezyPlayz\_3102](#):
>
> And when I submit it, it just “ends” at 33.9 s. Why?

> [@When the level is greater than 9 it doesn't load](https://discourse.codecombat.com/t/when-the-level-is-greater-than-9-it-doesnt-load/22844):
>
> When I go to levels like Sacred Statue (when the level is greater than 9), in" Submit" the level stops loading, and the system writes that an infinite loop is detected in my code, although I am 99% sure that it is not there. In General, in some levels, this kind of cycles simply do not exist. Look: Since this moment level stops loading. Please, help me with this problem!

Check this topic. It is the problem of the amount of ogres. If dead ogres would be removed (as it is in new arena levels) then, probably, you could get higher. I have Backwoods Brawl 14 and when I submit I can’t even get more than 0.1s.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [June 9, 2022, 5:46pm UTC](https://discourse.codecombat.com/t/solved-sarven-brawl-7-help/33127/10 "2022-06-09T17:46:59Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
