I'm new to this gamedev stackechange but have used the math and cs sites before.
So, I'm in a competition to create AI for a snake that will compete with four other snakes in 5 minute rounds where the rules are much like the traditional Nokia snake game except that there are five snakes, the board is 30x30 and there are a number of small obstacles on the field.
Like the Nokia game, your snake grows when you get to the fruit and if you crash into yourself, another snake or the wall you die. The game runs with a 30ms delay between moves and the server sends the new game state every 50ms which the code must analyze and what not and output the next move.
The winner is the snake who had the longest length at any point in the game. Tie breakers are decided by kills.
So far what I have done is implemented an A* graph search from each snake to determine if my snake is the closest to the apple and if it is, it goes for the apple. Otherwise, I made a neat little algorithm to determine the emptiest area of the board, which my snake goes for, to anticipate the next apple.
Other than this I have some small survivability checks to ensure my snake isn't walking into a trap that it can't get out and if it does get stuck, I have something to give it a better chance of getting out.
Anyway, I've tested my snake on a test server and it does quite well. Generally, my strategy of only going for the apple when its a sure thing and finding space when its not makes it grow faster than any other snakes (some snakes do a similar thing but often just go to the middle or a corner) sometimes it wins these trial games but is more often than not beaten by the same snake who seems to have the edge on survivability (my snake grows quicker but then dies somehow and this other snake just plods slowly along and wins on consistency.
So I was wondering about any ideas anyone has to try and improve my snake. Or maybe ideas at a new approach to take. My functions and classes are good so changes that might seem drastic shouldn't be too bad. I encourage all ideas.