Skip to content

Trevin-Small/C-Snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Snake Game

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

Example Snake Image

  • The game board size can be set in the header file
  • Touching the walls or running into your tail ends the game.

About

A doubly-linked list snake game written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages