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.

83 lines
3.5 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
  1. # Snake Game for learning C++
  2. ## Abstract
  3. A simple snake game, with terminal GUI implemented using ncurses library.
  4. Taken from Vissa Moutafis [LINK](https://github.com/VissaMoutafis/Snake-Game-in-Cpp) and heavily modified.
  5. #### Required Knowledge:
  6. This project is meant for those with a little programming experience in any other language or a general overview of programming concepts. If you can tell the terms "Object" and "Class" apart, know what a function is, know basic git and have used a command line before, then this project will teach you through exploring and solving challenges by yourself how to program C++. If you don't know these terms but can take a big challenge, then this is still a good starting point. Just try to figure out what is going on and you will learn a lot.
  7. #### Resources:
  8. - __[cppreference](https://en.cppreference.com/w/)__ for information on all elements of the language, quite detailed and might be overwhelming for beginners
  9. - __[Cherno C++ Playlist](https://www.youtube.com/watch?v=18c3MTX0PK0&list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb)__ for an overview of all components of the language in a very beginner-friendly format
  10. - __stackoverflow__ when you have a problem, most of the time, someone else has encountered it too, and you will find help and examples when web-searching and clicking on links to this site
  11. - __[Tetris for Windows](https://youtu.be/8OK8_tHeCIA)__ code-along tetris video for the windows command line with good and beginner-friendly explanations
  12. #### Controls:
  13. - __Up-Arrow__ to go up.
  14. - __Down-Arrow__ to go down.
  15. - __Left-Arrow__ to go left.
  16. - __Right-Arrow__ to go right.
  17. - __q__ to exit game.
  18. ---
  19. ## Prerequisities
  20. You need to install the following packages:
  21. - __ncurses__ : Terminal User Interface Library "ncurses"
  22. - __cmake__ and __make__ : Build Tools
  23. - __gcc__ or __clang__ : C/C++ Compiler
  24. If you use MacOS then you must install homebrew for access to the packages. On Windows you must install and set up WSL to get a Linux command line.
  25. Open up a terminal and type the folllowing commands:
  26. ```shell
  27. # Most Linux distributions and WSL under Windows
  28. ~$ sudo apt-get install gcc make cmake libncurses5-dev libncursesw5-dev
  29. # On MacOS
  30. ~$ brew install clang make cmake ncurses
  31. # Or for FreeBSD
  32. ~$ sudo apt-get install clang make cmake ncurses
  33. ```
  34. Now you are ready to use the repo.
  35. ---
  36. ## Downloading, Instalation and Running the Program
  37. Now we will install and run the program, but first let's download the repo:
  38. ```shell
  39. ~$ git clone https://git.constantin-fuerst.com/constantin/snake
  40. # cd in the directory
  41. ~$ cd snake
  42. # select the correct branch for learning
  43. ~$ git checkout lessons
  44. # or cheat and look at the solution / see what you will achieve with
  45. ~$ git checkout master
  46. # run the helper script to build and execute
  47. ~$ bash build-and-run.sh
  48. ```
  49. and begin your journey through C++!
  50. ---
  51. ## How to learn
  52. - [ ] Perform Setup like above
  53. - [ ] Run the game on __master__ branch
  54. - [ ] Explore the code
  55. - [ ] set up a development environment for c++ on your computer - see the __Cherno Playlist__ first few videos for help
  56. - [ ] try to figure out what's going on in the _components_ and _game_ subfolders
  57. - [ ] find out what a preprocessor, compiler and linker do - see the __Cherno Playlist__ first few videos for help
  58. - [ ] check out the _CMakeLists.txt_ and _build-and-run.sh_ files and the created _build_ folder and try to understand how they lead to the application going from code to executable
  59. - [ ] Change to branch __lessons__
  60. - [ ] Move to LESSONS.md for further tasks