Skip to content

A classic C implementation of snake game in a Terminal. Features snake movement, apple generation, collision detection and scoring. Confirms my C programming skills.

Notifications You must be signed in to change notification settings

fchavonet/c-solid_snake

Repository files navigation

C logo

Solid Snake

🔖 Table of contents

CLICK TO ENLARGE 😇 📄 Description
🎓 Objectives
🔨 Tech stack
📂 Files description
💻 Installation and how to use
🔧 What's next ?
♥️ Thanks
👷 Authors

📝 Description

Solid Snake is a classic C implementation of the snake game, inspired by this ASMR programming video.
The game features a growing snake that consumes apples while avoiding collisions with itself.

🎓 Objectives

The objective of the project was to create a functional and enjoyable implementation of the classic snake game in C, playable in a Terminal. This involved implementing core game's mechanisms, such as snake movement, apple generation, collision detection and scoring.
The project serves as a confirmation of my C programming skills.

🔨 Tech stack

C badge Shell Script badge Git badge GitHub badge

📂 Files description

FILE DESCRIPTION
assets Contains the resources required for the repository.
main.h Header file with structure and function prototypes.
main.c Entry point of the program, contains the main loop.
disable_canonical.c Disables canonical mode for Terminal input.
print_game_title.c Prints the game title ASCII art.
print_playground.c Prints the playground of the game.
generate_snake.c Generates and moves the snake in the game.
get_keyboard_input.c Gets keyboard input for controlling the snake.
generate_apple.c Generates the apple's position in the game.
print_game_over.c Prints the game over message when the game ends.
best_score.c Handles reading and writing the best score.
README.md The readme file you are currently reading 😉.

💻 Installation and how to use

Installation:

  1. Clone this repository:
    • Open your preferred Terminal.
    • Navigate to the directory where you want to clone the repository.
    • Run the following command:
git clone https://github.com/fchavonet/c-solid_snake.git
  1. Open the repository you've just cloned.

  2. Compile the source code:

gcc *.c -o solid_snake

How to use:

  1. Run from your Terminal:
./solid_snake

How to play:

  1. QWERTY

    • Up: w.
    • Right: d.
    • Down: s.
    • Left: a.
    • Quit: esc.
  2. AZERTY

    • Up: z.
    • Right: d.
    • Down: s.
    • Left: q.
    • Quit: esc.

🔧 What's next ?

  • Clean and optimize code.

♥️ Thanks

A big thank you to Serene Dev for his ASMR video and to Holberton School for providing a solid foundation in C programming.

👷 Authors

Fabien CHAVONET

About

A classic C implementation of snake game in a Terminal. Features snake movement, apple generation, collision detection and scoring. Confirms my C programming skills.

Topics

Resources

Stars

Watchers

Forks

Languages