Mad Pod Racing - Puzzle Discussion

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.

i cant beat boss 2

how to do that

You should be able to beat boss 2 by implementing the pseudo-code in the puzzle statement in your programming language.

Don’t make it too complicated for Bronze.

All you need to do is this article:

And also collect the checkpoints and just before you reach the checkpoint target the new checkpoint. (Ideally with your steering calculation)

(I’m not sure if the second part is necessary). I jumped by a big margin.

No collissions, no simulations. Nothing.

Excited to learn about these things…

Im new here and I dont understand how to get to the higher league. Im 1 rank in wood and Ive beated boss 3 many times already.

You have to wait until all the battles are finished before your rank is stabilised, then you will get promoted if your score is still above that of the boss. And I see that you are in bronze league already.

How can I get to silver league? I’m in bronze league.
Here’s my code:

import sys
import math

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

count = False
# 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()]
    
    # Write an action using print
    # To debug: print("Debug messages...", file=sys.stderr, flush=True)
    if next_checkpoint_angle > 90 or next_checkpoint_angle < -90: thrust = 0
    else: thrust = 100     
    # You have to output the target position
    # followed by the power (0 <= thrust <= 100)
    # i.e.: "x y thrust"
    #print(next_checkpoint_x,next_checkpoint_y,"BOOST")
    #print(next_checkpoint_x,next_checkpoint_y,thrust)
    k = 20
    if (next_checkpoint_dist > 5000) and (next_checkpoint_angle <= 30) and (count == False):
        print(str(next_checkpoint_x-k) + " " + str(next_checkpoint_y-k) + " " + "BOOST")
        count = True
    else:
        print(str(next_checkpoint_x-k) + " " + str(next_checkpoint_y-k) + " " + str(thrust))

Please refer to the earlier discussion, e.g. the most recent posts in this thread. You will get some ideas there.

what should i do

import sys

import math

Moderator note: Please do not paste complete code in the chat. Snippets are fine. If you are having an issue, just tell us what it is (maybe with an error message or a description of what you’re trying to do or the results that you were expecting) and we can try to help you.