# Coders Strike Back - Puzzle Discussion

Why am i unable to use arrays in c++?

TYPO: In the description, one of the bullet points saysâŠ

• The thrust value of a pod is itâs acceleration and must be between 0 and 100.

It should say its acceleration (without the apostrophe).

2 Likes

Someone can explain me how the nextCheckpointAngle is calculated?

Look up a trig function called ATan2. Depending on your language of choice, it might be a built-in function.

Is nextCheckpointAngle the arctangent between my pod direction and checkpoint direction?

Hello,

Jâadore ce challenge il nâest pas trop compliquĂ© mais je nâai toujours pas trouvĂ© quelle est la formule pour prevoir la position du pod aprĂšs un coup.
Si jâai en entrĂ©e la position du pod X,Y, un angle A et une vitesse V et que ma sortie est : TX,TY Thrust quelle est ma position finale?

Quelquâun connait la formule svp?

Can you tell me how can I train my neural network? I donât know how to train it because i donât have a game on my computer?

No hint? What does the thrust mean?and the NextCheckpointangle?

1 Like

Hi SE. I notice youâre programming in C++. Do all languages get access to the same libraries? (at the higher levels). Or do some languages (eg Python, C++, Java) get better libraries?

How can I use boost?
I did as I was toldâ
thrust = BOOST;

Output the word BOOST where you would ordinarily output the numeric thrust value.

Pod angle input is incorrect the first turns.
I always get `-1`:
`3427 6718 0 0 -1 1`

Obviously, my pod thinks itâs turned the wrong way, and doesnât accelerate until I start getting correct data at turn 4.

You can turn as far as you want on the first turn, so the initial input angle doesnât matter.

Still, the value is incorrect.
My bot doesnât know what turn it is, and trusts the input to be correct every turn. Of course I could work around this but it doesnât seem rightâŠ

There isnât a value that would be correct - the pod doesnât actually have an angle at that point. The angles are always 0-359 on later turns, so you probably should handle -1 as a special case.

I see, it makes sense that initial angle is decided after my first output.

What confused me was the input showed -1 while the graphical representation showed a rotated pod.
I realize now that my output is handled before the graphics are drawn. Thanks!

It worked! thank you!!

I think the solution for that you need to optimize your program and, try to inspect things as well.

Debug mode currently does not show the shield effect. It be nice if this can be patched in as I am doing all my programming/testing with debug mode enabled.

Would it also be possible to change the colors? I got issues with read an can not see the red line of the enemy in debug mode.

Love the game, really a lot of fun!

Can someone tell me what the difference between the circle outline is in debug mode, and my graphical race pod?
The position I get through the input stream the one of the outline, but the game visualizes and shows another position, possible future position.
Which one is used to do collision on?

1 Like

Hi, Iâm stuck on the use of BOOST, it puts me " invalid input. Expected âx y powerâ but found â5497 7525 1431652838 9710â ".
I donât know how to do it if you could help me.

``````> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> #include <stdbool.h>

> /**
>  * Auto-generated code below aims at helping you parse
>  * the standard input according to the problem statement.
>  **/
> int main()
> {
>     // game loop
>
>     while (1) {
>
>         int x;
>         int y;
>         int nextCheckpointX; // x position of the next check point
>         int nextCheckpointY; // y position of the next check point
>         int nextCheckpointDist; // distance to the next checkpoint
>         int nextCheckpointAngle; // angle between your pod orientation and the direction of the next checkpoint
>         scanf("%d%d%d%d%d%d", &x, &y, &nextCheckpointX, &nextCheckpointY, &nextCheckpointDist, &nextCheckpointAngle);
>         int opponentX;
>         int opponentY;
>         scanf("%d%d", &opponentX, &opponentY);
>         int vit;
>         bool boost = true ;
>         // Write an action using printf(). DON'T FORGET THE TRAILING \n
>         // To debug: fprintf(stderr, "Debug messages...\n");
>
>         if((boost == true) && (nextCheckpointAngle == 0) && (nextCheckpointDist > 6000 ))
>         {
>          vit = "BOOST";
>          boost = false;
>         }
>         else if(nextCheckpointAngle>90 || nextCheckpointAngle<-90)
>         {
>             vit=0;
>         }
>         else
>         {
>             vit=100;
>         }
>
>         // You have to output the target position
>         // followed by the power (0 <= thrust <= 100)
>         // i.e.: "x y thrust"
>         printf("%d %d %d %d\n", nextCheckpointX, nextCheckpointY,vit,nextCheckpointDist);
>     }

>     return 0;
> }``````