# \[SOLVED\] Backwoods Standoff help! First Post

**URL:** https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870
**Category:** Level Help
**Created:** [July 5, 2017, 1:16am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870 "2017-07-05T01:16:36Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 1:16am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/1 "2017-07-05T01:16:37Z")

</div>

This is my first post. Thank you to whoever helps.

The level Backwoods Standff appears to have changed, so most threads about solutions are no longer relevant.

I’m having an issue that a few people have realized: my hero cleaves and continues to attack during the reset phase, but he still dies. Que paso?

Here is the task and my code.

# Munchkins are attacking!

# The swarms will come at regular intervals.

# Whenever you can, cleave to clear the mass of enemies.

while True:  
enemy = hero.findNearestEnemy()  
# Use an if-statement with isReady to check “cleave”:  
if hero.isReady(“cleave”):  
# Cleave!  
hero.cleave(enemy)  
# Else, if cleave is not ready:  
else:  
# Attack the nearest ogre!  
hero.findNearestEnemy()  
hero.attack(enemy)

The second to last line: \*\*\*hero.findNearestEnemy(), is probably not necessary, and doesn’t appear to serve a functional difference to the process.

I know people don’t post solutions, but I’d appreciate some help. Maybe I’m supposed to focus on Ogre and not Munchkins?

Anyone???

Thank you!

---

<div class="post-metadata">

### Author: ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)
#### Post date: [July 5, 2017, 1:21am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/2 "2017-07-05T01:21:09Z")

</div>

Correct, there is no need for hero.findNearestEnemy() in the second to last line, since you have already defined enemy at the very beginning.

Note: findNearestEnemy is only a function. It will return the nearest enemy, but you must assign it to a variable.

`var x = hero.findNearestEnemy()`

---

<div class="post-metadata">

### Author: ![Endercore79\_is\_back](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/endercore79_is_back/32/6519_2.png) [@Endercore79\_is\_back](https://discourse.codecombat.com/u/Endercore79_is_back)
#### Post date: [July 5, 2017, 1:46am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/3 "2017-07-05T01:46:46Z")

</div>

Also, please format your code with harmonic formatting (put triple backticks in front and finishing on a seperate line of the code).

Endercore

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 3:02am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/4 "2017-07-05T03:02:00Z")

</div>

Thank you for the response. In this case is the hero the variable?

I took that line of code out and still failed. Is there anything else evidently wrong?

---

<div class="post-metadata">

### Author: ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)
#### Post date: [July 5, 2017, 3:32am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/5 "2017-07-05T03:32:43Z")

</div>

> [@MarkG](#):
>
> Thank you for the response. In this case is the hero the variable?

Hero is not a variable. It is an object that represents the character (a.k.a, the guy you control)

> [@MarkG](#):
>
> I took that line of code out and still failed. Is there anything else evidently wrong?

Just tested this out on Python. It could be an indentation error. Make sure everything is inside the while loop. Correct indentation would look something like this:

```python
while True:
    enemy = hero.findNearestEnemy()
    if hero.isReady("cleave"):
        hero.cleave(enemy)
    else: 
        hero.attack(enemy)

```

However, if your code is like this,

```python
while True:
    enemy = hero.findNearestEnemy()
if hero.isReady("cleave"):
    hero.cleave(enemy)
else: 
    hero.attack(enemy)

```

the program will recognize that hero.findNearestEnemy, is the only line of code inside the while loop and hero.isReady is a whole new line, meaning that everything that comes after `enemy = hero.findNearestEnemy()` is actually out of the loop.

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 3:58am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/6 "2017-07-05T03:58:33Z")

</div>

Thanks for the answer. By black ticks do you mean —? or something else?

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 4:04am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/7 "2017-07-05T04:04:24Z")

</div>

I’ve removed notes and added hash marks (\*) to indicate indentation. \* is one; \*\* is two.

The code still appears written incorrectly. Ideas?

—while True:—  
—\*enemy = hero.findNearestEnemy()—  
—\*if hero.isReady(“cleave”):—  
—\*_hero.cleave(enemy)—  
—else:—  
—_ hero.attack(enemy)–

---

<div class="post-metadata">

### Author: ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)
#### Post date: [July 5, 2017, 4:04am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/8 "2017-07-05T04:04:37Z")

</div>

He means these: `

Surround your code with three of them at the start and three at the bottom.

Instead of:

var x = 0;

Your code will look like:

`var x = 0`

Kind of like:

Triple ticks

–Code–

Triple ticks

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 4:10am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/9 "2017-07-05T04:10:09Z")

</div>

This is still a bit confusing. do you mean at the start of every single line of code? Or just the beginning of while true and end of the last line?

Can you give another example?

---

<div class="post-metadata">

### Author: ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)
#### Post date: [July 5, 2017, 4:57am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/10 "2017-07-05T04:57:19Z")

</div>

What I am referring to is the indentation of the code. For example, in this while loop, everything indented is inside the loop, and everything not indented, the program recognizes is not inside the loop. In this case, everything is inside the while loop:

```python
while True:
    enemy = hero.findNearestEnemy()
    if hero.isReady("cleave"):
        hero.cleave(enemy)
    else: 
        hero.attack(enemy)

```

However, in this case:

```python
while True:
enemy = hero.findNearestEnemy()
if hero.isReady("cleave"):
hero.cleave(enemy)
else: 
hero.attack(enemy)

