This is the final Capstone project of the Udacity C++ Nanodegree Program. The code for this repo was inspired by this excellent StackOverflow post and set of responses.
- There are boosters marked by 🚀 which will speed up the snake's speed.
- New boosters will be randomly placed in the game after you eat any of them.
- Beware of obstacles.
- Parameters such as number of obstacles and boosters can be configured from gameConfig/config.txt file.
- A starting screen has been added.
- The game can be reset in the starting screen.
- The game can be paused if you press
Esc
.
- 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.
- SDL2 TTF >= 2.0
- All installation instructions can be found here
- Note that for Linux, an
apt
orapt-get
installation is preferred to building from source.- sudo apt install libsdl2-ttf-dev
- sudo apt-get install libsdl2-ttf-dev
- 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
.
- The submission must compile and run.
- The project demonstrates an understanding of C++ functions and control structures.
- The code starts from main.cpp and uses functions along the way.
- The project reads data from a file and process the data, or the program writes data to a file.
- The project accepts user input and processes the input.
- It has a welcoming page and allows the player to choose to play, reset, or quit the game (welcoming page).
- The project uses Object Oriented Programming techniques.
- Please visit the
src
folder and take a look. The project code is built on objects such as controller, snake, obstacles, and renderer.
- Please visit the
- Classes use appropriate access specifiers for class members.
- Please visit the
src
folder and take a look.
- Please visit the
- Class constructors utilize member initialization lists.
- Examples include game.cpp and coordinate.h.
- Classes encapsulate behavior.
- Examples include fileUtils.h.
- Classes follow an appropriate inheritance hierarchy.
- Examples include boosters.h.
- The project makes use of references in function declarations.
- Examples include game.h and controller.h.
- The project uses destructors appropriately.
- Examples include renderer.h.
- The project uses smart pointers instead of raw pointers.
- Examples include gameObjects.h.