I wrote a snake game in Java. What I also want to do is create a demo for this (so the snake will play by itself). I wrote a simple demo, but the snake is dying quickly. So, are there any algorithms or something for this problem? I find this a bit like a chess game problem? I want the snake to be alive as long as possible . Thank.
If you just need a very simple strategy that does a reasonable demo, you can try something like the following:
, , AI ( ) . .
, , , , , , AI:
- " , ". , , , , , . , slinky, , , .
, AI: D
, , - , , . " " , . , , , , , . , , , ( ) . , , - , , , - , , -.