Spring Challenge 2022 - Feedbacks & Strategies

Finished 11th (somehow reached 1st before final recalculation :upside_down_face:)

Till top-100 gold I used heuristics only full defense bot, it was unable to reach gold boss, despite beating him constantly in IDE.

Defense heuristics:

  • Heroes are allowed to hunt spiders only in range max(base_nearest_enemy_distance, 8500), or else go to their default points
  • sort all spiders by their “threat level” (time_to_reach_my_base - (hp + 1) / 2). Time calculated through movement simulation
  • greedily assign nearest hero to the most dangerous spider (calculate the point where spider can be reached in t turns and find the hero with minimum t)
  • if spider cannot be killed in time, try to push him instead of attack
  • if meet point inside base attraction range, push spider outside to gather wild mana
  • if there’s an enemy in sight try to control it to map center
  • also check if spider cannot be killed with one hero and assign two in that case

In legend these heuristics changed slightly:

  • allow enemy hero control only if 3 enemy heroes are near my base (trying to prevent triple wind push)
  • do not push spiders outside for wild mana, cause it doesn’t matter anymore

Also, I use “mana gain maximization” concept: given constraints (point, range, and time in which we should be at least on a given range from that point) try to slightly change trajectory trying to maximize spider hits. Here I use simplified simulation without health consideration, which allows using bruteforce with 12 movement points on depth 3 without noticeable time impact.

The main advantage which gets me to top legend is attacking using search algo. I use bruteforce for 4 depth, with a fixed set of movements:

  • wait
  • move to 8 directions with maximum speed
  • use wind on the spider nearest to the enemy base
  • use control on an enemy, closest to his base
    Also tried to use a shield on monsters, but discarded it due to periodical timeouts.

As an evaluation function at first, I tried to account enemy hp and mana, but this doesn’t work at all, cause of the small search depth.
So I end up with scoring function below (here lerp(v, from, to) means clamping value in range [from, to] and lineary interpolate into range [0, 1]):

  • (1.0 - lerp(enemy.hp, 0, 3)) * 3000
  • extra 10000 bonus, if enemy reaches 0 hp
  • lerp(my_mana, 0, 100) * 50.0
  • very small bonus for moving in point on enemy attraction range,
    motivating move when nothing more to do
  • bonus for winding spider into enemy base
    10 + lerp((my_mana - enemy_mana) / 10, 0, 5) * 100
    means the more our mana advantage, the more aggressive we are trying to push spiders
  • for each spider in enemy attraction base,
    calculate spare_time = time_to_reach_base - (hp + 1) / 2, and give bonus proportionally 1.0 - lerp(spare_time, -1, 4)
    • if spider in our wind cast range and not shielded increase bonus by 1.5
      (solely this condition pushed me into top legend, I guess it motivates a hero to be in a nice push position after the search ends)
    • give a bonus when nearest to the base spider is out of enemy view range (motivate to control enemy out)
    • give a small bonus if the spider is in our view range (motivate to follow and make sure it reaches base)

Given the very small search depth, I spent many hours tuning the scoring function, trying to hint good future positions for search.
Using lerp function, allow me to easily set desired behavior such as “try to push spider, but if low on mana, try to farm instead”.
For enemy prediction, I use a simple approach: go to the nearest spider and use wind, if a spider is too close to the base. It helps with using control on an enemy, in other cases, I didn’t notice any effect compared to “wait” actions.

Also, I use tracking (move spiders in fog) and symmetry (if a spider is seen the first time, create his sibling in a symmetrical position). Tracking can be done quite easily: just check position and remove those who should be visible but not given in turn input

Big thanks to Codingame for that contest, it’s nice to again compete and chat with all of you :slight_smile:
Also, this game has a really simple simulation and allows different approaches to strategy, which is very friendly to beginners.
Pretty satisfied with my rank, despite falling so fast during recalculation. Touching first place was the first such experience for me, I definitely do my best to stay there longer next time.


Rank: 349th Legend, 2nd in Spain
Language: Java

Hello, my bot is so simple that I feel ashamed after reading your strategies.

Essentially my bot is a huge collection of “if - else if - else”. I used a two defender - one attacker strategy with a lot of trial and error and tweaks after watching my games. The key to my rise to legend was when i started to send my attacker to a spawn point to recollect mana and after 100 mana start to attack.

