My humble solution to the CodinGame 2022 Spring Challenge

My humble solution to the CodinGame 2022 Spring Challenge


Participated in the CodinGame 2022 Spring Challenge. It turned out to be a fascinating experience at the intersection of psychology and IT.


What does psychology have to do with any of this? Simply this: in this challenge, you write code to command a trio of «little soldiers» tasked with fending off monsters and outmaneuvering your opponents.

I implemented a weighted decision-making system. Every potential action is assigned a specific weight, calculated not only from the current state of the game world but also from an array of numbers that constitute the unique «personality» of each individual soldier.

Since the numbers differ, so do their personalities. The soldiers make their in-game choices based on these numerical traits. Consequently, at any given moment, I never know exactly what a specific soldier will do. I am only guiding them implicitly, having assigned these numerical «personalities» before the match even began. And there you have psychology in action. :)

Yet, these little guys act with surprising «reason» and «deliberation». You can see for yourself here: https://www.codingame.com/replay/622584657

I didn't secure any prize-winning spots, and for good reason:

  1. I was writing the code rather casually in my spare time, which is currently in short supply;

  2. The CodinGame platform itself offered no built-in way to optimize the soldiers' personalities using a simple neural network or a GA. Frankly, I had no desire to manually brute-force various combinations of 18 (3 soldiers × 6 personality traits) floating-point numbers.

Nevertheless, it was a great deal of fun. I have open-sourced the code and uploaded it to GitHub. Welcome: https://github.com/rexTexTau/CodinGame2022SpringChallengeSolutio


How's going? All good, or just in love with duct tape and WD-40?

👉 Outline the issue – if you want to clear any mess forever


Something completely different:


Yearning for the strange? Try the blog fortune-telling:


Tags: IT ✦ psychology ✦ competition ✦ CodinGame ✦ spring ✦ challenge ✦ 2022 ✦ solution

This publication, including its text, graphics, audio, and video content, is provided for informational and illustrative purposes only and does not constitute professional advice. Any scenarios described in this publication are hypothetical and do not indicate any specific outcome that may be achieved by relying on the conclusions drawn from this publication. Results of any actions (or inactions) may vary depending on both individual circumstances and external factors. The author assumes no responsibility for decisions made based on the content of this publication. Always consult with qualified professionals before making important business or personal decisions.