My guess is that you send two outputs per turn. One for each checkpoint. Your program then gets desynchronized from the input.
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.
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.
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"); }
}
}
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.
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.
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
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?
Leave off the quotes around the BOOST.
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;
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.
any hint on how to beat the SHIELD rule level.
I am coding in java
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.
I donât really understand how do we get to a next league. What are the conditions?
After having 100% battles done, you must be above the boss of the current league to be promoted to the next one.
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?
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:
- compensate your lateral velocity;
- 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?
I have encountered a problem when checkpoint is not registering as passed.
Please advice, is it my fault or it is a bug?
idk why but it wont let me use the variables of nextCheckpointAngle or nextCheckpointDist, unless that is another two ints i have to scan in?
Hi Saiksy, you can do this by printing âx y thrust messageâ