A traditional snake game written in c and rendered with SDL3. The game features the basic functionality of classic snake with some minor improvements like smoother movement.
To install the game, clone the repository and compile the project with make. Then run the main executable that was built by make.
cd <LOCATION>
git clone https://github.com/Samisalami05/snake.git
cd snake
make
./mainIf you get any issues while compiling the game, it probably
is because you dont have gcc installed or SDL3 on your
system.
The snake is essentially just a linked list of cells with each cell having their own position. Every time the snake moves, the cell chain is traversed and each and every cells position is updated. The same logic goes for rendering where all of the cells the chain is looped through and drawn.
struct snake {
snake_cell* head;
};
struct snake_cell {
int x;
int y;
snake_cell* next;
};