Code VS Zombies - Optimization - Puzzle discussion

It does, but that’s not shown in the points. It will show up in your global ranking where you can see how good your code is compared to other solutions.
Annotation 2020-09-03 100810
What is important for the ranking is what percentage you have. Only when you have 100%, the points are considered.

3 Likes

Could you help me with score calculation please.
On Rectangle map I kill 2 zombies at step 1 when I have 4 humans alive:
I had an idea that I should have 40 * fib(1 + 2) + 40 * fib(2 + 2) = 40 * 3 + 40 * 5 = 320 but I got 480 scores on first step. Please advice what formula should be used. Thanks.

The exact formula is 10 * sqr(remaining humans) * sum(fibonacci[n] for n = 1 … zombies killed). In your case, 10 * (4*4) * (1+2). The fibonacci sequence to consider is {0,1,2,3,5,8, … }

3 Likes

Does anyone know if that 1000 units Ash can move is Euclidean or Manhattan?

There’s only Euclidean distances on CVZ.
Most generally, on CodinGame, Manhattan distances are only used when the game is in a grid form.

1 Like

Awesome, thank you! That would explain a few problems I’ve been having.

I’ve scored 64180, but I’m not getting a ranking. Did I do something wrong?

Only 100% scores are ranked.

no, less than 100% scores are ranked too

@TwoSteps Is there a latency from submission to showing up in the ranking? I was also wondering if my rank wasn’t updating because of the 95% completion that my code now has. I submitted it a few hours ago and my score hasn’t increased from ~40 to ~86k.

Thanks!

Usually the ranking is updated less than 1 minute after submission.

But you are right : a 100% with 10k is better ranked that 95% with 100k.

1 Like

I passed all the tests, but when I submit I fail 2 tests. I doubt the problem is optimization; my code probably have some bugs. But without knowledge of the i/o, I have no idea where to begin. What can I do in a situation like this?

Hi! My genetic algorithm is not good (95% and 66,510 score), but I’m trying to calculate the best some move sequence on each turn.

Hallo,
I think the description of this puzzle is misleading:

there is:


Zombies work as follows:

  • Each turn, every zombie will target the closest human, including Ash , and step 400 units towards them. If the zombie is less than 400 units away, the human is killed and the zombie moves onto their coordinate.
  • Two zombies may occupy the same coordinate.

There should be:


Zombies work as follows:

  • Each turn, every zombie will target the closest human, including Ash , and step 400 units towards them. If the zombie is less than 400 units away, the zombie moves onto their coordinate. If the zombie is in the same coordinate as human the human is killed.
  • Two zombies may occupy the same coordinate.

PS: Thanks to the author for this puzzle - very interesting.

2 Likes

In what situation do the two descriptions lead to different results?

If Ash kill the zombie first I guess…

How do I access the ‘points’ value in the game? I want to use it to evaluate my algorithms using code, rather than manually recording the scores. Newish to coding so grateful for advice!

Hi all,
I am a freshman in algo. I have just learnt the genetic algo and I saw many people made their models based on ga. I would like to ask, how to apply the ga on such a practical problem. The problems I worked on was like “find the local maximum of a function”. Thanks very much!

Hi,
did you manage to build your model?

Hi, first of all you must have simulation for turns ahead, this means given a moving command for Ash to predict how the game state will look like. This includes moving Ash, moving zombies, destroying zombies, destroying humans, … Also you need a good evaluation function, to be able to compare states.

After that you should decide how to represent the GA. I’m using Chromosomes where each gene is a float between 0.0 and 1.0 and each pair of genes represents a moving command for Ash:
int ashXTarget = MAP_WIDTH * chromosome[0];
int ashYTarget = MAP_HEIGHT * chromosome[1];

Then I’m using the techniques, I’ve described here https://www.codingame.com/blog/genetic-algorithm-mars-lander/ to optimize the commands for Ash.

Good luck and have fun :slight_smile:

5 Likes

Hi Di_Masta,
wow! I just read your blog this morning! I was thinking what a nice algorithm and I followed you!
Thanks for the advice on ga. I will try to make some progress! Thanks again!

1 Like