# Iron and Ice help

**URL:** <https://discourse.codecombat.com/t/iron-and-ice-help/32551>\
**Category:** Uncategorized\
**Created:** [April 4, 2022, 4:44pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551 "2022-04-04T16:44:01Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chadder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chadder/32/27850_2.png) [@Chadder](https://discourse.codecombat.com/u/Chadder)\
**Post date:** [April 4, 2022, 4:44pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/1 "2022-04-04T16:44:02Z")

</div>

can someone help me find a good strat because right now im doing a tournament between my district and im slowly going down the ranks to #3 I would just like some people to find the best strat.

---

<div class="post-metadata">

**Author:** ![Drew\_Nicklow](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@Drew\_Nicklow](https://discourse.codecombat.com/u/Drew_Nicklow)\
**Post date:** [April 4, 2022, 6:19pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/2 "2022-04-04T18:19:52Z")

</div>

archers for majority of match, pull on other guys tower, push on yours, don’t use teleport, burst on your tower

---

<div class="post-metadata">

**Author:** ![RedDragon9](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/reddragon9/32/16379_2.png) [@RedDragon9](https://discourse.codecombat.com/u/RedDragon9)\
**Post date:** [April 4, 2022, 8:45pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/3 "2022-04-04T20:45:47Z")

</div>

And also counter the opponents anomalies

---

<div class="post-metadata">

**Author:** ![Chadder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chadder/32/27850_2.png) [@Chadder](https://discourse.codecombat.com/u/Chadder)\
**Post date:** [April 5, 2022, 12:34pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/4 "2022-04-05T12:34:17Z")

</div>

also how would I do a while true loop with like a if 25 mana thing for the tower. but also I do I do that with all of the towers.

---

<div class="post-metadata">

**Author:** ![TheBredMeister](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thebredmeister/32/11878_2.png) [@TheBredMeister](https://discourse.codecombat.com/u/TheBredMeister)\
**Post date:** [April 5, 2022, 2:09pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/5 "2022-04-05T14:09:17Z")

</div>

From what I gether your trying to sort of even out the levels of your towers?  
I’d run a checklist to make sure all your towers are even

```python
var towerA = hero.buildTower('tower-type', towerA.x, towerA.y);
var towerB = hero.buildTower('tower-type', towerB.x, towerB.y);
var towerC = hero.buildTower('tower-type', towerC.x, towerC.y);
if(towerA.level > towerB.level){
    hero.build('tower-type', towerB.x, towerB.y);
}else if(towerB.level > towerC.level
    hero.build('tower-type', towerC.x, towerC.y);
}

```

and so on.

---

<div class="post-metadata">

**Author:** ![Chadder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chadder/32/27850_2.png) [@Chadder](https://discourse.codecombat.com/u/Chadder)\
**Post date:** [April 5, 2022, 2:13pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/6 "2022-04-05T14:13:23Z")

</div>

No what I was trying to do was was use a while true loop for the counter anomalies code then when I have enough mana to build a tower (a if 25 mana code) then continue back to the counter anomalies code. Then after that do the same thing but place a different tower. Also Im python.

---

<div class="post-metadata">

**Author:** ![TheBredMeister](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thebredmeister/32/11878_2.png) [@TheBredMeister](https://discourse.codecombat.com/u/TheBredMeister)\
**Post date:** [April 5, 2022, 2:14pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/7 "2022-04-05T14:14:57Z")

</div>

Okay, I cant help with the python, but you could make the anomolie code a function and put it between every step.

```python
hero.whoopdidoo()
anomolyCounter()
hero.wippidybam()

```

---

<div class="post-metadata">

**Author:** ![Chadder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chadder/32/27850_2.png) [@Chadder](https://discourse.codecombat.com/u/Chadder)\
**Post date:** [April 5, 2022, 2:16pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/8 "2022-04-05T14:16:04Z")

</div>

so like just put my anomaly code between my towers.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nick/32/784_2.png) [@nick](https://discourse.codecombat.com/u/nick)\
**Post date:** [April 5, 2022, 5:22pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/9 "2022-04-05T17:22:46Z")

</div>

I like to make an array of the towers I want to build, like:

```python
toBuild = [
    {"x": 18, "y": 52, "type": "cannon", "targeting": "right"},
    {"x": 18, "y": 40, "type": "archer", "targeting": "close"},
    # ... more towers here
]

built = 0
while True:
    if hero.mana >= 25:
        next = toBuild[built % len(toBuild)]
        tower = hero.build(type, next.x, next.y)
        if tower != 'interrupted':
            hero.setTargeting(tower, next.targeting)
        built += 1
    else:
        # your anomaly code here

```

You could then go on to split your tower building and anomaly code into functions that return whether they blocked, so that your hero is only taking one blocking action per iteration of the `while True:` loop. Maybe you decide to use anomalies first before building towers?

```python
def maybeBuild():
    if hero.mana < 25:
        return False
    # tower building logic here
    return True

def maybeUseAnomaly():
    # anomaly-using code here, returning True if you use one
    return False

while True:
    if maybeUseAnomaly():
        pass # do nothing this round of the loop
    elif maybeBuild():
        pass
    else:
        pass # chillin' like a villain

```

---

<div class="post-metadata">

**Author:** ![Chadder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chadder/32/27850_2.png) [@Chadder](https://discourse.codecombat.com/u/Chadder)\
**Post date:** [April 5, 2022, 6:24pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/10 "2022-04-05T18:24:34Z")

</div>

Thank you that helps me a lot.

---

<div class="post-metadata">

**Author:** ![An-94\_my\_beloved](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/an-94_my_beloved/32/34249_2.png) [@An-94\_my\_beloved](https://discourse.codecombat.com/u/An-94_my_beloved)\
**Post date:** [May 6, 2023, 7:42pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/11 "2023-05-06T19:42:08Z")

</div>

If anyone still see this post can anyone help me with anomaly codes, i dont understand them and that the last thing i need to improve my code

---

<div class="post-metadata">

**Author:** ![Arthur\_U](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/arthur_u/32/33846_2.png) [@Arthur\_U](https://discourse.codecombat.com/u/Arthur_U)\
**Post date:** [May 7, 2023, 12:44pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/12 "2023-05-07T12:44:53Z")

</div>

**Welcome TO THE DISCOURSE 😃** _this is a warming and cozy chatting place! for topics like coding and other topics_ but… 😬 this topic is from a year ago please do not necro post

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [May 8, 2023, 6:17pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/13 "2023-05-08T18:17:09Z")

</div>

no, he is okay because he is on topic

---

<div class="post-metadata">

**Author:** ![Arthur\_U](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/arthur_u/32/33846_2.png) [@Arthur\_U](https://discourse.codecombat.com/u/Arthur_U)\
**Post date:** [May 11, 2023, 1:35pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/14 "2023-05-11T13:35:31Z")

</div>

Oh wait I forgot I apologize

---

<div class="post-metadata">

**Author:** ![Arthur\_U](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/arthur_u/32/33846_2.png) [@Arthur\_U](https://discourse.codecombat.com/u/Arthur_U)\
**Post date:** [May 11, 2023, 1:37pm UTC](https://discourse.codecombat.com/t/iron-and-ice-help/32551/15 "2023-05-11T13:37:03Z")

</div>

Uhhhh dont mind my original REPLY cuz i forgot if its on topic its ok if necro
