You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.4 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. # Snake Game in C++
  2. ## Abstract
  3. A simple snake game, with terminal GUI implemented using ncurses library.
  4. #### Controls:
  5. - __Up-Arrow__ to go up.
  6. - __Down-Arrow__ to go down.
  7. - __Left-Arrow__ to go left.
  8. - __Right-Arrow__ to go right.
  9. - __q__ to exit game.
  10. ### TODO:
  11. - [x] Increase speed of the snake when it devours a snack.
  12. - [x] Add a scoreboard.
  13. - [ ] Fix the window-resize factor, since it gets all messy when you minimize/maximize the terminal window.
  14. - [x] 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.
  15. - [ ] Implement the Game::printGameStatistics function to print the score and games played of each player.
  16. ---
  17. ## Prerequisities
  18. You need to install the following packages:
  19. - __libncurses5-dev__ : Developer’s libraries for ncurses,
  20. - __libncursesw5-dev__ : Developer’s libraries for ncursesw,
  21. - __gcc__ : C\C++ compiler,
  22. - __make__ : instalation tool.
  23. Open up a terminal and type the folllowing commands:
  24. ```shell
  25. #make sure everything is updated
  26. ~$ sudo apt update && sudo apt upgrade
  27. #Now to install compiler and instalation tool
  28. ~$ sudo apt-get install gcc make
  29. #And the actuall library (ncurses)
  30. ~$ sudo apt-get install libncurses5-dev libncursesw5-dev
  31. ```
  32. Now you are ready to use the repo.
  33. ---
  34. ## Downloading, Instalation and Running the Program
  35. Now we will install and run the program, but first let's download the repo:
  36. ```shell
  37. ~$ git clone https://github.com/VissaMoutafis/Snake_Game_in_Cpp
  38. # cd in the directory
  39. ~$ cd Snake_Game_in_Cpp
  40. #run the 'make run' to install and play
  41. ~$ make run
  42. ```
  43. and enjoy playing!
  44. __Note__: You might want to delete the objective files and keep only the src part (__clean up__). In that case:
  45. ```shell
  46. ~$ make clean
  47. ```
  48. and you are set.
  49. ---
  50. ## Contributors
  51. [VissaM](https://github.com/VissaMoutafis)
  52. Special thanks to [plato(otalpster)](https://github.com/otalpster) for fixing a bug that i would never notice! (Thnx man)
  53. ---
  54. ## Licence: MIT
  55. Check the file LICENCE or click the following [link](https://github.com/VissaMoutafis/Snake_Game_in_Cpp/blob/master/LICENSE).
  56. ## Appendix
  57. If you are interested to know more about terminal gui apps and __especially ncurses library__, check [this](http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/index.html) out!
  58. Another ncurses guide (maybe more begginer friendly) is [this](http://www.cs.ukzn.ac.za/~hughm/os/notes/ncurses.html) one.
  59. ### Enjoy!