# Easiest way to select the enemy hero

**URL:** <https://discourse.codecombat.com/t/easiest-way-to-select-the-enemy-hero/3799>\
**Category:** Uncategorized\
**Created:** [May 7, 2015, 8:02am UTC](https://discourse.codecombat.com/t/easiest-way-to-select-the-enemy-hero/3799 "2015-05-07T08:02:35Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![trotod](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/trotod/32/3263_2.png) [@trotod](https://discourse.codecombat.com/u/trotod)\
**Post date:** [September 29, 2015, 11:55pm UTC](https://discourse.codecombat.com/t/easiest-way-to-select-the-enemy-hero/3799/9 "2015-09-29T23:55:04Z")

</div>

Enemy hero `id` can be `"Hero Placeholder"` or `"Hero Placeholder 1`".

Examples for finding enemy hero (best to just add these to the top of the code, outside the main loop, and forget):

```python
# Python
enemyHero = [e for e in self.findEnemies() if e.id in ["Hero Placeholder", "Hero Placeholder 1"]][0]

```

```javascript
// JavaScript
var enemyHero = this.findEnemies().filter(function (e) {
    return e.id === 'Hero Placeholder' || e.id === 'Hero Placeholder 1';
})[0];

```

In mirror matches (Zero Sum, Ace of Coders) it’s easier to just do

```python
# Python
enemyHero = self.findByType(self.type)[0] or self.findByType('knight')[0]

```

```javascript
// JavaScript
var enemyHero = this.findByType(this.type)[0] || this.findByType('knight')[0];

```

as both players have the same hero type (or Tharin if their game session is bugged out).

---

_[View the full topic](https://discourse.codecombat.com/t/easiest-way-to-select-the-enemy-hero/3799)._
