Skip to content

artic2702/Snake_game_in_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Snake Game (C++ Console)

A simple classic Snake game built using C++ for the Windows console. The snake moves using keyboard input, eats fruit to grow longer, and the game ends when it hits a wall or itself.

๐ŸŽฎ Controls

Key Action
W Move Up
A Move Left
S Move Down
D Move Right
X Exit Game

โš™๏ธ Features

  • Console-based UI
  • Snake grows when eating fruit
  • Score tracking
  • Wall collision detection
  • Self-collision detection
  • Adjustable game speed

๐Ÿ›  Requirements

  • Windows OS

  • C++ Compiler (g++, MSVC, etc.)

  • Headers used:

    • <iostream>
    • <conio.h>
    • <cstdlib>
    • <ctime>
    • <windows.h>

โ–ถ๏ธ How to Run

Compile:

g++ snake_game.cpp -o snake_game

Run:

snake_game

โฑ Speed Control

In main() function:

Sleep(300);  // Increase for slower game
Value Speed
100 Fast
200 Normal
300 Slow
400 Very Slow

๐Ÿ“ Project Structure

snake-game/
โ”œโ”€โ”€ snake_game.cpp
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md

Built as a learning project to practice:

  • C++
  • Game logic
  • Keyboard input
  • Git & GitHub usage

Enjoy the game! ๐ŸŽ‰

About

First game project and game i ever made myself

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages