The code for this repo is based on Udacity Capstone Snake Game Example.
In this project, player controls one snake agaist one self-navigated snake, whose action is base on a path searching algorithm. Expansion method is the core for constructing the path.
In this project, player controls one snake agaist one self-navigated snake, whose action is base on a real time path searching. Expansion method is used for constructing the path.
- The project demonstrates an understanding of C++ functions and control structures.
- The project uses Object Oriented Programming techniques.
- Classes use appropriate access specifiers for class members.
3.1. members are specified as public and protected in class snake (snake.h) 3.2. members are specified as public and private in class snake (auto_snake.h) - Class constructors utilize member initialization lists.
4.1. game.cpp - line 7 4.2. snake.h - line 12 4.3. auto_snake.h - line 16 - Classes abstract implementation details from their interfaces.
- Classes encapsulate behavior.
- Classes follow an appropriate inheritance hierarchy.
7.1. class auto_snake inheritate from class snake 7.2. composition: game.h - line 26 - Derived class functions override virtual base class functions.
8.1. virtual function: snake.h - line 42 8.2. override: auto_snake.h - line 21 - The project makes use of references in function declarations.
- The project uses move semantics to move data, instead of copying it, where possible.
10.1. auto_snake.h - line 16 - The project uses multithreading.
11.1. game.cpp - line 70 - A mutex or lock is used in the project.
12.1. unique_lock: snake.cpp - line 37, auto_snake.cpp - line 78,
- 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
.