Mad Pod Racing - Puzzle Discussion

Maybe you can try using a bare-bones code to find out the time? For example, I’ve just tried the following code, experimented with different durations, and found that 71 ms (after reading all inputs instead of just the first line of input) won’t give me a timeout:

(Note: The code is a bit different from that applicable to your league because the set of inputs is different in Gold League, but the idea should be the same.)

import math._
import scala.util._
import scala.io.StdIn._
object Player extends App {
    val laps = readLine.toInt
    val checkpointCount = readLine.toInt
    for(i <- 0 until checkpointCount) {
        val Array(checkpointX, checkpointY) = (readLine split " ").filter(_ != "").map (_.toInt)
    }
    while(true) {
        for(i <- 0 until 2) {
            val Array(x, y, vx, vy, angle, nextCheckPointId) = (readLine split " ").filter(_ != "").map (_.toInt)
        }
        for(i <- 0 until 2) {
            val Array(x2, y2, vx2, vy2, angle2, nextCheckPointId2) = (readLine split " ").filter(_ != "").map (_.toInt)
        }
        Thread.sleep(71)
        println("8000 4500 100")
        println("8000 4500 100")
    }
}

Yes exactly, and sometimes it has to be even much lower than 71ms. (I’ve never had to go below 60ms yet…)

Can you see other people’s code?

Not on this website.

you can print it to the console before you submit your answer

Is there any way to reset your rating? I copied someone else’s code out of interest and sent it to the arena, and found that I could not remove the code from the competition (of course I could send an empty solution to the arena, thereby removing someone else’s code, but I only thought about it now) now I am in the golden league without having conquered the silver one on my own, it makes me very sad :crying_cat_face::crying_cat_face::crying_cat_face:

I’m not aware of any way, but you may state your case in the #bug-report channel on Discord to get CG staff’s attention and see if they can help you.

1 Like

i cant quite seem to get my turns right and drift way too far out when i pass a checkpoint, anyone got any tips?

import sys
import math

Auto-generated code below aims at helping you parse

the standard input according to the problem statement.

game loop

while True:
# next_checkpoint_x: x position of the next check point
# next_checkpoint_y: y position of the next check point
# next_checkpoint_dist: distance to the next checkpoint
# next_checkpoint_angle: angle between your pod orientation and the direction of the next checkpoint
x, y, next_checkpoint_x, next_checkpoint_y, next_checkpoint_dist, next_checkpoint_angle = [int(i) for i in input().split()]
opponent_x, opponent_y = [int(i) for i in input().split()]
thrust = “0”
# Write an action using print
# To debug: print(“Debug messages…”, file=sys.stderr, flush=True)

# You have to output the target position
# followed by the power (0 <= thrust <= 100)
# i.e.: "x y thrust"
if next_checkpoint_angle >= 90:
    thrust = "1"
    next_checkpoint_angle -= 90
elif next_checkpoint_angle <= 5:
    thrust = "100"
else:
    thrust = "100"

if next_checkpoint_angle <= -90:
    thrust = "1"
    next_checkpoint_angle += 90
    thrust = "100"
else:
    thrust = "100"
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " " + thrust)

Have you tried other thrust values?

yes, my issue is the thrust goes back to 100 right after passing the checkpoint…
edit: my turn radius is way to big after passing checkpoints, changing the base speed to 90 makes it better but the boss still does better and passes me around the last checkpoint on lap 1

You may have to refine the angles and where your pod goes too to have better control of your pod. Observe and learn from other bots.

i got it working! now im 1st on the leaderboard, and ca 0,2 behind the boss in score

1 Like

Hello guys,

I’m fresh new user of Coding Game, and a beginner in C language.

After few level of playing Mad Pod Racing, i start to modify my code to make a little bit efficient. And, first, i tried to use cos() function provided by math.h lib, and i get a time out, i didn’t found where the problem came. My first idea was that the program will not compile with the -lm flag. So i change my code.

Then, i just replaced my function using cos() with another one without extra libs provided by the game.
But i get the same time out, and executing directly by myself i got the right output.

Does someones got an idea or ressources so i can fix it by myself?
Below you can find my code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define ABS(x) (((x) < 0) ? -(x) : (x))
typedef struct race1{
    int x;
    int y;
    int next_checkpoint_x;
    int next_checkpoint_y;
    int next_checkpoint_dist;
    int next_checkpoint_angle;
    int opponent_x;
    int opponent_y;
}   t_position;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/

int generate_speed(t_position p)
{
    double angle;
    double coef;
    int speed;

    angle = (double)ABS(p.next_checkpoint_angle);
    coef = 1.0 - (angle/90.0);
    speed = (int)(100.0 * (coef));
    if (speed <= 0)
        return (0);
    if (speed >= 100)
        return (100);
    return (speed);
}

int main()
{
    t_position *p;

    while (1) {
        scanf("%d%d%d%d%d%d", &p->x, &p->y, &p->next_checkpoint_x, &p->next_checkpoint_y, &p->next_checkpoint_dist, &p->next_checkpoint_angle);
        scanf("%d%d", &p->opponent_x, &p->opponent_y);
        
        // Write an action using printf(). DON'T FORGET THE TRAILING \n
        // To debug: fprintf(stderr, "Debug messages...\n");
        int speed;
        speed = generate_speed(*p);
        // You have to output the target position
        // followed by the power (0 <= thrust <= 100)
        // i.e.: "x y thrust"
        printf("%d %d %d\n", p->next_checkpoint_x, p->next_checkpoint_y, speed);
    }

    return 0;
}

There you can find the terminal output ingame:

Informations :
Timeout: the program did not provide 1 input lines in due time... KanticField will no longer be active in this game.
Sortie standard :
4524 6021 100
Informations :
Pod 1 of player Boss 3 moves towards (4524, 6021) at power 100

Thank you guys for reading me.

You never initialise p, so it’s a pointer to an undefined memory address.

I can’t seem to get a race to run… Is the site broken for everyone right now? Or is it just me?

Some players also reported an issue in Discord’s bug report channel.

Can someone please help me or give me some pointers as to how I can get into the Wood 1 league… I am currently in Wood 2 and I cannot beat this stupid bot no matter how hard I try… I am new to Python 3 (which is the language I am using) and I only have expirience in HTML/CSS which do not help at all here becuase they’re different.
I’m just looking for pointers or helpful hints so I can get past this stupid bot. I would include my code but it’s literally the default because I don’t know what to add to it, absolutely no clue whatsoever…
Thanks!

1 Like

You probably just need to convert the pseudo-code in the puzzle statement into Python and include that in your bot code to get into Wood 1.

im stuck on wood 2 using python and have absolutly no clue what im doing since the hint is in psuedo i dont know how to write it in python does anyone know where i can learn to do that?

Can anyone help me with the wood level 2, using C programming? even when thrust is at 100 i always come in second. when I’m watching the game play back, i sometimes go in front, sometimes I’m second, and then I end second. Every time. i don’t really know what to edit.