# \[SOLVED\] Seek-and-hide: Battle with the brawler

**URL:** <https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802>\
**Category:** Adventurer\
**Created:** [August 29, 2016, 8:24pm UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802 "2016-08-29T20:24:56Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 17, 2018, 11:47pm UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/21 "2018-09-17T23:47:49Z")

</div>

I really need some help. My code is failing. My character is accidentally going the wrong way and getting attacked by headhunters. Here is my code. Can you please help me?

```python
# Gather 4 lightstones to defeat the Brawler.
# If you find a lightstone, hide.

def checkTakeHide(item):
    if item:
        # The item is here, so take it.
        hero.moveXY(item.pos.x, item.pos.y)
        # Then move to the center of the camp (40, 34)
        hero.moveXY(40, 34)

while True:
    # Move to the top right X mark.
    hero.moveXY(54, 50)
    hero.moveXY(68, 56)
    # Search for a lightstone there.
    lightstone = hero.findNearestItem()
    # Call checkTakeHide with the argument: lightstone
    checkTakeHide(lightstone)
    hero.moveXY(12, 56)
    lightstone = hero.findNearestItem()
    checkTakeHide(lightstone)
    # Move to the top left mark.
    
    # Search for a lightstone.
    
    # Call the checkTakeHide function.
    # Pass in the result of your search as an argument.
    
    

```

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [September 18, 2018, 12:20am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/22 "2018-09-18T00:20:48Z")

</div>

I just ran your code and it worked fine after commenting out the line, `hero.moveXY(54, 50)`. I think that little extra movement in the `while True:` loop is causing a delay.

---

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 18, 2018, 12:47am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/23 "2018-09-18T00:47:45Z")

</div>

I tried that. Is there any other code which can work? For me this code failed! My character still goes and runs into a headhunter who kills him.

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [September 18, 2018, 1:10am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/24 "2018-09-18T01:10:02Z")

</div>

It worked fine for me so it could be an equipment problem. Can you post a screenshot of the gear you’re using? What boots are you using? Maybe your hero is too slow.

---

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 18, 2018, 1:14am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/25 "2018-09-18T01:14:30Z")

</div>

Here is the image:

 ![Screenshot%20(20)](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/6/6976418da4441ee2c1189d48aa22888e0e5de707.jpeg)

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [September 18, 2018, 1:16am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/26 "2018-09-18T01:16:59Z")

</div>

try using the softened leather boots. they’re a little faster and may give you what you need.

---

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 18, 2018, 1:20am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/27 "2018-09-18T01:20:02Z")

</div>

Still failing miserably, with the same issue as before. Is there any other code that I can use? This code is failing!!!

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [September 18, 2018, 1:21am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/28 "2018-09-18T01:21:37Z")

</div>

No, it isn’t failing. It works fine. We don’t give code out on this board so please don’t ask. We’re here to help you solve any issues, not just give answers.

---

<div class="post-metadata">

**Author:** ![Archion](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archion/32/26234_2.png) [@Archion](https://discourse.codecombat.com/u/Archion)\
**Post date:** [September 18, 2018, 1:24am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/29 "2018-09-18T01:24:20Z")

</div>

@Anastasia do you want to join my clan? Pls do cuz i want to get at least 100 people in my clan. The link is in my profile

---

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 18, 2018, 1:26am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/30 "2018-09-18T01:26:32Z")

</div>

Alright. But let’s make a deal. I have my own clan, but no-one has joined it apart from me. If I join yours, can you please join mine? Just search “Artemis Coders” to find mine. Deal?

---

<div class="post-metadata">

**Author:** ![Archion](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archion/32/26234_2.png) [@Archion](https://discourse.codecombat.com/u/Archion)\
**Post date:** [September 18, 2018, 1:32am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/31 "2018-09-18T01:32:48Z")

</div>

Ok (200000000) Can you give me the link cuz there is no search button for clans @Anastasia

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [September 18, 2018, 1:34am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/32 "2018-09-18T01:34:30Z")

</div>

are you using okar stompfoot? He’s waaay too slow. Try using a faster hero. I’m passing the level with your code using Tharin.

---

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 18, 2018, 1:39am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/33 "2018-09-18T01:39:46Z")

