Code Royale - Bugs

Use this topic to report bugs or remarks about the Code Royale challenge.


The referee code is publicly available on Github


Special thanks to the creators (csj, harshch000 et Netbattler11) and the testers (illedan & Tiramon)


Where is the referee ? :o


Hi. I’m confused by this statement in the Wood League instructions:

The training of creeps represent an extra mandatory command every turn. For barracks not to begin training new units, a player has to use the TRAIN command with no identifier.

Earlier in the instructions, it says you have to explicitly train using the barracks identifiers. Is training automatic thereafter? If not, why is TRAIN with no identifier necessary?

Not a bug but some info is missing.

In wood 3 league you have mentioned KNIGHT, ARCHER and GIANT.

Missing Information:

  • Giant HP, cost and damage
  • Archer Damage and Range
  • Knight Damage

Would be nice to see a tabular format of all the values :slight_smile:

Nevermind, it is there in Bronze League. But here it is in a spread sheet format.

Basic Data

Attack Multiplier Values

Note : 999 = insta kill


To add on this the speed of all the characters would be nice to have. It seems that things move at different speeds but I’m not sure how fast or slow it is. Knowing how many turns it’ll take for me to reach a site or for my pawns to reach the opponent’s queen seems essential…

1 Like

There is a problem with the starting League, Wood 3.
Half of the League can easily beat Dame Boss every single time, but there are too many players, so the players fight each other instead, and nobody rises high enough to even fight Dame Boss unless you have an awesome “Bronze-level” program.
So everybody is stuck in Wood 3 :frowning:

Update, I think it is fixing itself now, just a lot of people started coding at the same time.

That is actually a general issue with the ladder system.

Discovery of a structure is not explained properly.

For example I want to track current mining rate of enemy.

Should I always have to be in 300 range from enemy mines or I just have to discover them once?

Similarly for all hidden data plz also explain when it is hidden and what should we do to reveal them?

I found a bug (or a design mistake, i’m not sure).

At the end of the turn, the referee loops on all obstacles so they can act.

When a barracks acts, the training advances, and if the training is at 0, new creeps are spawned.

When a tower acts, it will look for the nearest opponent creep and shoot at it (and also shoot at the opponent’s queen).

But when a barracks acts, the creeps are spawned directly. It means that if a tower acts after a barracks, it can actually shoot a new creep. But if the tower acts before this barracks, it can’t.

It’s pretty weird to rely on the tower id to know if it can shoot new creeps or not.


Hey everyone, this is my first codingame and I am just generally having a hard time deciphering the variables and commands available to me. I just reviewed the “onboarding” project to see if the documentation for a game is standardized and that does not seem to be the case.

I just cannot figure out this format

Line 1: an integer numSites, indicating the number of building sites on the map.
Next numSites lines: 4 integers siteId x y radius
siteId: The numeric identifier of the site
x y: The numeric coordinates of the site's center
radius: The radius of the site

numSites is a variable that I can call but I don’t understand the 2nd line. Is it also a function? Or is this an example of how to use it in the program?

Separate to documentation, another issue I am having is determining how to move the queen to the nearest building site. Is there some function I am missing that returns all these coordinates so I can determine proximity or do I just take a shot in the dark?


In half of games, I get a : “failed to provide 2 lines of output in time”

After investigate in my code, it stops after the first “for i in range(num_units)” loop.

The second for loop doesn’t appears in that cases. Even if it’s empty (just a print command)

It happens always in the second while loop.

I play in Python3.

Thank you in advance.

copy your code to a local file on your drive

reset the python code and then start from there, you will still have the file and can add the current code back in step by step

i use python as many others do and there’s no problem, so i guess you deleted something or messed something up, but you should recover easily if you follow the above steps

1 Like

In the problem statement, under Tower HP it says :
This corresponds to a variable attack range: longer attack range for a smaller radius site.

According to my the formula larger site area leads to longer attack range as it is directly proportional.

As far as I know, if you want to find the Max Mining Rate you have to discover it only once.

But if you want to see the Current Mining Rate for a given mine you have to be 300 units from it.

It depends on how you look at it. If two sites have the same HP, the larger site will be able to hit creeps that are farther from the site center. But the smaller creep will be able to hit creeps farther from the tower edge. At first, that seems irrelevant, but remember that towers do damage according to how much farther their bullet could have flown to get to max range. This means that if a creep is at the tower base, the smaller site sometimes does more damage (depending on rounding).

I’m having a weird issue where the game passes me the value 800 for the touchedSite variable. An ID which doesn’t exist and isn’t passed as part of the sites.

I’m using just standard code:

fscanf(STDIN, "%d %d",
    $touchedSite // -1 if none
error_log(var_export($touchedSite, true)); // 800

Because now i’m just forced to press “play my code” for a couple times till i get long enough game.
Then i can test my strategy, and if i want to test on the other map i need to repeat the process.

The “replay in same conditions” button doesn’t help?

Separate to documentation, another issue I am having is determining how to move the queen to the nearest building site. Is there some function I am missing that returns all these coordinates so I can determine proximity or do I just take a shot in the dark?

All the positions are given line by line through the standard input.
It’s like reading a file from code.

You’re not given any functions you can call. You can only output commands on the standard output (once you have read the turn’s input).

Here, the x, y positions of all sites are given before the game loop starts. You can save them all to a datastructure.
Then, you are given the unit’s positions on every succesive turn (a turn ends when all players have output a command). This is when you can compare the queen’s position to the structure positions.