Skip to content

sinanyamaan/CppND-Capstone-Snake-Game

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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, I added these features to accomplish the project rubric requirements:

  • Added an enemy in the game as an extra feature.
  • Loops, Functions, I/O
    • Using control structures and organizing the code in functions.
    • Accepting input from the user.
  • Object Oriented Programming
    • Using object oriented programming techniques.
    • Using appropriate access specifiers for members.
    • Using member initialization lists.
    • Member data that is subject to an invariant is hidden from the user.
    • Classes follow an appropriate inheritance hierarchy.
    • Overriding a virtual base class function.
  • Memory Management
    • Using RAII where appropriate.
    • Smart pointers used instead of raw pointers.

Rules of the Game

  • If enemy snake bites the player snake from its tail, player snake will get short.
  • If player snake touches the enemy snake, the player snake will die.
  • When player eats a food, gets a point. But the only way to win the game is staying alive before the enemy takes a bite itself!

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.

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++ 77.2%
  • CMake 22.8%