Code vs Zombies - Feedback & Strategies


#62

OK, thanks.


#63

It seems,it is finished now.

Games -> Optimization -> Performance -> Code vs Zombies - Points

Uhh, new IDE-Design…


#64

Ok. I’ll be fair and honest here. Prepare to be spoiled hard.

The contest :

At first i was like “this contest is amazing”. I first had a “good and simple code” with a score of 80k. And i was still at this score 4 hours before the end of the contest. My code was just running on the furthest human i can save or the “killer zombie” if it’s faster. Then the contest showed it’s weakness. A bugged code can do far more point than a non-bugged code. A little frustrating …

Then i took a shower. You all know this kind of shower. You are not here to clean yourself. You are here to think. Your mind is hotter than the water.

How i manage to end up at the 6th place with the score of 424k ? Spoiler alert : i cheated.
Oooh, i hear you from my chair : “how can you cheat in a contest like this ?” Very simple.

When i was under the water in my bathroom, i remembered the Bilbo contest. I don’t remember who said that to me. But for the Bilbo contest, some of the top players used the same kind of cheat.

What is that cheat ? Guess the validators.

How some of top players at Bilbo were so high ? They guessed some validators (not all, but some of them). The reversed alphabet was easy to guess. Some were a little harder.

So, let’s back to Code VS Zombie. 4h before the end, i was curious if it was possible to guess some validators. I think you all remember the 280k combo on the CG test case (the replay was on the chat). I hard coded it and i just reversed the y values. Jackpot. 360k points. I did the same for combo opportunity but this time i reversed the x values. Second jackopt, 424k points.

The optimization puzzle :

Before the contest, i talked to MaximeCG. I told him it will be very cool if validators will stay hidden forever. Because other optimization puzzles are more like “the best hardcoder win” (i’m not talking about codesize puzzles. Just bilbo and mars lander).

When the contest ended, i was all like “there’s no reason to keep validators hidden if they are that easy to guess anyway …”. And now the optimization puzzle is here, and you know what ? I tried to guess some validators, unsuccessfuly at the moment. They are not just some symetrics or x/y shiftings. And this is a very very very good thing.

At the moment i’m first at CvZ optimization puzzle. I used the same strategy than eldidou. I just tweaked a little the basic algorithm to make it better since now we don’t have the “magical super combo CG test case”. And well … i also used my javascript skills to make an auto submit bot … After 3000 submits and many differents parameters, i’m now at 467k.

Conclusions :

Monte Carlo codes :
I’m not sure how “Monte Carlo” codes should be handled during contest. Coding a monte carlo code is not that hard and make a tons of submits is not that fun too. But eldidou had the idea and won with it, no reason to blame him.

I don’t know the CodinGame staff feelings on it. It is pretty easy to “block” this kind of codes. Just rerun the code at the end of the contest. But i don’t know if it is a good idea.

Contest validators :
Please, make validators harder to guess. If i can guess the validators like that, i’m not the only one. The validators for the optimization puzzle are fine i think (because i can’t guess them for now :smiley: ). Optimization contests should always have validators like this.

Optimization validators :
I totally agree that optimization puzzles validators must be hidden. It was my suggestion to MaximeCG so i can only say it is a great idea ! But, can you re-think this for Bilbo ? At the moment, the Bilbo validators are hidden. But some of the players know them. It’s unfair for new players (Mars lander don’t have the problem since validators are the same that the IDE test cases).

Do i deserve my 6th rank ?
I don’t really know. I feel like i cheated. But i know that this cheat was also possible for Bilbo. So if by this post i can avoid the same thing for future optimization contest, i will be very glad. Without that cheat, i would be at the 70th rank (or something like that).


#65

I think they can, have you tried hardcoding Triangulation? I know I did try, and I was trolled by the bomb that was like “thou shalt not cheat!” and moved away, so if they apply the same king of algorithm to the rest of the new puzzles to come, it could work :slight_smile:


#66

I have it on good authority that hard coding triangulation is not that hard, thou hast much to learn about hard coding young padawan.


unpinned #67

#68

