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:

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?

#334

I have encountered a problem when checkpoint is not registering as passed.