Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
How come the rankings changed so drastically after competition without any games played (i went from 91th to 52nd)?
Probably a lot of players submitted worst bots in the last second!?
Hi @0x6E0FF,
Could you give some hints how you were able:
to simulate around ~30000 turn in 50ms
For your bot
How did you structure your Game State representation?
Did you shortcut some rules from the original game, like ignoring out of bounds snakes?
I used bitset for various part,. The grid is static and not part of the game structure. The game state is composed of one bitset for the powersources, and an array of snakes, each using a vecdeque of (x,y) to store the body. I use temporary bitsets to convert snakes body into bitsets that i can combine with grid and powersource for fast lookup of solid cells.
Everything is preallocated, i never allocate on the heap during simulation. Every intermediate structure is stored in temporary compute data that i reuse to avoid allocations.
For fall logic, at the begining of the contest I took the approach of the Java referee, but it was slow. few days after the start, Jacek and eulerscheZahl mentioned bugs in this part on discord, which has then been fixed using Jacek recommandation (the jacekgorithm). I rewrote the fall part using this approach adapted to my bitsets, which turned out to be way faster (almost cut by half my simulation time)
What strategies have you tried? Which powers do you target? What pathfinding algorithms do you use? Do you hunt the opponent’s snakes? Do you try to help out your own snakes? Do you use the current score in any way? How do you avoid getting trapped?
I’ve seen the winner coiling around the last available power. Is it because they count on the opponent timing out or is it some advanced trap for the opponent to fall into.