# Spring Challenge 2020 - Puzzle discussion

Don’t hesitate to check out the topic for the contest of the same name: https://www.codingame.com/forum/t/spring-challenge-2020-feedback-strategy/184113/15

Can anybody please clarify is it any timing restrictions for an answer I in this game. I mean is it right if I don’t send a response for 50 or 100 ms I fail all round?
PS I tested sleep with bot and seems it’s not check response time, because i sleep for 1 sec each turn and still got game simulated to the end.

Yes you are meant to fail if your bot takes longer than 50ms per turn. Except on turn 1 where you are given 1 second after the first read from stdin. I am surprised your sleep bot doesn’t timeout. I will look into that, thanks.

I may be able to shed a little light here:

If you have simply been sleeping between prints within an inifinite loop, you will indeed not timeout as expected because your bot has gone out of sync with the inputs send to it by the game. You are outputting your actions for future turns during the initial second.

If you would like to benchmark the time you have to output, please make sure you read all the game data from stdin to stay in sync with the referee.

2 Likes

I see now, thanks for clear explanation!

Hello, so if the x,y of the pallets put in a loop so how we can know which is nearest to go to?

How to print x, y when they are in loop?

How can level up to wood 1 league? Even though i won the bot alot of times.

@LeBaoHoang8A4 please restrain yourself from multi-posting. You can edit previous posts.

put the pellets in a loop and calculate the distance (Manhattan distance is an ok approximation in the low leagues) to your pacs
You’ll need a BFS to calculate the real distance though

1 Like

Sorry for my postes

May I ask what exactly does “pellets visible to me” mean? How is “whether this pellet is visible to me” decided, exactly?

Fom the statement:
“Your pacs cannot see through walls . On each turn you have vision on all of the pellets and enemy pacs that can be connected by a continuous straight line to any one of your pacs. Super-pellets are so bright that they can be seen from everywhere!”

1 Like

I lose because halfway through the game, my code prints some ridiculous numbers like telling a pac to go to (-947674476, 32764), and caused me to lose the game instantly.

Great puzzle. As @TwoSteps writes, BFS is needed in higher leagues in order to succeed. Out of curiosity, I tried to do without BFS, implementing quite a bunch of optimizations, and I’m actually in the middle of the Silver League (around 500 of 1000). I wonder if someone tried the same and managed to get even to the Golden League? Anyway, time for me to switch to BFS now and see where it brings me…

Do lines of visibility warp across map edges, or do they end at the map edge even if a pac could warp around?

It wraps around. Beware of infinite loops on some maps that have a straight horizontal line without any walls.

1 Like

Does this challenge allow for multiple threads to be used, i.e. can asynchronous programming be used?

Your code is run on a single core, as a single thread.

I see - thanks for responding!

Use struct to have in side x and y; Like

``````struct position
{
int x;
int y;
};
``````

in the main or another class do

``````main()
{
position pos[10];
pos[0].x = x;
pos[0].y = y;
// and so on;
for ( int i = 0; i <, pos.size(); i++)
{
x = pos[i].x;
y = pos[i].y;
}
}
``````

If You ise function, then function should look like this

``````position function()
{
position pos;
// put values to pos and return pos
return pos;
}
``````