Coders Strike Back - Puzzle Discussion


#315

My guess is that you send two outputs per turn. One for each checkpoint. Your program then gets desynchronized from the input.


#317

Hi everybody! I’m in Wood 2 League, language Java, and I have trouble with console output in the game. I don’t understand what are those 2 numbers in the output. I added 2 lines into the default code and debug output:

        int nextCheckpointDist = in.nextInt();
        int nextCheckpointAngle = in.nextInt();             
        System.err.println("Angl: " + nextCheckpointAngle);

In the “Game Information” as output of debug message there are unknown numbers in the 002-nd and 003-rd steps of the game. The 001-st step is ok, there is a correct angle (which is zero). Please explaine what are those numbers (1998 in 002-nd and 7318, 8047 in 003-rd step).
Upd: The numbers slightly veries at each launch of the test.


#318

You removed two lines from the default code leading to a desynchronization of the input and output. All data sent in the input should be read, else, at turn n+1, you read data from turn n.


#319

I didn’t remove any line, here is the whole code:

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

/**

  • This code automatically collects game data in an infinite loop.

  • It uses the standard input to place data into the game variables such as x and y.

  • YOU DO NOT NEED TO MODIFY THE INITIALIZATION OF THE GAME VARIABLES.
    **/
    class Player {

    public static void main(String args[]) {
    Scanner in = new Scanner(System.in);

     // game loop
     while (true) {
         int x = in.nextInt(); // x position of your pod
         int y = in.nextInt(); // y position of your pod
         int nextCheckpointX = in.nextInt(); // x position of the next check point
         int nextCheckpointY = in.nextInt(); // y position of the next check point
         int nextCheckpointDist = in.nextInt();
         int nextCheckpointAngle = in.nextInt();            
         // Write an action using System.out.println()
         // To debug: 
         System.err.println("Angl: " + nextCheckpointAngle);
    
    
         // Edit this line to output the target position
         // and thrust (0 <= thrust <= 100)
         // i.e.: "x y thrust"
         System.out.println(nextCheckpointX + " " + nextCheckpointY + " 99");
    
    
     }
    

    }
    }


#320

Maybe you didn’t do it intentionally but you’re missing the lines that read vx and vy. Try this: copy the part of the code you wrote, reset the code back to default, and paste it back in. Alternately, recreate the missing input lines using the problem description as a guide.


#321

Thank you Community, that works. I didn’t pay attention to the Restore Code button. How did I erase two lines of code (with variables opponentY and opponentX)? Obviously tt’s some kind of mystery because I was very careful and wrote only necessary code.


#322

cannot get the stupid, annoying hints to go away. I would love to be able to play this one, but I can’t concentrate with the tips constantly in the way and repeating the same thing over and over. smh


#323

Hi everyone!
Just started with this.
When I output “BOOST” instead of the usual power integer, I get an error and lose.
Error:

Standard Output Stream:

13493 2017 ‘BOOST’
Game information:
invalid input. Expected ‘x y power’ but found ‘13493 2017 ‘BOOST’’

my JS line is print(nextCheckpointX, nextCheckpointY, “BOOST”)

Can you please point out what I’m doing incorrectly?


#324

Leave off the quotes around the BOOST.


#325

I’m sending three outputs, as is required. Here’s my code,

    int x; // x position of your pod
    int y; // y position of your pod
    int nextCheckpointX; // x position of the next check point
    int nextCheckpointY; // y position of the next check point
    int nextCheckpointAngle;
    cin >> x >> y >> nextCheckpointX >> nextCheckpointY>>nextCheckpointAngle; cin.ignore();
    
    // Write an action using cout. DON'T FORGET THE "<< endl"
    // To debug: cerr << "Debug messages..." << endl;


    // Edit this line to output the target position
    // and thrust (0 <= thrust <= 100)
    // i.e.: "x y thrust"
    //cout << nextCheckpointX << " " << nextCheckpointY << " 100" << endl;
    int thrust=100;
    if(nextCheckpointAngle>90 || nextCheckpointAngle<-90)
        thrust = 0;
    else
        thrust=100;
    
    cout<<nextCheckpointX<<" "<<nextCheckpointY<<" "<<thrust<<endl;

#326

you’re not reading all the inputs (here, the opponent coordinates), hence your output gets desynchronized from the input.
Try resetting the code to the default one and add your logic in it.


#327

any hint on how to beat the SHIELD rule level.
I am coding in java


#328

It’s possible (and actually fairly easy) to reach the Gold league with a bot that ignores shields and collisions. Focus on racing well; go max thrust as often as possible and start turning for the next checkpoint before you hit the current one and you’re most of the way there.


#329

I don’t really understand how do we get to a next league. What are the conditions?


#330

After having 100% battles done, you must be above the boss of the current league to be promoted to the next one.


#331

Does anyone have tips for tighter driving? I am around rank 600 in Gold League right now. Against other players my bots do decent but the boss smokes me every time.

What is the strategy it is using for the very tight nice turns? Should you break/reduce speed or throttle in the opposite direction when close to a checkpoint? How can you “pre-turn” for the next next checkpoint while remaining on path for the next checkpoint?

Any tips regarding this?


#332

I got to Gold league only with heuristics. But it seems like it could be just one and only.
Maximize your speed after current step towards your next checkpoint”, just like that.
I mean, you have to orient a pod in such a way that by thrusting you:

  1. compensate your lateral velocity;
  2. accelerate towards checkpoint

at the same time.
I used a couple of simpler heuristics, like “don’t thrust if you face the opposite direction”, “thrust less if target is around 90 degrees from you” and I boosted from starting position. Plus I did orient myself to “mirror” my speed direction with respect to checkpoint direction.
But I really want to check whether a heuristic with such a simple formulation will work as a complete solution for all leagues up to and including Silver.
Is there a way to test that? Can a contestant send a solution to a league they have already passed? Or can anyone else check it out?