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.

90 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
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
  15. snake and controller classes.
  16. - [ ] Implement the Game::printGameStatistics function to print the score and games played of each player.
  17. ---
  18. ## Prerequisities
  19. You need to install the following packages:
  20. - __libncurses5-dev__ : Developer’s libraries for ncurses,
  21. - __libncursesw5-dev__ : Developer’s libraries for ncursesw,
  22. - __gcc__ : C\C++ compiler,
  23. - __make__ : instalation tool.
  24. Open up a terminal and type the folllowing commands:
  25. ```shell
  26. #make sure everything is updated
  27. ~$ sudo apt update && sudo apt upgrade
  28. #Now to install compiler and instalation tool
  29. ~$ sudo apt-get install gcc make
  30. #And the actuall library (ncurses)
  31. ~$ sudo apt-get install libncurses5-dev libncursesw5-dev
  32. ```
  33. Now you are ready to use the repo.
  34. ---
  35. ## Downloading, Instalation and Running the Program
  36. Now we will install and run the program, but first let's download the repo:
  37. ```shell
  38. ~$ git clone https://github.com/VissaMoutafis/Snake_Game_in_Cpp
  39. # cd in the directory
  40. ~$ cd Snake_Game_in_Cpp
  41. #run the 'make run' to install and play
  42. ~$ make run
  43. ```
  44. and enjoy playing!
  45. __Note__: You might want to delete the objective files and keep only the src part (__clean up__). In that case:
  46. ```shell
  47. ~$ make clean
  48. ```
  49. and you are set.
  50. ---
  51. ## Contributors
  52. [VissaM](https://github.com/VissaMoutafis)
  53. Special thanks to [plato(otalpster)](https://github.com/otalpster) for fixing a bug that i would never notice! (Thnx man)
  54. ---
  55. ## Licence: MIT
  56. Check the file LICENCE or click the following [link](https://github.com/VissaMoutafis/Snake_Game_in_Cpp/blob/master/LICENSE).
  57. ## Appendix
  58. 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!
  59. Another ncurses guide (maybe more begginer friendly) is [this](http://www.cs.ukzn.ac.za/~hughm/os/notes/ncurses.html) one.
  60. ### Enjoy!