Code VS Zombies - Optimization - Puzzle discussion

:skull: Feel free to send your feedback or ask some help here! :skull:



A feedback about Code Vs Zombies : memoization can be useful in order to avoid Ash always switching between 2 humans to protect.

A very interesting challenge enabling to test a lot of concepts.


I made my program using Javascript (not the best, but the one i know the best). I was able to reproduce the game engine to simulate strategies of Ash.
Unfortunatly, i have timeout when i simulate more than 150 strategies.
Any advice to optimize a javascript version ?

Thanks !

Hi, how do I know which human coordinates correspond to which human ID?

1 Like

It’s in the problem statement. One line corresponds to one human:

Next humanCount lines : three space-separated integers humanId, humanX & humanY, the unique id and coordinates of a human.

1 Like

> Zombies work as follows:
> Each turn, every zombie will target the closest human, including Ash, and step 400 units towards them

What is the behavior if there are different humans at the same distance from a zombie? Is there a priority based on the humanId?


I don’t know if this is considered a spoiler, but does anyone know which levels are possible to solve without sacrificing any humans?

Press settings button in video player. Switch on the Debug mode,
human ids will be highlighted on them…

Hi, realise I’m a bit late for the party, but hopefully someone can help me out.

Has anyone among the top 50 successfully used a genetic algorithm and how did they maximise their score?

I’ve spent quite some time coming up with a half-decent genetic algorithm myself and it’s doing ok - I average about 190k points on submission. But even after tweaking it heavily (change mutation rate, retain top species, etc.), I can’t seem to get an optimal score as often as I’d like. Also, my result depends heavily on luck because of the random way the population is generated.

So, any advice is much appreciated!

1 Like

Hi, can you help me a bit please, I would like to do my own genetic algorithm but i don’t know what is the behavior if there are different humans at the same distance from a zombie? Is there a priority based on the humanId?
thx for u’re help

1 Like

Yes lower ID first


How do you even train your models? At each run all your variables are reset and it’s not possible to access file from the pc, do you use a cloud service and load files from it?

1 Like

Hi Testadicardi,

I use a genetic algorithm, which you don’t really train, rather evolve the solution to an optimum. I do that at the first turn when you have long response time and save the result in memory. The game has no random elements, so whatever optimal solution I find at the start has the same result say 20 turns later. On each turn all I do is read the current instruction from the optimal solution I’ve found at the start.

Hope that helps


Hi, thank you for answering! My question was a little more practical, how do you store the result in memory? From the web interface there seem to be no way to i/o from local memory and (at least in Python) the environment variables are deleted after each run. On the machine, you don’t have the inputs (only available to my knowledge from the web interface). Am I missing something crucial?

You just to move these variables outside the while loop.

1 Like

I think he meant between two different levels. Each time you run your code, variables are deleted.

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

we probably have a bug here. We’re on it

Where can we find the source code of the game to develop Genetic Algorithms?

Could someone pls tell me if you are able to print the first target coordinates? It seems, that the first target coordinates are given and you cannot change. Is that correct?

Edit: my fault, everything is fine :slight_smile: