You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A doubly-linked list based snake clone written in C.
The snake is represented as a doubly-linked list, where each section is a node.
Moving forwards involves popping the tail node from the list, and prepending it to the head. Its coordinates are then modified in respect to the direction the snake is moving.
When an apple is touched, its new position is randomized (ensuring that the apple is not spawned on the snake)
Adding to the snake allocates the memory for a new node, and prepends it to the snake, becoming the new head.
The game is written using ncurses for keyboard input and improved screen printing to terminal
Example
The game board size can be set in the header file
Touching the walls or running into your tail ends the game.