-
Snake
Well, I'm well into a snake game, but I'm having issues with storing the snake "pieces". At first I was planning on using vectors, but people suggested to me using a ring queue. I'm wondering what you guys think. What would be the most common way that snake is made?
So far, I've got a Snake class, and a SnakePiece class. SnakePiece is just x,y, and Snake class is kind of messed up now because It's gone through many different experiments, lol.
-
> I'm wondering what you guys think.
I think you should try both, then you'll have more understanding of the problems and advantages of each solution, and be able to make better choices in your future programming assignments.
-
When I wrote my own Snake clone I used both. A 2D array of the field that served the purpose of giving O(1) checks for collision and the use of a circular doubly linked list removed the need of shifting an array every time a move is made.