Merci Magus
Will try your advices. You were able to reach a very high rank using javascript so i hope to run all tests at least one time
The contest was a 24 hours contest. And in the code i used, performances was not required. Doing a contest in 24 hours is not the same as trying to do your best at the optimization puzzle
Can a Zombie kill more than one human per turn?
Can Ash kill more than one human per turn?
No. But multiples zombies car try to kill the same human at the same time But thereās no effect. The human is still dead.
You are supposed to protect the humans
How did you decide the length of chromosome? I believe you used sequence of positions that Ash should move as chromosome. But the number of moves Ash should do till the end of game changes from test to test. Can you explain you Ga briefly, please?
I suppose I could have gotten a higher score by implementing a simulation (I suppose this is where the optimization comes in?) and finally figuring out how to do something like a genetic algorithm, but just figuring out the difference in time between each zombie and I reaching each human and selecting the lowest difference above 0 was enough to get 100%. Maybe some day Iāll come back to it and figure out how to get higher than 50,160 points.
Funny, I did the eact same thing (If zombies get there faster than Ash mark human as dead, from alive humans pick closest one) and got 25250 points while trying to reach 40k. I wonder why.
How come the replay does not load? it always shows like 80% or 30% loaded but never shows me
Hi ,
I do not understand how you get the codingame ide to simulate each loop.
Did I missed a codingame functionality ??
It is not a functionality; you have to write your own simulation code.
maybe just a bug, not working for me too
When I run a simulation it always fails on rectangle and cross, because there are too many opportunities to kill Zombies in front of him and Ash forgets about the humans to save.
I wonder how I circumvent this.
EDIT: I made a manual check. I donāt start the simulation if all humans are targeted and Iām more than 3000 units away. Iām now at 6680 points.
Itās likely that you donāt have enough simulation to find your best options. The easiest way would be to hard code some initial moves on this particular test cases. Otherwise you need to find a way to get more sim per turn (depending on the language it could be more or less hard)
Thank you, yes Iām using Javascript. I assume itās not the best language. However Iāve seen people up there with 700k points.
I have now a deterministic solution when all humans are targeted and Iām more than 3k units away.
It fails sometimes, but thatās how I got the record. Iām trying to improve my sim now.
Also note that in case of js solutions that are the top of the leaderboard, it might be the result of offline training and hardcoded solutions against the submission validators. So it might be normal that in js you have a hard time reaching 700k (personally in c++ I only manage 400k but maybe my algo/sim sucks)
Iām now at 93k with a deterministic approach when my distance to closest Human is >3000 and a sim else.
I just do 3 random moves and pick the first move of the best strategy. Iāve read in the post mortem that that @eldidou is killing all Zombies in random order, which I havenāt tried.
But heās saying heās doing 1 million strategies. I performance Checked mine, and itās more like 3k. I could probably get out a bit more with some precalculations, but I think JS is just not the language for that. One day Iāll pick up another language for that.
Whatās the best language for these kind of games here?
A couple of optimization Iāve done already
- Not calculating root when comparing distances
- Pre-calculating fibonacci
- for loops instead of array methods
- various loop improvements
There are a couple more, but the wins seem really nuanced and the result is anyway variance of the submit. Probably Iām not at the JS limit, but not too far either.
Yep likely your issue comes from the fact that js is slow and your sim is not deep enough. Popular languages for high performance on CG could be C++, Rust and C.
For instance in C++ I have an 18-gene (plays 18 moves which is often the number of moves needed to end the game) āGenetic algorithmā (I only apply mutations on a unique chromosome) and on big maps (with a lot of human/zombies) I would simulate about 90k mutations of the chromosome on the first turn (so 18 * 90k Asheās moves in total)
Another thing you can try is to keep the best strategy you computed on the previous turn just in case you rng is not as good on the following one, this way you are guaranteed a minimum score instead of randomly trying something else (but the small depth of 3 moves ahead might be a blocker since you wonāt be able to spot great future combos).
holy shit. Yeah thatās quite a difference. I might try Rust.
btw: Iām not sure if itās a bug or not, but when I try to follow Zombies after simulation 1, Ash starts hiding behind the humans and I get terrible results. I donāt know why.
EDIT : 114k
Kind
Lol.
Now I learnt Rust and completely recoded my solution in Rust, just to realize that CG compiles rust in debug mode and not optimized, which makes it even slower than JSā¦
Nvm. I learned some new stuff definitely
Oups. I thought that at some point rust was in release mode in the arena and debug in ide (I assumed it was the same for optimisation games due to the high rankings of dbdr and mikmak in optimization puzzles, unless they are hard coding).
Also according to post here: Languages update - #98 by _CG_Thibaud itās now compiled with release libs all the time.