Skip to content

gigi96/SnakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Udacity C++ Nanodegree: Capstone final project

My Capstone project for the Udacity C++ Nanodegree Program is an extension of the Snake game (https://github.com/udacity/CppND-Capstone-Hello-World.git).

The following features have been added:

  • statistics of player games:
    • a statistic is made up of a pair date-score;
    • statistics are saved in a txt file and showed in the console at the end of a game;
    • statistics are sorted by score;
    • the player can choose to save or not the result of the game
  • obstacle objects:
    • an obstacle is added in the game in a random position in a similar way a food object is already inserted;
    • if the snake collides with an obstacle, snake's size and player's score are decremented;
    • if the snake size is equal to one and it collides with an obstacle, nothing happens

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.

Criteria

  • Loops, Functions, I/O
    • The project demonstrates an understanding of C++ functions and control structures:
      • all the code uses different functions and control structures
    • The project reads data from a file and process the data, or the program writes data to a file:
      • the Game constructor and the Game::update_statistics() method read and write on a txt file
    • The project accepts user input and processes the input:
      • in the main.cpp there is a interaction with the end user
  • Object Oriented Programming
    • The project uses Object Oriented Programming techniques:
      • all the code is made up of classes, with their declaration in the .h files and their implementation in the .cpp files
    • Classes use appropriate access specifiers for class members:
      • there are public and private members for each classes. Set and Get methods are use to access private attributes
    • Classes encapsulate behavior

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

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published