# Coders Strike Back - Puzzle Discussion

#210

OK, I did finally get to the part of the game where, if I have the Expert interface enabled, it will tell me what the rules of the game are.

Two more questions/issues:

1) in terms of the weight (as changed by SHIELD), does that only have an effect on collisions? or does weight also play a role in the movement "momentum", e.g. if I SHIELD, I will slow down faster? the way I'm reading it, it's collisions only - since the slowdown is listed as a constant friction multiplier, but it's not 100% clear

2) this is probably more for arena game mechanics in general, but a weird thing happened to me: I wrote some code while in the Bronze league, submitted it (several times, actually, because I usually did not wait for all the combat pairs to play out until I wanted to iterate on the code), got confirmation that I was going to be "promoted" to Silver league in an hour or so, and went to sleep. When I woke up, I actually had notifications that I was promoted twice - apparently I beat Silver league with my Bronze league code!
Which is cool, but the downside of that is that I didn't get to practice the shield mechanic before having to deal with 4 ships on the screen.

#211

1) Correct. The shield only affects collisions. It doesn't affect friction.

2) I've had this happen too...

#213

Hi everyone.

I try to simulate the movements of the POD and for that I try to calculate the direction of my POD.

I want to make sure those sentences are true:
- The angle given at the input indicates how much the POD must rotate to face the center of the next checkpoint.
- This angle is the angle between the speed vector and the line passing through the center of the POD and the center of the next checkpoint.

EDIT:
Concretely I would like to know if the direction of the POD corresponds to the inclination of its speed vector.

#214

Agreed. It was a little unclear in the instructions for gold about "your pod", not "both of your pods".
I wonder if you can earn codinpoints for editing instructions.

#215

Hey guys I have a basic question for understanding the turning mechanism.

When the bot reach a checkpoint, and is going to move to the next one, normally it needs to change the direction.
During this turning process, I wonder if there is a default acceleration (not thrust), that change the bot's direction?

Because if thrust is the only acceleration during the whole race, then it is impossible for the bot to turn(Newton's second law of motion). LOL

#216

Consider that your pod uses some kind of thrust vectoring. If you rotate your thruster in a different direction than your velocity, your pod will turn accordingly.

To be honest, since you can change your thruster direction without any actual thrust, the "real" mechanism should probably be a pair of directional thrusters producing a torque to rotate the pod. It would have been a bit complex hovewer. Maybe a potential Mars Lander IV?

#217

Hi, I'm fairly new to codingame, and had what may be a basic question. When printing debug messages during a race, I'm only seeing the most recent message. Is there a way to capture all of the debug output during a race and save it to a file for analysis?

Thanks.

#218

Hi,

I don't understand how the forcefield can trigger with a distance of 1100 units between the opponent and I when the radius of the forcefield is only 400. (I can see in debug mode that the 2 cercles don't even touch each other...) Its seems to depend on the relative speed of the pod. Decision making of activating the SHIELD is quite messy because of that...

#219

Last time it happened to me was when outputting invalid thrust. Note that 0 <= thrust <=100.

#220

I don't understand the synchronization of CSB. I keep lagging behind on data. As a result I'm not properly detecting collisions and have to use 'predict' next turn's velocity (which is often wrong).

To demonstrate this I've slightly modified the DEFAULT C# code (shown at the bottom). Then I play the game in debug mode. I took a screenshot: if you look at the coordinates, they lag behind one turn already at turn 2:

What's wrong???

``````using System;
using System.IO;

class Player
{
static void Main(string[] args)
{
Console.Error.WriteLine(checkpointCount);
for (int i = 0; i < checkpointCount; i++)
{
}
while (true)
{
for (int i = 0; i < 4; i++)
{
}
Console.WriteLine("8000 4500 100");
Console.WriteLine("8000 4500 100");
}
}
}``````

#221

You're seeing the end of turn data. I recommend scrolling in the console rather than directly choosing your frame in the viewer.

#222

Thx thibaud,
I'm realizing my mistake. the next position is not determined my your current velocity, I have to calculate my new velocity and estimate that of the target pod to estimate collision.

#223

Hi, I just arrived in Gold League and was wondering wich kind of algorithm could be worth implementing : Alpha-beta, mcts, genetic ... Or are we just supposed to guess wich strategy will play out good (the delay to answer is quite short to learn)? And also, is there some match data archives we can do some machine learning with ? Thanks !

#224

Evolutionary algorithms are what most people are using in Legend... the higher levels of Gold are probably the same. Some have had success with simulated annealing, Monte Carlo, and even minimax.

#225

The start page for each multiplayer has links to the after contest postmortems - on the forums / blog / external sites (eg https://www.codingame.com/multiplayer/bot-programming/coders-strike-back). For older contests like csb these may be slightly out of date, but they'll always be enough to get legend. For csb the top players are now using minimax.

#226

Thanks a lot, I'll be looking into that !

#227

Did you check the blog articles from the winners of the contest?

#228

How should the bot get better?
In the bronze league where collision gets added, how should the bot get better there?
I even implemented a system that remembers the track and calculates the angle at each checkpoint to know how hard it needs to break for the turn, but my bot doesnât seem to get much better. only about 2000 places and iâm still at the 11000 place.

#229

Tips for bronze:

• Never slow down unless you miss the checkpoint
• Turn towards the next checkpoint before you reach the current one (skid through the checkpoints)
• Ignore collisions; good racing will get you to silver

#230

How are you guys minimaxing? Even reducing the possible moves to say 6/7 and minimaxing in pairs (runner/hunter) I canât imagine how you can compute more than 2 turns, and that wouldnât be enough (unless you use a very complex eval function maybe?)