Skip to content

pietrobalatti/Adavanced-Snake-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Snake Game

This game was designed to complete 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.

With respect to the original game, this version:

  • allows the user to select the difficulty among "easy, standard, hard", this impacts directly on the grid dimension
  • renders the record score and player
  • asks the user to enter his/her name once a new record is achieved
  • show a "Game Over" window, when the player loses
  • automatically destroys the window after the prevous above-mentioned "Game Over" windows has been shown for 2 seconds

Satisfied criteria

  1. "The project reads data from a file and process the data, or the program writes data to a file"
    The game stores and reads data relative to the record score and player, offering the chance to enter the player name when he/she achieves a score that is higher w.r.t. the current record.
  2. "The project uses smart pointers instead of raw pointers." In main.cpp, "renderer" is instantiated as unique pointer, like this at the end of the game, a reset() is called to this object. In this way, the object deconstructor is called, the game windows terminates, and the user is able to see the terminal. Like this, the user can enter his/her name if he broke the current record.
  3. "The project accepts user input and processes the input." When the game is launched, a welcome windows is shown, where the user can select various options.
  4. "The project makes use of references in function declarations." Multiple functions use pass-by-reference in the project, e.g. Renderer:ReadBoardFile, Game::StoreRecordData, overloaded function Controller::HandleInput, ...
  5. "Overloaded functions allow the same function to operate on different parameters." Functions Controller::HandleInput and Renderer:Render are overloaded with different signatures.

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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •