Welcome to MiniAiCup # 2. This time we ruined AgarIO

For six consecutive years, we (Mail.Ru Group) together with SSU have been holding the Russian Ai Cup (competition for writing game bots). We come up with the game world, write an API to it and push the foreheads against the strategies written by the participants. It turns out every time it’s quite interesting, original and in general it is the largest annual AI contest in the CIS!
With the same sauce, in the fall of 2017, we wrote, launched and held the first contest on yet another venue, MiniAiCups , to make a mini clone of the Russian Ai Cup with its strange atmosphere, rules and mechanics. Many people liked it, and, after the distribution of prizes, we, under the guise of a prize, promised another contest. And finally, we are happy to invite everyone to participate in it.

Site Mechanics

There is a game world that lives by certain laws. An API (just a text protocol) sticks out of this world. In accordance with this API, a player’s strategy written in their favorite language reads (just from STDIN) the changes in the state of the world in a loop and sends (just to STDOUT) their actions. Thus, the game itself takes place. Technical details - at the end of the post.


All championship games will be held in 4x1 format (4 players in the game, each for himself). The game can be rated (affects the placement of players in the rating table) and unrated (just a “duel”, take a closer look at an opponent, test the strategy, a kind of sandbox).

March 28 - we open the contest, non-rated games of 7500 ticks begin (tick is one indivisible unit of time in the game world)
April 2 - the start of rating games of 7500 ticks (the system will start several games every few minutes, selecting participants according to the trueskill system and scoring points according to the results)
April 19 - TOP participants from the sandbox go to the finals, we stop rating games and give the opportunity to create unrated games for 25,000 ticks
on April 23 - completely stop the sandbox and spend the final. This will be a lot of games with 40,000 ticks, we will select them so that within the 4x1 games everyone plays with each. Then we give prizes (about them below), according to tradition, all the participants in the finals receive T-shirts as a keepsake.
On April 26th we will turn on the
sandbox with unrated games and this will be the second task (along with the autumn task) that will remain forever.

This is how it will be. We tried to make sure that there were as many days off as possible between important events of the contest. Everything is for you.

Task in brief

And everything is simple. We took agar.io , admired and decided to do a contest on the mechanics of this wonderful game. Made. Then it began to seem to us that it was too simple. Added inertia when moving, a bit of physics ... Still rustic. Okay, we thought and decided to put on our own set of coefficients of inertia, acceleration, mass growth and all that makes up the physics of this strange world. On this we stopped.
Thus, the player’s task is to first deal with the current physical laws (either everything on the playing field flies with a bullet, instantly stopping and turning around, or crawls on inertia, trying to go somewhere into orbit). Well, only then comes such a sweet heart "eat them all." More detailed rules - below, after the prizes (yes, there are prizes).


For the first place we give a new MacBook Air (or the equivalent in cost, the participant will have the opportunity to express their own wishes).
Second and third place - Apple iPad.
Fourth to sixth place - Samsung Gear S3. But to be honest, we ourselves don’t know what to give, sketch out the options in the comments. We are a community.
By tradition, everyone who qualified for the finals will receive T-shirts with our symbols.

Rules in a bit more detail

Here I will try to informally describe the rules in such a way as to convey the essence of the mechanics of the championship. So:

Game world

Let's start with the shock content - the playing field is rectangular! No one has ever done so, and here again :)
The coordinate count starts from the upper left corner. Each object on the field has two coordinates, mass and velocity vector. Each object is a circle.


Before starting, the player’s strategy subtracts a series of physical coefficients from the game world, according to which the game world will live. This is a measure of inertia, a measure of mass growth, maximum speeds, and so on. For each game, we generate random values ​​(within certain limits).

Player Object, Movement

