Mad Pod Racing - Puzzle Discussion

how are people writing to the box next to their pod?

like so?

1 Like

Add a space and your text at the end of any of your AIā€™s output lines.

2 Likes

This was due to a fault in your code. Either you outputted something wrong or you faulted.

Iā€™m making some predictions and I want to know what is the max speed BOOST can get. Any idea?

The game doesnā€™t end in JavaScript. There seem to be a problem with the site script (getTitle of undefined) and the game freezes. Canā€™t click any of the buttons. Please have a look :slight_smile:

Hi, itā€™s fixed now ! just refresh the page to get the fix ! :wink:

Hi guys how do i use the boost with C?

1 Like

Just as in other languages: by printing " BOOST"!

yep thanks, just to check we cant use it with thrust right? so BOOST would replace thrust value?

I noticed, in bronze ligue, ā€œoponentX & Yā€ coordinates. Is that curent position of the oponent, and what could we do with it for example?

1 Like

Hi guys, is there a variable for current thrust/speed? i know that there is inertia and the current thrust of my pod differs from my desired thrust. I am trying to tune my pod better.

1 Like

Hi guys, iā€™m just wondering something. iā€™ve started this some days ago and a friend just joined in.
I was rank 3K in bronze using Go. My friend went to silver with something really different and simple.

I used the same algo, in GO and got ranked 4K Bronze,with 15points. He used JS and went top 1 with 20.03 in score and i just had 19.11 points using the same algo using ruby.

Any guess on why the language makes the output difference? or is it pure RNG?
Thanks!

1 Like

Hi,
I wood be interested to see a PID controller example for this puzzle
For the wood league (with or without the boost feature)

Thank you for sharing.

There shouldnā€™t be any difference depending on the language. Unless youā€™re timing out some of the matches.

Between 19.11 and 20.03, there isnā€™t much difference. You could try to resubmit and check. Did you really implement the same algo?

1 Like

Nothing happen when use BOOST. This code I assume will trigger BOOST effect (got larger fire trail?) at least once.

while (true) {
    //default code here
    print(nextCheckpointX + ' ' + nextCheckpointY + ' '+'BOOST');
}

Since the question state that it I can only use once, so I expect will receive some kind of error, ā€œyou have use more than onceā€

BTW, hereā€™s my full code

When there is no boost available, the BOOST is like using a max thrust.

1 Like

Iā€™ve been trying to understand Magusā€™ simulator these past few days. It tracks the output pretty well but the impulse calculation seems weird. Iā€™m gonna try a neural network so I want to clarify something before I generate millions of training data.

    float product = nx*dvx + ny*dvy;
    // fx and fy are missing a factor of 2?
    float fx = (nx * product) / (nxnysquare * mcoeff);
    float fy = (ny * product) / (nxnysquare * mcoeff);

    apply_impact_vector();

    float impulse = sqrt(fx*fx + fy*fy); // I think this is only a quarter of the true impulse
    if (impulse < 120.0) {
        fx = fx * 120.0 / impulse;
        fy = fy * 120.0 / impulse;
    }

    apply_impact_vector_again();

If the variable impulse is greater than the minimum of 120, this algorithm is the same as applying the impact vector once using the correct(?) impulse. The calculated coordinates after the collision are off by +/-1, Iā€™m not sure if itā€™s a rounding error or the algorithm is incorrect. If itā€™s correct, can someone explain why the minimum is being checked against the quarter of the true impulse?

1 Like

Hereā€™s my PID version. Works until collisions set in, then I havenā€™t tuned it further.

import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
boosted = False
checkpoints = []

accumerr = 0
lasterr = 0
P, I, D = 0.03, 0.00, 0.02
lasttarget = (0,0)

def distance(p1, p2):
    return math.sqrt( (p1[0]-p2[0])**2 + (p1[1]-p2[1])**2 )

# 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 raw_input().split()]
    opponent_x, opponent_y = [int(i) for i in raw_input().split()]

    # Write an action using print
    # To debug: print >> sys.stderr, "Debug messages..."
    
    newpos = (x,y)
    target = (next_checkpoint_x, next_checkpoint_y)
    if target not in checkpoints:
        checkpoints.append(target)
    if target != lasttarget:
        lasttarget = target
        accumerr = 0
        lasterr = 0
    err = distance(newpos, target)
    accumerr += err
    errdiff = err - lasterr
    PID = (P*err + D*errdiff + I*accumerr)
    lasterr = err
    
    print >> sys.stderr, "P: " + str(P*err) + " I: " + str(I*accumerr) + " D: " + str(D*errdiff)
    print >> sys.stderr, "PID: " + str(PID)
    thrust = max(0, min(100, PID))

    if 60 <= abs(next_checkpoint_angle):
        thrust = 10
        print >> sys.stderr, "Angle big: " + str(next_checkpoint_angle)

    # You have to output the target position
    # followed by the power (0 <= thrust <= 100)
    # i.e.: "x y thrust"
    if not boosted and 10 >= abs(next_checkpoint_angle) and next_checkpoint_dist >= 6000:
        strthrust = "BOOST"
        boosted = True
    else:
        strthrust = str(int(thrust))
    
    print >> sys.stderr, "Thrust: " + strthrust
    print >> sys.stderr, "Checkpoints: " + str(checkpoints)
    print str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " " + strthrust
3 Likes

well in Ruby :
pastebin com/DeHS92hP
and in go:
pastebin com/bqgtksh4
(need to modify the links cause of the limitation :confused: )
itā€™s just an If/else ā€¦

My concern is not between Ruby and JS, itā€™s between Go being very low compared to there others

Is there any way to look in to the tutorial part which Iā€™ve already passed. I need the picture from tutorial that shows which angle is + and which is -. I need to know does it starts relatively from checkpoint (or bot) and which one is counted clockwise.

3 Likes