```

Nothing is indented, so the program thinks there is nothing inside the while loop. Therefore, your code will not continuously loop.

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 2:31pm UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/11 "2017-07-05T14:31:32Z")

</div>

I understand what you mean by indentation; is the above code incorrectly indented? It appears in my python exactly as yours was written.

The function appears to occur properly; the hero cleaves when appropriate and available, and attacks individual targets when not available.

I still do not understand what is meant by tick-marks: ’

If everything is correctly indented, and the hero performs the task for half the engagement, why does he die at the end?

---

<div class="post-metadata">

### Author: ![Skillster](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/skillster/32/6509_2.png) [@Skillster](https://discourse.codecombat.com/u/Skillster)
#### Post date: [July 5, 2017, 4:15pm UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/12 "2017-07-05T16:15:05Z")

</div>

What I want you to do is paste your code again. Go to the line above where your code starts and put three of these: `, then go to one line below your code and put three more. I’ll show you an example.

```python
your code here

```

> **[Gyazo](https://gyazo.com/60dca7d3db6d045dc75d640994ef9c0d)**
>
> ​

the ‘tick’ marks is simply the key to the left your ‘1’ key. The key directly above tab and below escape.

also, when doing loops, everything within a loop must be indented 4 spaces, or 1 tab length. so this would be correct:

```python
while True:
    thisLineHasFourSpaces.correct()
if noSpaces:
Incorrect.thisWontWork()

```

Hope this cleared some things up for you!

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 5, 2017, 10:18pm UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/13 "2017-07-05T22:18:35Z")

</div>

I did that and it didn’t do anything.

I don’t understand why you posted that “your code here”, and I don’t see what you’re trying to show me with it.

I downloaded whatever that is, but have no idea what to do with it.

Can someone personally contact me to give a solution?

I have no idea why you’re talking about tabs and indentation, mine appears exactly as the, allegedly, correct code above. There is literally nothing different in the code.

---

<div class="post-metadata">

### Author: ![Oliver\_Ng](https://avatars.discourse-cdn.com/v4/letter/o/bbe5ce/32.png) [@Oliver\_Ng](https://discourse.codecombat.com/u/Oliver_Ng)
#### Post date: [July 5, 2017, 11:17pm UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/14 "2017-07-05T23:17:44Z")

</div>

var enemy = hero.findNearestEnemy.😁

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 6, 2017, 2:58am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/15 "2017-07-06T02:58:48Z")

</div>

[![](https://i.gyazo.com/87e3c24ac663aee6dae7f295c9df1d99.png) ](https://i.gyazo.com/87e3c24ac663aee6dae7f295c9df1d99.png)

How’s this look?

So, I ran the code without the 3 hash tags, so without harmonious formatting, and with them. Neither worked.

Any ideas?

If nothing else, I have to thank everyone in this thread for helping me figure out gyazo.

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 6, 2017, 2:59am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/16 "2017-07-06T02:59:30Z")

</div>

Thank you for posting about gyazo. Learned something new.

I posted my code already. Any hints?

---

<div class="post-metadata">

### Author: ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)
#### Post date: [July 6, 2017, 3:00am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/17 "2017-07-06T03:00:42Z")

</div>

I’m sorry if I mean to confuse you.

I mean to add the three ticks in the discourse when you post your code, so its easier to read.

Without ticks:

if hero.isReady(“cleave”)

With ticks

`if hero.isReady("cleave")`

Remove those ticks and you should be able to pass the level

---

<div class="post-metadata">

### Author: ![Mr-Borges](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/mr-borges/32/6499_2.png) [@Mr-Borges](https://discourse.codecombat.com/u/Mr-Borges)
#### Post date: [July 6, 2017, 3:36am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/18 "2017-07-06T03:36:58Z")

</div>

When you want to paste your code into this forum the indentations will get all messed up.

To fix that, you can put three tick marks before your code, then paste your code, then put three more tick marks at the end of your code. Then all of your indentations will be as you had them in the game. This is needed because sometimes the whole problem has to do with how things are indented.

In the game you never use the tick marks.

I just tried your code as you have it but without the tick marks and it is working.

In order to use cleave you do need to equip a weapon with the cleave ability. I think the long sword is the only one.

---

<div class="post-metadata">

### Author: ![MarkG](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/markg/32/6528_2.png) [@MarkG](https://discourse.codecombat.com/u/MarkG)
#### Post date: [July 6, 2017, 4:17am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/19 "2017-07-06T04:17:54Z")

</div>

Thank you for the post, and for trying my code to see if it worked.

I’ve run the code and it still isn’t working. The character is getting slightly further and appears to be on the last swarm when he is finally killed.

If the code is wrong, and I’ve tried different browsers and cleared my history and cookies, what can I do to get it to run correctly? Why would it still not be working?

Thanks again.

---

<div class="post-metadata">

### Author: ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)
#### Post date: [July 6, 2017, 4:38am UTC](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870/20 "2017-07-06T04:38:23Z")

</div>

This level requires you to have solid armor / gear. Before you enter this level, on the world screen, click on the chest icon near the bottom:  
 ![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex016/uploads/codecombat/original/2X/6/6df835c2a4af51392e845e5657ed6168ee5a2c37.PNG)  
From there, select Armor and then click on Warrior to filter the options. You can then buy armor with the gems you get by beating levels.

Here is the armor I used to beat this level (some of the gear is given out for free):

Faux Fur Hat  
Leather Belt  
Long Sword  
Bronze Shield  
Tarnished Bronze Breastplate

[Next page](https://discourse.codecombat.com/t/solved-backwoods-standoff-help-first-post/11870.md?page=2)
