# Level 18 Muchkin Swarm Chest not opening

**URL:** <https://discourse.codecombat.com/t/level-18-muchkin-swarm-chest-not-opening/36044>\
**Category:** Level Help\
**Created:** [September 8, 2023, 2:25pm UTC](https://discourse.codecombat.com/t/level-18-muchkin-swarm-chest-not-opening/36044 "2023-09-08T14:25:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![klawson](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@klawson](https://discourse.codecombat.com/u/klawson)\
**Post date:** [September 8, 2023, 2:25pm UTC](https://discourse.codecombat.com/t/level-18-muchkin-swarm-chest-not-opening/36044/1 "2023-09-08T14:25:13Z")

</div>

Hi there, I’m working in c++ on level 18 (munchkin swarm) and I keep getting the ‘ran out of time’ response but I’m not sure what to change or add to this code. I’m cleaving the munchkins but when I hit the chest, it doesn’t open at all. Please help!!

```python
int main() {
    while(true) {
        // Check the distance to the nearest enemy.
        auto nearestEnemy = hero.findNearestEnemy();
        float distance = hero.distanceTo(nearestEnemy);
        // If it comes closer than 10 meters, cleave it!
        if (distance < 10) {
            hero.cleave(nearestEnemy);
        }
        // Else, attack the "Chest" by name.
        else {
            hero.attack("Chest");
            hero.attack("Chest");
        }
    }
    return 0;
}

```

---

<div class="post-metadata">

**Author:** ![Red-backspider](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/red-backspider/32/23212_2.png) [@Red-backspider](https://discourse.codecombat.com/u/Red-backspider)\
**Post date:** [September 8, 2023, 8:47pm UTC](https://discourse.codecombat.com/t/level-18-muchkin-swarm-chest-not-opening/36044/2 "2023-09-08T20:47:43Z")

</div>

hi, i have no knowledge of c++, but in my code, i attacked the chest only once in the `else` block, maybe that will do a difference?
