Skip to content

0xsoria/CppND-Capstone-Snake-Game

 
 

Repository files navigation

CPPND: Capstone Snake Game Example

This is a starter repo for the Capstone project in the Udacity C++ Nanodegree Program. The code for this repo was inspired by this excellent StackOverflow post and set of responses.

The Capstone Project gives you a chance to integrate what you've learned throughout this program. This project will become an important part of your portfolio to share with current and future colleagues and employers.

In this project, you can build your own C++ application or extend this Snake game, following the principles you have learned throughout this Nanodegree Program. This project will demonstrate that you can independently create applications using a wide range of C++ features.

Dependencies for Running Locally

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory in the top level directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./SnakeGame.

Rubric Points

Compiling and Testing

Project compiles and run. Check Basic Build Instructions section to build the project.

Loops, Functions, I/O

The project code is clearly organized into functionsa and classes. Functions uses loops when necessary and I/O to control the snake. Example: Timer class, RunTimer function;

Object Oriented Programming

The project is organized into classes, uses classes methods to perform tasks, contains destructors, encapsulation, templates and more. Classes have public and private members when necessary;

  • Example: Game and Timer classes (And all the others);

Memory Management

The project makes use of references in function declarations and constructors. Both references and pointers used all around the project.

  • Example: Game class constructor and class;

Concurrency

Project uses a secondary thread for the 10 seconds timer and restart this timer once the snake eats a food or decrease 2 seconds once the snake eats a poisoned food. Example: Timer class, StartTimer function;

Explaining my version of the game

  • The game has a 10 seconds timer, if you don't eat any food during this time, the snake dies;
  • Poisoned food will appear in the screen, each poisoned food the snake eats, it will decrease the timer in 2 seconds and make the snake run slower;

CC Attribution-ShareAlike 4.0 International

Shield: CC BY-SA 4.0

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

CC BY-SA 4.0

About

A 2D Snake game using C++ and SDL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 79.0%
  • CMake 21.0%