Snek in C

Modified Snake Game written in C with optimized memory

In this project, I developed a playable version of Snake game in C as part of the CS 61C course together with Nurzhan Abdrassilov - my project partner. The project involved creating a game board, managing the state of the game, and implementing functions to handle the movement and interactions of the snake, such as eating fruit and colliding with walls or itself. I built key components like create_default_state, update_state, and initialize_snake, ensuring proper memory management and game functionality. The game logic includes updating the snake’s head and tail positions, detecting collisions, and dynamically adjusting the game board. Unlike the classical snake game, this version allows for having multiple snakes at once on the same board.

This project involved such skills as C programming, memory management, using GDB and Valgrind and data strcutures. Additionally, this version of the game takes the least memory possible with our implementation (not a single bit is wasted)

<div class="row justify-content-sm-center">
  <div class="col-sm-8 mt-3 mt-md-0">
    {% include figure.liquid path="assets/img/6.jpg" title="example image" class="img-fluid rounded z-depth-1" %}
  </div>
  <div class="col-sm-4 mt-3 mt-md-0">
    {% include figure.liquid path="assets/img/11.jpg" title="example image" class="img-fluid rounded z-depth-1" %}
  </div>
</div>