The attacker bot is pretty simple, wind spiders into enemy base and some control on enemy heroes. If there are spiders near the enemy base he chases them to use more winds. I have a list with the most dangerous spiders for my enemy and the attacker bot chases that spider. I failed trying to implement a patrol system, i did it and it seemed to work well but the rank was 200 positions worse I don’t know why…

The defensive strategy consists of the two bots chasing the two most dangerous spiders, each chasing the one closest to him and using wind if the spider is too close to my base.

All this in just under 300 lines of code… I had a great time but after reading you it’s clear that I didn’t stand a chance, in fact I don’t even know how I got into legend. Can you recommend me some resources to improve for the next events?



Rank 35 Legend, Python 3. Heuristic script of ifs.

Many thanks to CodinGame for making this possible, and my competitors for such a fun competition.

People whose bots I watched and gained insights from (I watched a lot of games between lots of bots but these 3 in particular I benefitted from observing at key stages of the competition):

Main ideas:

  • 1 attacker, 2 defenders.

  • Start attacking as soon as possible (important for vs 2 and 3 man rushers using the wind stack mechanic)

  • Don’t chase lost cause bugs which you can’t stop from running home in your base

  • Don’t shield your heroes or enemy heroes (shielding yourself is a net loss because you spend mana where they never bother wasting mana on spells when your shield is up, and even then they can wait for their chance in the 1 turn your shield is down and you cannot replace it). Credit to @Husenap for his cool strat where he shielded enemy defenders so his attacker could windspam spiders past them.

  • I had a default formation where the 2 defenders prioritize spiders within my base, and wind them when they’re close to my base (which becomes more generous with winds the more enemy attackers there are), and outside of the high priority base spiders, they also had a permitted wander radius looking for spiders to farm/defend against within radii of hotspot points.

  • The attacker had a patrol path much like @Arnaud.Net . One specific detail about my patrolling was that I kept it on a fixed period of 8 turns rather than ‘when you get to your destination, switch destinations’ - instead, the destination switched every 8 turns.

  • I had a special formation if there were 3 attackers where I would send the two defenders off to 1) the ‘problem’ corner of the map, and 2) to follow around the enemy trio

  • @blasterpoard seems to think he was the only one to pioneer the idea of sweeping spiders off the map at the edge, but I had that in my script for the last 3 days or so. It is helpful, but evidently either I could have implemented it better or other things were also important that I failed to do well. In short, if your defender heroes are near the board edge, instead of winding spiders towards the enemy base, wind them off the map. Also, if you are about to wind spiders defensively, if you can avoid winding them straight into an enemy hero by winding them horizontally or vertically instead, do so.

  • Attacker controls spiders into enemy base sometimes, he also controls enemy heroes who are defending well. He winds spiders into the base sometimes, and he winds them home when in the base. If he has just winded or done something important which means a spider might be ‘runnning it home’ within the enemy base, but i cannot cast a spell on it, I either chase the spider closest to the enemy base, or I run towards the enemy base.

  • I very rarely used shield, I only really used it with my attacker on spiders running it home in enemy base if it guaranteed they’d score.

  • Attacker would also leave his patrol point sometimes to get the nearest spider in some situations.

  • Devil being in the details: farming positioning, attacker positioning:

Defender farming:
Rather than just making a beeline for a specific spider of choice, if I could find a trio of spiders with a hotspot to stand in which lets me hit all three and one of the trio is the spider of choice, I do that. And if there is a spider next to my spider of interest and they are within 1600 of each other, I stand in the midpoint of them.

Attacker not killing spiders running home:
Make sure to offset my position next to spiders I am trying to get into the enemy base: if i am further away from the enemy base than the spider, stand a fixed distance behind it, if i am already between enemy spider and the base, stay ahead of it a fixed distance out of melee range.

  • My defenders would wind defensively on spiders within trouble distances

  • My attacker would not only wind spiders in various ways but also sometimes wind defending heroes away into the middle of the map.

  • My attacker would also specifically wind spiders in the direction which takes them directly towards the enemy base, not just “SPELL WIND {0} {1}”.format(enemy_base_x,enemy_base_y).

Thats it. About 635 lines of crude code, which could have been written better, but was ever evolving and had various bits repeated in slightly augmented forms in order to preserve a sense of priority.

Other minor points: tracked my own mana throughout so that i would never try to cast something if i couldnt cast it, never tried to control something if it had a shield up.

This could easily be improved upon, there are tons of things I didn’t do that other people did.