Hey, is it me or the CG map have been removed ? Have the scores been recomputed ? Just to know if it is still possible to do the best scores.


#69

That map has been removed and the validators have also changed.


#70

Hello, I lost my “Code vs Zombies” code on my computer, is codingame store my code after contest? if yes, how can I access it?


#71

Go here : https://www.codingame.com/leaderboards/global/challenge/code-vs-zombies
And click on the “report” button.


#72

Been there, done that. This is actually great, as it forces you to tihnk of the best solution, not the one that will pass the validator :wink:


#73

Actually with the same seed his algorithm can still give very different results on each execution since its while loop is time based, so the generated amount of possibilities are varying which may give a better action and change all its behavior.
To be the same each time it should be a for loop running a fixed amount of time (+ fixed seed)


#74

So I’m trying out the evaluation strategy where you score at the end of each simulated turn, multiply that by a scaling factor or something like .95^(turns) and add them all up. However, that scoring is causing my Ash to run around as long as possible to extend the game. Essentially because each round that Ash does nothing adds points to the evaluation, because some humans are alive. But once Ash kills the last zombie, the scoring stops on that turn.
So, my algorithm will score something like
“run around, run around, run around, kill” higher than
“kill”
Because the run around moves run up the score, and the kill move ends evaluation early.
My current solution is to not score any points for a turn where no zombies are killed, so the score doesn’t rack up.
Is there a general strategy for prioritizing ending earlier for problems like this? Does anyone have any other ideas on how to counteract the tendency of the AI to extend the turns as long as possible?


#75

In cases like that I usually add a big bonus for winning the game… since it’s a constant bonus, it won’t affect the evaluation if multiple winning moves are found (i.e. it’ll still pick the one with the higher score), but it won’t cause the AI to shy away from the end move.

It’s similar to the CSB logic; before I did that my bot would race at toward the checkpoint at full speed, before attempting to stop 1 pixel away from it.


#76

Thanks, I will try that out. I have to make sure the scaling factor will be enough to make sure that an earlier achieved constant value is better than several turns of staying alive with a constant value at the end.


#77

Hi all,

I have an unexpected error in CvsZ in Python3
The game and my code run as expected for 1 turn, but then it waits indefinitely for the 2nd turn’s last input line, ie the last zombie’s data
I’ve tested it on the 5 first tests, same thing

Any guess ?

here’s part of my code, if it helps

while True:
    
    _x, _y = [int(i) for i in input().split()]
    print("Ash", _x, _y, file=sys.stderr)
    
    _human_count = int(input())
    print("_human_count", _human_count, file=sys.stderr)    
    for _ in range(_human_count):
        _human_id, _human_x, _human_y = [int(j) for j in input().split()]
    
    _zombie_count = int(input())
    print("_zombie_count", _zombie_count, file=sys.stderr)    
    print("test 1", file=sys.stderr)    
    for _ in range(_zombie_count):
        print("test 2", file=sys.stderr)    
        _zombie_id, _zombie_x, _zombie_y, _zombie_xnext, _zombie_ynext = [int(j) for j in input().split()]
        print("test 3", file=sys.stderr)    

I get for 2nd turn :

Sortie d’erreur :

Ash 4622 925
_human_count 2
_zombie_count 2
test 1
test 2
test 3
test 2

Informations :

Timeout: the program did not provide 1 input lines in due time…


#78

You will get the next line after printing your move.
Add print("0 0") at the end of your loop to get it running.
This will move Ash to (0/0), which is of course not the best idea.


#79

Erhh… As I wrote it (and as it is requested by forum rules), it was only part of code…
Of course, my orders are printed thereafter, and luckily my orders may be different from “0 0”


#80

the code you pasted does not timeout on my end. I have the basic print(“0 0”) after of course. So I’m afraid the bug lies in the remaining part of your code


#81

Hi Magus
I use Javascript and i’m not able to simulate more than 200 strategies before getting a timeout from CG. I tried to apply some of your tips i saw earlier like not using Math.sqrt for distance calculation, avoid unwanted loops etc but it’s not enought
Do you have any “free” tips ? :slight_smile: