Skip to content

A simple snake game, with terminal GUI implemented using ncurses library

License

Notifications You must be signed in to change notification settings

VissaMoutafis/Snake-Game-in-Cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game in C++

Abstract

A simple snake game, with terminal GUI implemented using ncurses library.

Controls:

  • Up-Arrow to go up.
  • Down-Arrow to go down.
  • Left-Arrow to go left.
  • Right-Arrow to go right.
  • q to exit game.

TODO:

  • Increase speed of the snake when it devours a snack.
  • Add a scoreboard.
  • Fix the window-resize factor, since it gets all messy when you minimize/maximize the terminal window.
  • Create a 'Game' class and provide interface through that function so that the user don't have to mess with the graphics snake and controller classes.
  • Implement the Game::printGameStatistics function to print the score and games played of each player.

Prerequisities

You need to install the following packages:

  • libncurses5-dev : Developer’s libraries for ncurses,
  • libncursesw5-dev : Developer’s libraries for ncursesw,
  • gcc : C\C++ compiler,
  • make : instalation tool.

Open up a terminal and type the folllowing commands:

#make sure everything is updated
~$ sudo apt update && sudo apt upgrade

#Now to install compiler and instalation tool
~$ sudo apt-get install gcc make

#And the actuall library (ncurses)
~$ sudo apt-get install libncurses5-dev libncursesw5-dev

Now you are ready to use the repo.


Downloading, Instalation and Running the Program

Now we will install and run the program, but first let's download the repo:

~$ git clone https://github.com/VissaMoutafis/Snake_Game_in_Cpp

# cd in the directory
~$ cd Snake_Game_in_Cpp

#run the 'make run' to install and play
~$ make run

and enjoy playing!

Note: You might want to delete the objective files and keep only the src part (clean up). In that case:

~$ make clean

and you are set.


Contributors

VissaM

Special thanks to plato(otalpster) for fixing a bug that i would never notice! (Thnx man)


Licence: MIT

Check the file LICENCE or click the following link.

Appendix

If you are interested to know more about terminal gui apps and especially ncurses library, check this out!

Another ncurses guide (maybe more begginer friendly) is this one.

Enjoy!

About

A simple snake game, with terminal GUI implemented using ncurses library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published