# "Backwoods Brawl"

**URL:** <https://discourse.codecombat.com/t/backwoods-brawl/3773>\
**Category:** Uncategorized\
**Created:** [May 5, 2015, 10:10pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773 "2015-05-05T22:10:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 5, 2015, 10:10pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/1 "2015-05-05T22:10:43Z")

</div>

I need help with the Backwoods Brawl level ([https://codecombat.com/play/level/backwoods-brawl](https://codecombat.com/play/level/backwoods-brawl)). While submitting, I put a flag there, and I think it’s the reason my hero doesn’t move AT ALL. Even after hitting ⟳ RELOAD, the flag is still there. If I don’t get rid of the flag somehow, I may never be able to finish the level! Help?

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [May 5, 2015, 10:11pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/2 "2015-05-05T22:11:33Z")

</div>

Well, let’s see. What did you command your hero to do when there is a flag placed?

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 5, 2015, 10:13pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/3 "2015-05-05T22:13:28Z")

</div>

Here is all of the code I put:

```python
enemy = self.findNearestEnemy()
if enemy:
    self.attack(enemy)
flag=self.findFlag()
if flag:

```

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [May 5, 2015, 10:14pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/4 "2015-05-05T22:14:38Z")

</div>

Okay…are you telling me that when you place a flag, you tell your hero to attack?

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 5, 2015, 10:15pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/5 "2015-05-05T22:15:51Z")

</div>

I actually made a mistake putting that reply. You put your reply while I edited mine.

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [May 5, 2015, 10:20pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/6 "2015-05-05T22:20:51Z")

</div>

Okay, so when you’re running the program (not submitted), the flag is still there, correct? What happens once the flag appears?

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 6, 2015, 12:32pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/7 "2015-05-06T12:32:13Z")

</div>

The hero doesn’t do anything. Both before, during, and after the flag’s appearance, even though the code says “attack the nearest enemy, if there is one”, he does nothing, the enemies come kill him, but he just sits there like a lump.

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 6, 2015, 1:00pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/8 "2015-05-06T13:00:24Z")

</div>

Stuff that could work:

1. ~~Put the `flag` function before the `enemy` function~~ **DIDN’T WORK**
2. Submit again, but don’t do anything. Sure, I’ll have to wait 24 hours to do this again, but once it’s been a day, I’ll see if this works. **TESTING. JUST GOTTA WAIT A DAY.**

---

<div class="post-metadata">

**Author:** ![ChristianKl](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/christiankl/32/2543_2.png) [@ChristianKl](https://discourse.codecombat.com/u/ChristianKl)\
**Post date:** [May 6, 2015, 1:29pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/9 "2015-05-06T13:29:13Z")

</div>

From your code it looks like you forgot the loop.

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 6, 2015, 3:29pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/10 "2015-05-06T15:29:34Z")

</div>

Yeah, I just realized I should do a loop. All I need to do is wait 20 hours and stack up on protection and I should be done in no time.

```python
loop:
    flag=self.findFlag()
    if flag:
        self.pickUpFlag(flag)
    enemy = self.findNearestEnemy()
    if enemy:
        if self.isReady("cleave"):
            self.cleave(enemy)
        self.attack(enemy)
        self.attack(enemy)

```

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 6, 2015, 4:36pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/11 "2015-05-06T16:36:56Z")

</div>

Almost done! I had to get a lot from the store to increase my health. Only 19 hours to go and I can submit it and beat the level!

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [May 6, 2015, 11:04pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/12 "2015-05-06T23:04:49Z")

</div>

Their are ways to beat this with only 500 health

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 6, 2015, 11:18pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/13 "2015-05-06T23:18:50Z")

</div>

> [@Feinty](#):
>
> Their are ways to beat this with only 500 health

Before this I only had like 200-something health

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [May 6, 2015, 11:19pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/14 "2015-05-06T23:19:56Z")

</div>

> [@Magrules15249](#):
>
> Before this I only had like 200-something health

I don’t think has beat it with that

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 6, 2015, 11:21pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/15 "2015-05-06T23:21:36Z")

</div>

> [@Feinty](#):
>
> Magrules15249:
> 
> Feinty:  
> Their are ways to beat this with only 500 health
> 
> Before this I only had like 200-something health
> 
> I don’t think has beat it with that

Exactly. Now I have 339 health.

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [May 6, 2015, 11:22pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/16 "2015-05-06T23:22:30Z")

</div>

I still don’t think that is enough

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 7, 2015, 11:04am UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/17 "2015-05-07T11:04:48Z")

</div>

> [@Feinty](#):
>
> I still don’t think that is enough

Might not be. I don’t really know

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 7, 2015, 11:23am UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/18 "2015-05-07T11:23:42Z")

</div>

> [@Magrules15249](#):
>
> I still don’t think that is enough
> 
> Might not be. I don’t really know

Just beat it actually.

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 9, 2015, 12:50pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/19 "2015-05-09T12:50:35Z")

</div>

Now I’m having the same problem with “[Sarven Shepherd](https://codecombat.com/play/level/sarven-shepherd)”. What’s wrong with my code?

```python
# Use while loops to pick out the ogre

loop:
    enemies = self.findEnemies()
    enemyIndex = 0

    # Wrap this logic in a while loop to attack all enemies.
    while enemyIndex<len(enemies):
        enemy = enemies[enemyIndex]
        # "!=" means "not equal to."
        if enemy.type != "sand-yak":
            # While the enemy's health is greater than 0, attack it!
            while enemy.health>0:
                self.attack(enemy)
            enemyIndex+=1
        else:
            # Between waves, move back to the center.
            self.moveXY(40, 32)

```

---

<div class="post-metadata">

**Author:** ![Magrules15249](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Magrules15249](https://discourse.codecombat.com/u/Magrules15249)\
**Post date:** [May 9, 2015, 12:57pm UTC](https://discourse.codecombat.com/t/backwoods-brawl/3773/20 "2015-05-09T12:57:30Z")

</div>

I’ve noticed the hero’s always going to the center. So I commented out the part about going to the center, and this popped up:  
 ![](https://sea2.discourse-cdn.com/flex016/uploads/codecombat/2558/f6938a3f12c6547a.png)  
Where did I put in the code something about numbers greater than 3 million?

[Next page](https://discourse.codecombat.com/t/backwoods-brawl/3773.md?page=2)
