This is my implementation of the Capstone Project provided Udacity C++ Nanodegree Program. The code for this repo was inspired by this excellent StackOverflow post and set of responses.
The main implementation effort, went into adding obstacles to the classic Snake Game.
The project satisfies the following (non REQUIRED) Rubric Points
Criteria | Comment |
---|---|
The project demonstrates an understanding of C++ functions and control structures. |
The addede functions to deal with obstacles, use appropriate functions and control structures. |
The project reads data from a file and process the data, or the program writes data to a file. |
The obstacles are read from a .txt file. |
The project accepts user input and processes the input. |
Ther user can choose the playing mode and load the obstacle map. |
Criteria | Comment |
---|---|
The project uses Object Oriented Programming techniques. |
The obstacles are handled within an appropriate Class. |
Classes use appropriate access specifiers for class members. |
All class data members are explicitly specified as public, protected, or private. |
Class constructors utilize member initialization lists. | Appropriate initialization. |
Classes abstract implementation details from their interfaces. |
Informative function names and appropriate comments are used. |
Classes encapsulate behavior. | Getters are used in obstacles class. |
- cmake >= 3.7
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- SDL2 >= 2.0
- All installation instructions can be found here
Note that for Linux, an
apt
orapt-get
installation is preferred to building from source. - gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make a build directory in the top level directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./SnakeGame
.
- Start the executable
./SnakeGame
- Choose the game mode (Easy/Advanced) by interacting with the Terminal
- If you choose advanced, you will be asked for an obstacle file. Such a file is provided in the resources folder.
You have to specify the entire file path, so assuming you downloaded the file to your home folder, it should look something like this:user/home/CppND-Capstone-Snake-Game/resources/obstacles.txt
- Enjoy and try to avoid the obstacles!
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.