Coders Strike Back - Puzzle Discussion

how to do you make it turn from the middle of the map. can you please give me an example code?

to turn the pod towards the middle of the map you just choose the middle of the map as the target so: print(“8000 4500 thrust”). I do this like 2500 from the next checkpoint away if the angle towards the current checkpoint is low.

I have a pretty nice optimal path for my pod (using bezier curves), but with collisions, it’s pretty random if i win or not.

A tip how to use the enemy position to counter that?

Hope someone can help with this. Inputs are refreshing late. When my bot arrived to a checkpoint it did not receive the new values for the next checkpoint. The new values arrive like 1000 units distance later. That results in my bot late modified the value thrust to 0 and turns late.

Make sure the turn you’re looking at in the output is the same turn you’re looking at on the replay. Check your position versus the position on the graphical screen to verify.

Thanks for your reply. My position is the same with the graphical screen position no problem with that. What I have noticed is when Boss3 arrived to a checkpoint his angle line in red immediately change to the next Checkpoint thats not happen to my bot. Here my code:

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

    Sub Main ()
        Dim count as Integer = 0
        Dim inputs as String()
        ' game loop
        While True

            Dim x as Integer
            Dim y as Integer
            Dim thrust as Integer
            Dim nextCheckpointX as Integer ' x position of the next check point
            Dim nextCheckpointY as Integer ' y position of the next check point
            Dim nextCheckpointDist as Integer ' distance to the next checkpoint
            Dim nextCheckpointAngle as Integer ' angle between your pod orientation and the direction of the next 
            inputs = Console.ReadLine().Split(" ")
            x = inputs(0)
            y = inputs(1)
            nextCheckpointX = inputs(2)
            nextCheckpointY = inputs(3)
            nextCheckpointDist = inputs(4)
            nextCheckpointAngle = inputs(5)

            Dim opponentX as Integer
            Dim opponentY as Integer
            inputs = Console.ReadLine().Split(" ")
            opponentX = inputs(0)
            opponentY = inputs(1)
            
            if nextCheckpointAngle > 90 or nextCheckpointAngle < -90 then
                thrust = 0
            else
                thrust = 100
            end if
            if count < 1 and nextCheckpointDist > 5000 and nextCheckpointAngle = 0 then
                Console.WriteLine(nextCheckpointX & " " & nextCheckpointY & " " & "BOOST")
                count = count + 1
            end if
            if nextCheckpointDist < 1500 then
                thrust = 0
            end if
            
            Console.WriteLine(nextCheckpointX & " " & nextCheckpointY & " " & thrust)
            
        End While
    End Sub
End Module

When printing boost you print two lines (the boost one and the normal one) for one set of input, so after that point your input / output are out of sync.

2 Likes

What he said. Also, the red line doesn’t tell you the next checkpoint, it tells you where the bot is currently trying to aim (i.e. your previous output).

1 Like

Replay Settings -> Debug ON gives you some debuging outputs, is that what you are looking for?

1 Like

I am trying to implement a better algorithm for this game than the one I have currently and I try to follow the advices from Magus on his page: http://files.magusgeek.com/csb/csb.html
But what is strange is that Magus seems to be aware of some information I can’t find in the description of the rules. For example:

  • where does this limit of rotation of 18d max is coming from? I can’t see it anywhere in the description.
  • How did he guess the logic about collision? There are no explanation neither in the description.
    So where can I find these information?

Thanks for your help.

NB: --*-

The pod will pivot to face the destination point by a maximum of 18 degrees per turn and will then accelerate in that direction.

That’s from the gold/legend league rules. I reversed these 18° myself while being in silver :unamused:
The physics are poorly described.
The formulas are from reverse engineering or asking the staff, I don’t know. Magus himself writes

The collisions in this contest are perfect elastic collisions with a half-momentum of 120. You didn’t understand? Me neither. Frankly I would’ve never found this code without the help of Neumann and pb4608.

Mean Max is the first contest, where you finally get real code for the physics engine and didn’t have to guess cornercases yourself, until you got the same values.

3 Likes

Ok, thanks for the answer.

I am In Wood league 2 and can’t figure out how to switch between
thrust = 100 and
thrust = 0
( Javascript )
Here’s the code:
if (nextCheckpointAngle) 90; (nextCheckpointAngle) -90;
thrust = 0;
thrust = 100;
Any help would be appreciated!

Is that the actual code or did you mistype?

It’s not valid syntax. I suggest reading a javascript tutorial to educate yourself on how valid javascript code looks like.

When I try to code, screen didn’t load, it stopped loading after few second between 1% and 50% and just didn’t load. I have internet connection 3 Mb/s

I’m agree too…
Or perhaps can we imagine that we validate the passage to an upper leagues? :confused:

I didn’t really understand why my code is running automatically in above leagues… without an action from me…

I am in Bronze and need some help.
I would like to only run a code once and have tried multiple things such as putting the code out of the loop
If I put the code outside of the loop it ignores the code.

Using Javascript and would appreciate any response.

My goal is to boost into an enemy at the very beginning of the game.

// Init
// ---- Read Input ---  
var turn = 0;
// game loop

while (true) {
  // ---- Read Input ---  

 if(turn === 0) {
   // Boost into enemy during the first turn
 } else {
   // Win the race
 }
 turn++;

}

Wat is the solution for the wood 2 league- I’m putting the right thing, but it says its wrong