</div>

Our bargain is complete! I joined your one!

---

<div class="post-metadata">

**Author:** ![Anastasia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anastasia/32/7378_2.png) [@Anastasia](https://discourse.codecombat.com/u/Anastasia)\
**Post date:** [September 18, 2018, 1:40am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/34 "2018-09-18T01:40:40Z")

</div>

Finally working! Thankyou!

---

<div class="post-metadata">

**Author:** ![Archion](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archion/32/26234_2.png) [@Archion](https://discourse.codecombat.com/u/Archion)\
**Post date:** [September 18, 2018, 1:40am UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/35 "2018-09-18T01:40:50Z")

</div>

K Great! (20 charsss)

---

<div class="post-metadata">

**Author:** ![Bard](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Bard](https://discourse.codecombat.com/u/Bard)\
**Post date:** [February 12, 2023, 7:49pm UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/36 "2023-02-12T19:49:30Z")

</div>

I’m also struggling on this level. I keep being killed by the big ogre that spawns out of the tent.  
I only have 1 or 2 lightstones at the time he arrives. When I re-enter the camp, for some reason the hero loops back towards the ogre rather than leaving.

Below is my current code re simplified, but I have tried multiple variations including creating variables to have him recognise the enemy prescience (hero.findNearestEnemy), and used (hero.distanceTo) to trigger an if/else. My thinking was that if the “if” told him to move away from the enemy every time it was within a certain distance, he wouldn’t get killed and that might count as hiding if he was out of sight. But I kept getting a null target from that, so eventually deleted it because “if there’s no enemy, there’s no distance to enemy”. I tried including an else statement as well but it still wouldn’t run.

I know it must be missing something simple, and probably overcomplicating it as a newcomer, but I’ve been at it for over an hour and I’m just getting frustrated…

 ![1](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/7/d/7deb8c8d38aaac87802f56b28f6a8b181cba425e.jpeg)  
 ![2](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/e/e/ee078db3d1b3a61c43dd4cc271bdbc430ee4f065.jpeg)  
 ![3](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/4/8/48912d0eedcf888e734987556c98d3f09424888e.jpeg)  
 ![WhatsApp Image 2023-02-12 at 11.45.11](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/8/5/8588230505542fb44bd4f30df66a99b27949fd7f.jpeg)

---

<div class="post-metadata">

**Author:** ![Bard](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Bard](https://discourse.codecombat.com/u/Bard)\
**Post date:** [February 12, 2023, 7:50pm UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/37 "2023-02-12T19:50:02Z")

</div>

![5](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/0/6/064dd74d603d33c8692415de044aa8da7529a7b6.jpeg)  
 ![6](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/c/0/c008226ddb3ad95ab9ce0521f6fd605fd24409cf.jpeg)  
 ![7](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/5/d/5db439c6424c43e64de8ba2198b2dc4c97d60303.jpeg)  
 ![WhatsApp Image 2023-02-12 at 11.45.14 (1)](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/3/c/3c669716dfde925ac218f3dc45e6a7c7a70046e9.jpeg)  
 ![9](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/4/f/4f0a94f254a21535b072d9f2ab60d3d45983118a.jpeg)

---

<div class="post-metadata">

**Author:** ![Bard](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Bard](https://discourse.codecombat.com/u/Bard)\
**Post date:** [February 12, 2023, 8:10pm UTC](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802/38 "2023-02-12T20:10:48Z")

</div>

So I took a break and reset the code, and did it in 2 minutes… Lesson learnt, if in doubt or frustration, sometimes just take a break and hit reset.

[Previous page](https://discourse.codecombat.com/t/solved-seek-and-hide-battle-with-the-brawler/8802.md?page=1)
