Mad Pod Racing - Puzzle Discussion

Hi. I use this code to activate my shield :

if ((x && y) == (opponentX && opponentY)) {
speed = " SHIELD";

But the shield activates on every checkpoint and i don’t understand why. It must activates when the position of those 2 dots is the same. Help please.

if i write:

if(x == opponentX && y == opponentY), the shield remains activated all the time

The 2nd one is better tho. Don’t know why it doesn’t work

I’ve tried that. It did’nt work

I am ranked 1st in Bronze League and do not get promoted… There is a timer “Promotion to Silver League in :
00H 49MN 25SC” which timed out twice (18:30 and 19:30 CET) but nothing ever happend.
Thx for any help

You have to be above the boss in the league after 100% of your test runs are computed and it’s sometimes long to compute all runs.

It’s now almost 12 hours since I reached the top of the bronze league. Still no promotion to the silver league. The “promotion to silver league in:” keeps timing out. Does it really take this long to complete the test runs? I notice my fellow coders that are also above the boss have issues promoting to silver

Same issue here, beat the boss but no joy promoting. It’s Monday now so hopefully someone will have a chance to look at this soon!

We’re working on it right now. Sorry :confused:


Any Tips for getting out of Bronze League :frowning:

I got out of Bronze league today. I didn’t care about collisions at all, but I refined a lot the code to move the pod.

I tried to code it as if i was driving the pod myself. Basically, what I did is the following :

  • If the angle is too big, I start to turn, so my thrust depends on the angle (the bigger the angle, the less thrust i apply)
  • Now if I have a low enough angle, depending on my distance to the checkpoint, I either boost if the distance is big enough, or thrust=100, or if i’m close enough i begin a “slowing down” phase

The slowing down phase does two things for me : 1) I slow down, but at the same time, 2) I start rotating my ship towards the next checkpoint.

As I don’t know yet the second checkpoint, I assume it is at the center of the map (it’s the highest probable). As soon as I know all the checkpoints, I know exactly where to go.

It’s far from being a perfect algorithm… But at least it’s quite good heuristic if I assume I’m alone in the race. Sometimes the pod tends to “turn” around the checkpoint because it went too fast on it, but then I adjust the parameters and it goes alright.

It does not take into account collisions, so when I uploaded my code, 90% of my failures were because of collisions. But that was enough to beat the Boss :wink:

I see people have tried genetic algorithms and stuff like that… I guess I will have to do something like that once I’m in Gold. But for now I prefer keeping it to simple heuristics that I complexify iteratively

while (true) {
    var inputs = readline().split(' ');
    var x = parseInt(inputs[0]);
    var y = parseInt(inputs[1]);
    var nextCheckpointX = parseInt(inputs[2]); 
    var nextCheckpointY = parseInt(inputs[3]); 
    var nextCheckpointDist = parseInt(inputs[1]); 
    var nextCheckpointAngle = parseInt(inputs[0]); 
    var inputs = readline().split(' ');
    var opponentX = parseInt(inputs[0]);
    var opponentY = parseInt(inputs[1]);

    print(nextCheckpointX + ' ' + nextCheckpointY + ' 100');

This is my code do you think you could help me fix it because near the end of every race my pod goes around the corners in a half circle that is too big. Got any suggestions?

Slow down when you’re within a certain distance of the checkpoint. Your bot can’t turn fast enough at high speed to hit the cp so he ends up circling it forever.

I studied some genetic algorithms and I don’t understand why people divide the round in multiple actions. You can output (x,y,thrust) at t = 0.5 and another (x’,y’,thrust’) at t = 1 ?

Hi, can someone help me,
I write: print( next_checkpoint_x , next_checkpoint_y , BOOST)
(with Python) but it does’t work
Thank you

I have just been promoted to bronze 5 and there are now collisions, but I am not sure how I could handle that?

On the page of the puzzle, you have links to external ressources. Like my article :


My advice: don’t even worry about them until later leagues (probably not until Gold). Focus on racing well; when approaching the cp, pick an angle and speed of approach that will put you in a good position to move on to the next cp at full throttle.

1 Like

You need to print strings. Try something like
print( str(next_checkpoint_x) + ' ' + str(next_checkpoint_y) + ' ' + 'BOOST')

you could also use format:
print('{} {} {}'.format(next_checkpoint_x, next_checkpoint_y, 'BOOST'))

To follow up on Peeg’s comment you are doing two things wrong in the print command.

First, you are using BOOST as a variable, when you mean to print the string “BOOST”.

Second, in Python2 (what CodinGame calls Python) you should not use the parentheses (if using commas) else the print command thinks you are printing a tuple. However, if you are using Python3 then you need the parenthesis, because the print command is now a print function.

In Python 2:
print next_checkpoint_x, next_checkpoint_y, "BOOST"

In Python 3:
print(next_checkpoint_x, next_checkpoint_y, "BOOST")

Notice in the above version, the print command/function automatically converts the variables to a string (and it puts a space between the outputs). Peeg’s answers—which manually convert your variables to a string—will also work in both Python 2 and 3 but they might be overkill for this situation.