Thanks to @jar2 for as always being a great rubber duck/sounding board, he also made legend with a completely defensive bot, no attackers.

I spent a lot of time on this contest because of my obsessive nature and it coincided with a holiday, but I fell ill in the last 2 days which basically had me bed ridden, but also it was difficult to do much rigorous testing because the calc time was pretty slow, so if you made a change and wanted to tested you had to basically go afk for an hour, but whilst I complain, I still appreciate everything CodinGame do, and even if this issue is not fixed, I have no doubt I will be back.


With my bot I decided to go with a two attackers one defender strat, because (at the time) nobody else seemed to be doing that.
My bot was sorely in need of a rewrite by the end, however I ran short of time so I continued with the original.

Some of the features I implemented were:

-Spider n-move prediction and interception.
-Spider health-per-tick before reaching base post-interception.
-Maximal-clique based enemy group targeting.

-Implementation of my own ‘threat_for’, as the provided one was bugged (might have been fixed?)

-Dynamic selection of raid members based on task value.
-Control and shielding of enemy heroes before a spike into goal.
-Enemy defense estimation for how my attackers should act, e.g. self shielding, acceptable spike distance, etc.
-Patrols to get clear of enemy heroes for a clean spike.

This build was hyper-aggresive and it was always a delicate balance between executing a raid quick enough, and bringing enough mana to finish the enemy off, as my defence could not last into the mid-late game.
Due to this, farming was of utmost importance.
Initilially I would send all my units to the borders to intercept incoming spiders, which as well as generating mana, would keep the spiders away from any start of game enemy attackers lurking near my base.
The spider clique-finder helped with this as well, as a minimum of heroes could be pulled to defend while the others were utilised for farming.

Final word:
I enjoyed this challenge very much and it was interesting to see a large variety of builds.
This was actually my first challenge and I only started a few days in, so next time I’ll see if I can be in early.
Good game everybody, and happy coding!


Hi Raxkin I find your geometric approach very interesting as it is completely different from my graph theory approach. In my method I created graph edges between all spiders that are within a certain range from each other, ran a maximal clique finder algorithm on the graph to group the enemies, and sent heroes to the central point of each group.
I think your method may be more inclusive and accurate, as it calculates the exact points of interception between the hitboxes.


8th place overall, 1st python solution

Thanks a lot for the challenge. It was very fun :slight_smile:

My strategy was to gather mana, then go on a full-scale attack. No defense at all, besides early emergency defenses.

1. Mana farming
This is the most unpolished, crude part in the solution and I know there are some simple things that would improve a lot in the bot’s performance. Basically all I’ve done is going after the closest visible monster, unless there is a hit-more-than-one-monster situation available. Also, heroes were forbidden from leaving their designated farming spots too far. During farming, there is a defender role assigned whenever there is a monster targeting my base that I could kill before it reaches the base. This role was assigned to the hero that could catch it the soonest.

2. Moving to the full scale attack
If enough mana was gathered (sadly, I didn’t check for the optimal amount), I send all the heroes closer to the enemy base. In this phase, I do some emergency defenses if I detect I can quickly save my base using Control or Wind. If I stumble upon a high health monster that is not targeting the enemy base, I use Control. I try to avoid damaging monsters that are threating the enemy base as well.

3. Full scale attack
My attack strategy is 3xWIND only. When I say shooting, I mean 3xWIND towards the enemy base.

When heroes are close to the enemy base, I iterate through all the visible monsters and select one that I can surround and shoot towards the enemy base the soonest (the exact options I consider are described below). The important part is I calculate in exactly how many turns I can shoot. I don’t necessary require the monster to reach the base immediately after shooting, because that would limit my shooting range to 6900. There are some strategies out there that defend very well against shooting from 6900 range.

Depending on enemy heroes’ locations, I sometimes shoot from much farther, even as far as 11000 units, if I figure that enemy heroes won’t be able to catch the monster in time OR if I have a lot of mana, I can shoot a spider just to force the enemy heroes to go back to save their base. After they go back to save their base, I can shoot freely from range 6900.

I analyze a few scenarios and select the best one:
a) Surround the monster, wait until it is close enough and shoot (30 mana cost)
b) Use Control on the monster, surround it and wait until it is close enough, then shoot (40 mana cost)
c) Wait until the monster is close enough, use Wind and shoot immediately after this (1xWIND->3xWIND 40 mana cost)
d) Rarely use Control, wait until monster gets close enough, then 1xWIND → 3xWIND (50 mana combo)

