Current location - Education and Training Encyclopedia - Graduation thesis - Java snake with tail problem
Java snake with tail problem
For object-oriented design, such a problem should not exist.

The length of the snake is an attribute of the snake object, and eating is an act. Modify the attribute of snake length when eating.

How to display it on the display is a problem that needs to be considered for the display object.

There seems to be no need to use a linked list, because each segment of snake has no special parameters to store. I think just one INT is enough.

I think you seem to think too complicated.