At the beginning of the game in the world four players randomly (but symmetrically from the central axes) are located, each represented by their own chosen strategy. Everyone’s weight is still small, the speed is zero. It’s time to move, eat oneself up and grow, this is the essence of victory. We indicate the motion vector (in fact, two coordinates) and begin to gain speed in accordance with the inertia coefficient, mass, etc., defined in this game (all this will be described in detail in the full rules at the start of the championship). In short, the larger the mass of the object, the less responsive it is to attempts to give it an impulse, in addition, the maximum speed that it can develop is limited.


There are two ways to increase your own mass (and this must be done, since the player loses this mass over time):

Firstly, a certain amount of "food" is scattered across the playing field - these are small stationary objects with a certain mass. When such an object is blocked, the player adds a mass of such an object to himself, and the object is destroyed. From time to time, food is added to the playing field (in a random place, but the same for four sides of the field).

Secondly, you can eat each other. If two players completely overlap, then the one that is larger adds to the mass of the one that is smaller. Eaten is taken out of the field. For the rest of the game.

Death stars

In fact, it is a virus in the terminology agar.io. A number of "death stars" are randomly located on the map. If a player already exceeding the mass of the death star collides with it, then the death star is destroyed. The player scatters the explosion into several smaller parts (their number, mass and momentum depend on many parameters). After that, the player already controls all of these objects in droves (giving them the momentum vector at the same point). In this form, the player is easier to eat, but the speed and response of smaller objects is higher. When in contact with each other, parts of the whole merge, so that it is possible to get back together into something big.

Division, mass ejection

In addition to movement, the player’s strategy, two more actions are available:
Division . Each of the parts controlled by the player is divided into exactly 2 parts.
Mass ejection . Each of the parts controlled by the player throws out a small amount of its own uncontrollable mass, the direction of which is calculated according to the player’s velocity vector. It turns out a sort of "shot food." If such a contraption falls into the star of death, then it becomes its (star) part. The "overfed" death star throws its part in the direction opposite to the last shot. Thus, you can split into pieces a foreign strategy that is too obese.

Fog of war

Yes, he is. We do not see everything. It is considered an ellipse, taking into account the direction of movement, depends on many parameters (group size, mass of parts in the group, speed). All in all, the fog of war turned out uh ... funny.

Winner Selection

Throughout the game, players somehow gain game points (accrued for game events). For these points, a victory is awarded at the end of the game.
If three of the four strategies die, then the game can stop ahead of schedule at the moment when the remaining one gets out to top1 on points.

Technical details

We are currently working with Go 1.10, Java 1.8, C # Mono 4.3, NodeJS 6, C ++ 11, Python 2.7 / 3.5, php7. In addition, we tried to simplify the addition of new languages ​​as much as possible - we only need a dockerfile according to a certain template if you want your favorite XXX language to appear in the list of supported ones.
The maximum amount of source code for one strategy is 20 megabytes in archived form at the moment.
If you want any libraries that you need to appear in the list of supported languages ​​(you never know, someone decides to focus on ML) - write in kamenty, put everything in time before March 25 (however, during the championship we will if possible, continue to fill docker-images for PL).
Full rules at the start of the championship will open in this repository.

Changes from the last championship

Of course, we do not sit still. Since last championship:

  1. The correct one was developed localrunner (written in C).
  2. The simulation is also in C, the calculation has become faster compared to the python, which was in the first competition
  3. Debug widgets have been added for debugging games on the site (the competition will start - see)
  4. The solution launch scheme has been redesigned, now a separate solution simply communicates with STDIN and STDOUT, without having to keep a local tcp server. We do it for you.
  5. All sorts of little things were added, like ratings by ratings and comments of individual games, correct sharing of games and ratings on the social network ... buttons, links, in short, this whole web
  6. It has become much easier to add new languages, both for participants and for us.

The design, meanwhile, is the same. We decided to completely pretend that we see so ... :)


You can register now on aicups.ru , the official group of the championship @aicups , the official channel for those who don’t want to join the group is @mrgchamps . We are waiting for you, it will be fun!