Coders Strike Back

Can you tell me whether angle value is rounded or truncated after all the math?

The animation sometimes stop working and I need to refresh the browser (I use a webkit-based browser).
There are some errors in the browser console:

TypeError: undefined is not an object (evaluating '$("#navigation").position().left') 4fbf7562.codingame.js:46
TypeError: null is not an object (evaluating 't.worldTransform.applyInverse') undefined:8
TypeError: undefined is not an object (evaluating 'frames[frameNumber].currentKeyFrame') undefined:1765
TypeError: undefined is not an object (evaluating 'frame.collisions') undefined:1909
TypeError: null is not an object (evaluating 't.worldTransform.applyInverse') undefined:8

It would be nice to fix these issues.

Thanks for the bug report @bouanto. Do you have a process that could help us to reproduce the problem? Is it with a particular code or against any particular opponent ?

I play against the default AI in the IDE.
I paste code in the editor and click on “Lancer mon code”.
After a couple of times, the animation stop working.

I’ll try to notice when I see these errors.

Tanks! We are going to start from these steps

I think I found what causes this issue.
I clicked on “Lancer mon code” as usual and the following error was shown:

main is not a function

So, perhaps when there is an error (from the compiler), the challenge stop working.

By the way, it happened using the Rust programming language and the code compiles. Clicking on play again shows the output (but not the animations).
I’ve often seen this error (main is not a function) when doing previous challenges.

So here are the steps to reproduce this issue:

  • Choose the C++ language.
  • Remove all the code in the editor (to cause an error).
  • Click on play.
  • Put the code back in the editor.
  • Click on play.

You will see that the animations are not working and the errors in the browser console (I was able to reproduce this issue in Firefox and a webkit-based browser).

Thanks to fix it.

The rule is not correct in all the situations :smiley:
Not a big deal tho

What’s the problem with this replay?

I think that it breaks the 100 turn no checkpoint rule
{I might be wrong though}
pls dont get angry on me
I am sorry if I am wrong :slightly_smiling:

No it’s not breaking the rule, as at least one pod is passing through checkpoints.

I have a question about the power, how is it related to the change of speed ?
I mean if I have a speed of 1,and a power of 100,how do I estimated my next turn speed ?

1 Like

Suppose the pod is at 1000,1000 (x, y), the speed is 1,0 (vx, vy) and you want to go to 2000,1000 with thrust 100.

At end of the turn you have:

Pod at 1101,1000 ( 1000 + 1 + 100) (only horizontal move, because angle is 0)
Speed = 85,0 ( 1+100 = 101 -> 101 * 0,85 = 85 (trunc) )

0,85 is the “drag coefficient” after each turn.


Hi, how can I get back my code submitted to SF2442?

From a mathematical point of view, the angle should have been computed counter clockwise.

1 Like

[quote=“nautilus_me, post:23, topic:1317, full:true”]
From a mathematical point of view, the angle should have been computed counter clockwise. [/quote]
Not if you want “y” to be +90° from “x”

Do you also have the formula to get next angle please ?

You have 2 angles:

  1. The angle the pod is “pointing”:
    Final_Angle = Something between Initial_Angle-18 and InitialAngle+18, according to the new point you set.

  2. The angle the pod is “going”:
    You can obtain this angle from vx and vy:
    Angle_in_Radian = atan2( vy, vx );

You can calculate v:
v = sqrt ( vxvx + vyvy )

You can decompose the v in vx and vy:
vx = v * cos (angle)
vy = v * sin (angle)

The speed is as I explained before: Final_vx = (Initial_vx + Thrust_vx) * 0,85
The same for vy


I really like doing the puzzles and taking part in the competitions on the site, but I dislike the idea of the need of reverse engineering in this one. It’s basically the same as we’ve had 2 and a half years ago with Supercell’s racing competition. You need a bigger initial time investment in figuring out how the physics work before being able to do any logic, and this is a huge downside. Just my two cents.


Great, thank you. That might be a good idea to add it to the game description.

1 Like

Hi there! Anyone knows how do collisions work?

What is the meaning of vx and vy ?? I mean if it is supposed to be the speed on x and y axis, then why it is often negative?