Additionally, I assert a few things heuristically:

  • Will the monster be alive after shooting? Maybe it is already targeted by enemy heroes? How much damage can they deal before I shoot?
  • Is it safe to deal some damage to the monster before shooting it? If yes, do this to get mana. It’s best to shoot monsters that have 1 or 2hp left.

If I find myself having less than 30 mana during the attack, I try to get the missing amount by attacking the monster without killing it. If impossible, I do whatever it takes to get mana.

A good counter for this strategy is a tenacious, Wind-heavy defense, which pushes my heroes far from the enemy base. My heroes tend to stick together and they actually need to be together to perform the attack. So splitting them up is a good move that will often work.

Representative replays to see the algo in action:

Very poor win ratio (like 10%) against #1 @bowwowforeach who had a great defense.
This is one of the lucky victories: https://www.codingame.com/share-replay/631483357
This is lost due to mana struggles: https://www.codingame.com/share-replay/631533331

Against #2 @blasterpoard I usually lost, but when I won it was a very short game:

Against defense heavy and late attacking #3 @Nanaeda (around 50% win ratio):

#7 @tkodai had a very similar strategy, but he farms for longer so I usually won 1v1:

Nicely solving some mana struggles during full scale attack (#17 @Zylo):


Rank 154 Legend (my objective was top 500)

3rd time a Legend. I probably benefited from the heuristics-favored type of game and the early opening of Legend league. Still, since I don’t code much, except for CG challenges and AoC, I’m quite happy with the results.

Also, quite proud to represent the CG team and be one of the few still interested in competing. :hugs: @_CG_Simon @_CG_Keelhaul @_CG_SaiksyApo


I started badly, trying to find a weird use for WIND in the Wood 1 league. I hadn’t taken much part in the internal testing so I didn’t have so much advance.
The idea was, instead of winding spiders in, to wind opponent heroes out. This failed miserably because the WIND applies after the heroes move


Finally decided to go full defensive to pass in Bronze and start using the CONTROL spell. A simple and effective enough idea was to redirect all spiders to the enemy base but not in the middle: I targeted instead its edges. This had the disadvantage of feeding mana to my opponent but I didn’t care much about the ties, I wanted to be offensive, and fast.

Forcing my heroes to spread and target different spiders pushed me in Silver league.

However I only reached the rank 2500. Tried a few other simple things but they failed. When you see a 3w/7l first push, you know your bot is bad.

I knew I didn’t have much time to code last week so I was starting to think it might not be a challenge for me.


Finally a decent push 9w/1l that got me in Gold and then higher. What made the difference was

  • WIND is just way better than CONTROL to defend against spiders already in base. Yes, I was doing that :grin:
  • WIND offensively at least 2 spiders (I had only 1 attacker) and CONTROL the ones with most HP
  • CONTROL opponent heroes to prevent them from defending well
  • tweak hard-coded position goals for my 3 heroes, and especially the attacker at turn 50

After a nice submit and some patience (my bots always rank up after submits are complete), I reached rank 100 on Saturday morning. Only 7th in Gold, but 2 points behind the boss. I knew this wouldn’t make it. I was afraid of resubmitting but I had to try


My last ideas was self-SHIELD and taking into account spider movements for MOVE directions. I didn’t want to try following spiders through the fog, although that might have been really interesting considering my CONTROL strategy on spiders.

Before leaving for irl activities, I quickly realized the self-SHIELD didn’t work well so I repushed a bit blindly the last few tweaks I had done, without being too much confident.

I finally got the nice surprise in the late afternoon.


I was a bit afraid to keep the fog in the game, but it didn’t feel so annoying after all. Spells were fun and easy to use, which made the game cool to play for many.

We saw the first use of triple WINDs on Wednesday (unintended during game design) with Simon and decided it was powerful but not game-breaking, so we kept it.

Congratulations to everyone who took part. I hope most of us enjoyed it. And thank you for all the shared strategies.

It was great seeing the community gather for this event once again. I miss them too! Hopefully another Fall Challenge will come :heart:


#4 Legend

I’m going to focus on interesting things I did and how I managed to stay near the top of the leaderboard throughout the contest without using anything fancy, just heuristics.

Since there are so many different opponents in the leaderboard with different strategies, I had to adapt my offence/defence to a variety of them.
The way I would do this was by trying to identify what kind of offence/defence the opponent was running and choosing a strategy to counter that, more on this in each respective part.

My General Development Cycle

  1. I looked at cgstats to find players that I’m constantly losing against.
  2. Analyse the replays to find out the reason why I’m losing games.
  3. Figure out a way to improve my bot in those cases without breaking everything else.
  4. Make the changes and test against my arena code using CGBenchmark. (I didn’t always do this)
  5. If the result looked good I would test it in the arena.
  6. Back to step 1.

I also spent a lot of time analysing other replays from the top of the leaderboard to get an idea of why others were winning/losing.


There were a lot of different attack strategies throughout the contest, but I decided to stick with only one attacker that would go and try to get monsters into the opponent base.
At first my attacker didn’t do a very good job, it spent most of the time running around looking for monsters because my vision was very limited on the opponent side.
It was clear to me at that point that I needed to predict monster movement outside of my vision.
After implementing the monster prediction, my attacker started running towards locations where monsters could potentially be and became much more effective.

However, I had to adapt my attacker to the opponent’s defence because I was always low on mana.
If there was only one defender my attacker could use control when possible and effectively cripple the defence.
If there was more than one defender, I couldn’t use control because it wasn’t effective against the good defence of the top players, so I would spend more mana on wind and shields for monsters.
I would also avoid using wind on monsters that would die by calculating the potential damage they would receive this turn.


I used 2 heroes for my defence, they would farm near the 2 closest spawn points when the base was safe. They would also attack multiple monsters at the same time (like many have described above) to generate as much mana as possible.
The defence was actually pretty weak and could be countered pretty easily if they were farming far from the base right before getting attacked.
If the opponent was only attacking with one hero, the defenders would pretty much ignore the attacker and focus on defending the base.

Defending against Cannon Attacks

This is where it gets interesting, one big problem for my defence was the cannon attacks.
My mana was almost always empty because of my defence and my aggressive attacker.
If I didn’t win the match before the cannon was ready, I would often lose because I couldn’t do anything against it. I ignored this for a long time but I decided to work on it towards the end of the contest.

First attempt

On the last night of the contest I got an idea: as soon as I notice that the opponent is running cannon, I pull back my attacker and start farming with it. This quickly generates enough mana for one of my defenders to go into cannon defence mode where it would push the opponent heroes away from my base.
Here is a replay that shows the first attempt, I still lost some games because of wild mana.

Second attempt

I noticed that I generated a ton of mana when I was defending against cannon attacks, so I tried using control on monsters to send them to the opponent base in hopes that the opponent would make a mistake.
Here is a replay of that. I submitted it to the arena and let it run over night.

Third attempt

When I woke up the next morning I was doing pretty well in the top 5, but I figured I could make my farmer more aggressive if I had more than 50 mana to win those games where I would lose because of wild mana.
So now, instead of farming anywhere on the map, I would farm near the opponent base.
I would still control monsters towards the base but now I would also shield monsters inside the base.
I submitted this strategy 7 minutes before deadline and it performed pretty well.
Here is a replay showing my final cannon defence.

So each hero had one specific job:

  1. Defend my base (this hero generated a lot of mana as well)
  2. Push opponents away
  3. Farm near opponent base and attack them using control and shields.

Final Thoughts

I’ve been away from CG for 5 years and couldn’t have had a better comeback. My objective was to reach the gold league, but it looks like it went much better than I had anticipated.
I thought this game was very fun and I loved the competition at the top of the leaderboard. It was always so fun and impressive to see how people came up with new ways of countering each other and improving their bots.
I want to congratulate the winners and thank all the players for the fun competition. And thanks to CG for the awesome platform.


Rank around 300e Legend, C++. GA.
1 Attacker, 2 Defenders.

I started with the same state of mind than _Royale:
“I did not want to write a heuristic bot, so I tried to sim it despite the action space / hidden information.”

I spent the three first days working on it. This is not the fun part.

I started with a simple MC on actions for the two next turns.
It was enough to be promoted in Gold.

Despite a huge factor for the health, my evaluation is mainly setting a threat score for each mob and a little bit for heroes position and for mana points.

Finding the right balance for mana was a little bit challenging.
Too low and heroes were wasting mana for nothing sending useless spells all the time…
Too High and heroes were spending their time killing monsters…

Number of possible actions for heroes are not too big:
-16 directions + 1 direction for each mob and opponent heroes positions.

  • If at least one opponent or mob in range: 4 dir wind + 1 wind towards opp base
  • For each opponent hero or mob in range: 2 controls (one for each base)
  • For each opponent hero or mob in range: 1 shield

Then switching to a GA let me find actions for next 4 turns instead of 2.
To get to legend, I also had to hardcode an opponent action.
As soon as the opponent was in SIGHT of my base and in range of at least one mob, it would WIND.
The GA defense increased a little bit.

After that I tried a lot of different ideas, using brutal tester to validate them. But none of them really worked.

I really struggled to find the right counter for aggressive strategies. I thought I could try to kill mobs around attackers so that they would have nothing to push but it was hard to code as an evaluation and not very efficient anyway I think.
I did not realize that we could simply push them out of the map… (RTFM…)

I liked this contest. I have a personal preference for games where GA can find strategies I could not even think of… But I really had fun anyway.

I hope we will get another one in less than one year… :slight_smile:


53th Legend - Java

First i want to thanks CodinGame for that great challenge, it was really fun and i’m also happy it has ended so i can sleep :smile:


As a lot of players, my AI is just heuristics. The fog of war and all moves possibilities discouraged me from doing a simulation and i was also happy to do heuristic as sometimes it is more fun ^^.

Like other players i have roles: defender, farmer and attacker. I have a list of strategies that apply with priority. I do not have evaluation function, i just put my strategy in order from the highest priority to the lowest.

As soon as a hero can do a move he will not try any other strategy. It is simple but it works and it is easy to read ^^. I had this kind of strategy in Soul Snatchers i’m about 43th so it can do the job.

Farming - Smallest circle problem

Early in the game i focused on farming first as it is the key to get mana and build a strong attack.

Here are the keys i used to optimise it:

  • simulate all the spider next moves so i can intercept them instead of running after them, save turn during farm and also during defense interception (and recompute also the ThreatFor as there was a bug on the referee :wink: )
  • do an optimisation on farmer move after the strategy is applied to see if i can attack multiple monsters in a turn. For that i used the Welzl’s algorithm that is used to solve the Smallest-circle problem

I have seen in the previous posts some tries with geometry but i was surprised no one talked about this algorithm. I take all the spiders positions that are in a radius of 1600 (MOVE + ATTACK) from my hero and apply the algorithm on it (with me included also indeed). If no solution found (a solution but with a circle bigger), i try all the combinations removing some spiders. As my strategy aim a spider in particular i will always keep its position so i will be sure to hit it.

That works pretty well and my farming was pretty good. With only farming and defense i reached the gold league.

Triple push super sayan!

To reach the legend, i see some players with two attackers doing triple push (1+2). I thought it was really fun so i implemented it. When i reach a certain amount of mana my 2 attackers go to the enemy base doing control on the road to bring ammunitions :p.

I compute then a position to join to do the triple push : 1 push and then a double push to put spider directly into the base corner and win the point. Not possible for the opponent to defend it without attacking my heroes.

It works a lot and on sunday with that strategy i reached the 2th place and hoped i could be in the top 10 at the end of the contest.

But it seems some top player worked hard to counter this strategy like @Husenap have done :smile:
Like @blasterpoard, i was aiming the side of the base but i thought about a counter by pushing spiders to the side so i changed my mind and start aiming the middle position.

Bulk strategies

  • Intercept spiders going to my base with the closest farmer or the only defender
  • Wind out of my base when possible
  • Wind if i can’t kill the spider
  • Shield spider that can reach enemy base with it and enough health to resist if a hero want to kill her
  • Do a control on a close enemy hero instead of waiting during the first push of the KAMEHAMEHA preparation

What i should improve

  • Defense wind waste mana: as i was winning a lot with the wild mana on the first contest days i put a wind strategy to expulse systematically spider from my base so i will earn wild mana attacking them outside but i forgot to remove it on the late game where i waste mana doing that when it is not necessary
  • defense wind and control: i really concentrate on attack and had a bad defense, i tried to use shield but remove it as it was wasting too much mana that was missing for my big attack
  • wind outside spiders: i had this strategy on sunday to push out spiders on the side but removed it as i couldn’t see if it works because submitting time was really too long!
  • attack control and shield: as there is a lot of counter now of the double push i should as @blasterpoard have done diversify my attack doing control to take aways enemy heroes and also shield more monster to force the enemy to go in his base instead of pushing me
  • mirror spiders and compute their positions: i have done it on soul snatchers and it works pretty well but i never found the time to do it during the contest as other ideas took priority over that


A really fun contest and a lot of things remaining to do. I really like this game as there is no killer strategy but we can see multiple ones performing well. As we can play well with heuristic i think i was more accessible for a lot of players.
I was a little frustrating at the end by my ranking falling and my latest improvements removed at the very end because i couldn’t see if it was good or not due to slow submission.

Thanks a lot to Codingame, see you on the next contest!


1st place
My strategy was 2 defenders and 1 attacker.

The behavior of the defender is determined by if/else.

First, there are four roles.

  1. Defeat monsters approaching the base. If a monster cannot be defeated, use WIND near the base.
  2. Chase after the opponent’s heroes and block them with WIND.
  3. Defeat monsters approaching the base (4000,4000).
  4. Defeat monsters near the spawn point.

These roles are assigned to each hero according to the position of the hero and the monster.
Each hero takes actions according to his or her role.
For example, while being attacked by an opponent, roles 1. and 2. are assigned.
If it is determined that the opponent’s spells will cause damage, WIND will be used regardless of the role.

The attacker’s action is determined by a 15-turn chokudai search.
The opposing defender’s action shall be the same as our defender’s action.

List of Actions

  • Move to the opponent’s base area
  • Move to the opposing monster’s spawn position
  • Move to the monster
  • Move around the monster without damaging the monster
  • Move within 1100 radius of the monster and use Wind (aim to use Wind twice in a row)
  • Move close to the monster and use WIND
  • Move close to the monster and use SHIELD
  • Move closer to the monster and use CONTROL
  • Use WIND on opposing hero
  • Use CONTROL on opposing hero
  • Use SHIELD on myself

Evaluation Value

  • Damage to opposing base is fast
  • Damage to opposing base is high
  • How close the monster can get to the opposing base
  • How much mana you have left

Sorry I can’t give you a detailed explanation as I don’t understand English.
Thanks for the fun contest.


It’s cool that you noticed that I shielded the opponent heroes! It worked really well for a while, but in my final version I actually commented it out because I noticed that it was using up too much mana and the top players had really good defence, so the amount of mana for the damage wasn’t really worth it. I still think it can be useful in some situations, just need a smarter bot to know what those situations are. :stuck_out_tongue:


First of all, warm thanks to CG for organizing this very successful contest and congratulations to all winners. Watching your replays is really an amazing experience. Finally, thanks to all participants for being such fierce competitors.

My performance (633th) does not deserve any comments except that I’ll be back :wink:. I will focus on the contest progress.

As experienced by many, the chosen topic was simple to grasp but quite hard to master. Nevertheless, the Bronze league became really overcrowded quite early. This preliminary phase should not last longer than two days. Then came Silver league opening and a massive automatic rerun which rendered the site unusable for many hours. IMHO, automatic reruns during contests should be disabled. Players are mature enough to decide if they need it. The same freeze happened also on a minor scale when Gold league opened.

Then came the final rush to Legend. The 3 days period compared to the usual 2 was a good move that benefited to many until the very last minute but the servers overload became blatant. With submits lasting more than 3 hours in Gold league, it was quite difficult to assess improvements. Because the boss is not deterministic, it was also useless as a benchmark tool.

To summarize:

  • please add more servers during contests
  • disable automatic reruns
  • open Silver league earlier
  • extend Legend league duration
  • choose deterministic bosses

FYI, we’ve decided to remove this seed reversal possibility for the release of the game.


It’s so cool !
Congratulations !


For Japanese-speaking people, this could potentially help: https://bowwowforeach.hatenablog.com/
(I don’t actually know Japanese and I haven’t tried google translate on the post yet, but I’ve seen the link around, and maybe it’ll help others.)


I’ve read the post by translating the page in the browser, the translation was not too bad. I think it was really interesting to see the workflow and tools used :smiley:

1 Like

Hi @bowwowforeach, How did you learn chokudai algorithm ???

If you just want a quick code, see https://twitter.com/chokudai/status/713979313377255425?t=yEK1QJfGY7lPuilV1thPgQ&s=19

Chokudai seems quite famous on codingame, but not a lot documented in English


Chokudai search is an algorithm similar to beam search.
While beam search is a width-first search, chokudai search is a depth-first search.

I am not sure if anyone has explained it in English.
The link provided by @_BZH_TidyMaze is helpful.

@_BZH_TidyMaze Thank you.