My Codingame summer challenge 2025 solution

This is the explanation (no code is given) for my solution in the Codingame summer challenge 2025.

The logic is relatively simple, I didn’t try that hard and I ended in the legend league around the 100th place, with C++.

Logic

Each turn, I try to generate all possible combinations (= states) of “all moves + all actions”, but because it would be too much to really generate them all, I do a lot of checks to dismiss most of them based on how I would play if I were playing the agents individually as a real human, a simple example would be that throwing a bomb on an opponent that could also damage an ally is dismissed in most case.

I don’t use an heuristic to score the state on all generated states after having generated them, instead of that I use an heuristic to score the action that has been taken by the agent and add it directly to the generated state.

The reason behind this choice is because depending on the situation, if I know that I want the agent to move toward an opponent agent, then I can just generate this move and nothing else, yes it’s not optimal and might miss on better states by doing that.

Then at the end I choose the state that has the best score and output it.

Rules of agents movements

  • Move toward the case that maximize the territory
  • If no case maximize the territory (because the agent if behind another), move toward the closest opponent agent (not using fly distance but walking distance, avoiding obstacle)
  • If the case where I want to go is dangerous because an opponent agent can throw a bomb, avoid that case
  • If the case where I want to go is too close to an ally agent that can receive a bomb, avoid that case
  • if I’m winning and the opponent agent has lower range than mine, try to keep the distance

Rules of agents actions

While there is a check to dismiss movements to lower the number of states, this is not the case for actions, they will all be generated based on all previous movements states, and the score of the states will be increased depending on the action and the outcome.

  • An action (shoot or bomb) add to the score the equivalent of the wetness added to the opponent agent (not counting what is added after reaching 100 wetness)
  • If an action (shoot or bomb) can kill an opponent agent, it’s first priority, +10000 score.
  • The agent will try to shoot event if the opponent agent is at the “max range + 1” in case of the opponent agent walking toward the agent. However it’s not the case for the bomb, an agent will throw a bomb only if it can guarantee to hit.

What could be improved

  • Adding cover handling
  • Bombs only target agent directly, i’m never trying to anticipate or throw it between two agents to maximize the damages (mainly because it’s uncertain)
  • More safety based on opponents’ ranges and distances, because now my agents are really aggressive
  • There is a flaw in the way I generate the states that prevent better moves
  • I didn’t try to optimize anything at all, it could run way faster but it was not needed.

Conclusion

It was a really fun challenge, I really liked the game and the rules; however I didn’t really like the wood leagues, I hard coded the solutions and went directly to the bronze league in an hour or two.

It was really fun.
Thanks to the Codingame team.