Mad Pod Racing - Puzzle Discussion

Where does the third System.out.println belong to?

if (nextCheckpointAngle > 90 || nextCheckpointAngle < -90){
                System.out.println(nextCheckpointX + " " + nextCheckpointY + "0");
            }
            else {
                System.out.println(nextCheckpointX + " " + nextCheckpointY + "100");
            }

I have removed it. now the video doesn’t even start it gives the result right away.

You have missed the spaces before “0” and “100”. You should include add a space there, similar to how you include a space between nextCheckpointX and nextCheckpointY.

Hello,
I reached silver league . without using AI, but “ordinary” code compensating drift and so , and I have 2 questions ?
Now I see than the angle parameter has changed , and I must be dumb or too tired because , I don’t see how to use it ??
Second , do i need to code an AI to pass to gold league (in other words , did I missed the purpose of this challenge )?

  1. Angle: You may read Magus’s explanation on how to use the angle parameter here: http://files.magusgeek.com/csb/csb_en.html

  2. You may still use “ordinary” code to reach Gold league.

1 Like

A post was merged into an existing topic: New to codingame

Screenshot 2022-05-09 9.31.59 AM

i need help it wont let me import it how do i fix this issue?

There is no such library available on Codingame, but you can use numpy instead.

ok thank you

if (nextCheckpointAngle > 90) or (nextCheckpointAngle < -90) ;{
thrust = 0;
} else; {
thrust = 100;
}

whenever you put ; it breaks the code flow. meaning what the compiler sees when it looks at above is just this:
if (nextCheckpointAngle > 90) or (nextCheckpointAngle < -90) ;

else;

remove the ; at the end of the expressions and the “if else” will work.

How can I get the relative angle between pod and checkpoint instead of absolute angle ? (Like in silver league)
I tried some things with acos, convert radiant/degree or even add/substract 180 nothing work…
Is there a formula with the absolute angle, the position (x, y) of the pod and the position (x2, y2) of the next checkpoint ?

I thought the angle given is relative angle. But if it’s not, you can use atan2(cp.y - pod.y, cp.x - pod.x)

Using a variable to keep the two interval x&y position. You will get a inaccurate speed.

Hello all! Currently in Wood I and able to use BOOST in my code, however, it uses it right at the beginning when the race starts. Some races it’s fine because I still win, but others on different map layouts it causes my pod to go at too wide of an angle initially and I lose. Is there a way to delay the BOOST or how should I go about improving my code to combat the problem? Thank you!

1 Like

Continuing the discussion from Mad Pod Racing - Puzzle Discussion:

Hi guys I’m kinda new here, can I know how do I defeat boss 3 and boss 4? As I solved boss 3 with the code below but I don’t know how to defeat boss 4 maybe in boss 3 I wrote the wrong code (in the BOOST part) or something. Can kindly guide me on this? I spend so much time (2 days) on the boss 4 but still couldn’t solve it. I wrote my code in Kotlin in case you wonder what language is that.

import java.util.*
import java.io.*
import java.math.*

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
fun main(args : Array<String>) {
    val input = Scanner(System.`in`)
    var thrust = "0"
    // var boost = null

    // game loop
    while (true) {
        val x = input.nextInt()
        val y = input.nextInt()
        val nextCheckpointX = input.nextInt() // x position of the next check point
        val nextCheckpointY = input.nextInt() // y position of the next check point
        val nextCheckpointDist = input.nextInt() // distance to the next checkpoint
        val nextCheckpointAngle = input.nextInt() // angle between your pod orientation and the direction of the next checkpoint
        val opponentX = input.nextInt()
        val opponentY = input.nextInt()

        
        if (nextCheckpointDist > 8000) {
            thrust = "BOOST"
        } else if (nextCheckpointAngle > 90 || nextCheckpointAngle < -90) {
            thrust = "50"
        } else if (nextCheckpointAngle < 90 || nextCheckpointAngle > -90) {
            thrust = "100"
        }

        // Write an action using println()
        // To debug: System.err.println("Debug messages...");

        println("$nextCheckpointX $nextCheckpointY $thrust $nextCheckpointAngle")

        // You have to output the target position
        // followed by the power (0 <= thrust <= 100)
        // i.e.: "x y thrust"
        
    }
}

What if nextCheckpointAngle equals 90 or -90 and nextCheckpointDist is less than or equal to 8000?

In addition please read the discussion above for ideas to improve your bot, e.g. how not to move too far before rotating your pod to a different angle.

how can i beat bot in wood league 1

1 Like

Did you get it how the nextCheckpointAngle works? I was looking for the answer

I just can’t figure out how to make the pod go to the checkpoints…
i use Python btw.

You print three space-separated numbers: the first two being the coordinates of the target destination and the third one being the target thrust. This is explained in the Output section in the puzzle statement.