Introduction - If you have any usage issues, please Google them yourself
The main point of gluttony:
* 1) data structure: matrix[] is used to store information on the map, and if nothing is set to false,
* if there is food or snakes, set to true; NodeArray, a LinkedList, used to hold each of the snakes
* section; Food is used to preserve food; The Node class is the information that holds each location.
* 2) important functions:
* changeDirection(int newDirection), which is used to change the direction of the snake's direction, and only
* keep your head in the direction of your head, as other directions are already in place. The newDirection
* must not go in the opposite direction, so the opposite direction USES the same parity. In the test
* use of direction % 2! =newDirection % 2.
* moveOn(), used to update the location of the snake, changes the position of the head in the current direction. If I cross the line,
* the end; Otherwise, check for food (add head) or body (end); If nothing, plus the head,
* get rid of the tail. The use of the LinkedList data structure saves a considerable amount of trouble.
Packet : 69491709snake.rar filelist
snake.java