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.