Skip to content

A-Croshaw/Riddles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Riddles

Giff-Image

Click here to view live deployment

This featured low level Python game that deploys to a console.

The game consists of 20 riddles that have multiple choice answers for you to pick from.

The riddles are imported from a google sheet worksheet that contains 50 riddles with the answers.

The game has a function that can save the player scores upon the request of the player and the scores are saved to a worksheet.

It has instructions that are seen by the user upon loading making it easy to understand how the game works

Content Menu

Features

How To Play

  • The player will be prompted to enter there name which they can skip.

  • Skipping the name input will stop the user from saving there score.

  • The player can display scores that have been saved.

  • This is a multiple choice game prompting the player to select the corret answer for the riddles from a choice of 3 answers.

  • The idea of the game is to get as many correct as possible.

  • The player will be able to save there score at the end of the game(if name has been entered)

  • There is a play again prompt allowing the player to play again.

Game Elements

_1 - Welcome _

  • is a simple Welcome to riddles header

Welcome

2 - Player

  • After the welcome header the player will be prompt to enter there mane or press enter to continue.

  • This then take the player to the How To Play section.

Player

3 - How To Play

  • This explains to the player How to play the game.

  • This is outputted as soon as the player has either entered ther name or pressed enter to skip.

  • The has a prompt saying 'Press Enter To Continue' and this will take the palyer to See Saved Scores prompt.

How To Play

4 - Saved Score Viewing

  • The player is prompt with asking to view the saved scores and asked to type 'Yes', 'Or Press Enter To Continue'.

  • Typing yes will Show the stored scores and display this table below.

  • Pressing enter then the player is taken to the Riddles

  • If the player is at the end of the game then pressing enter will take then to Play Again to allow the player to either exit or restart.

Saved Score Viewing

  • This table will show if the user has requested viva the prompt.

  • It shows the name, score and the preceentage of each player that has saved scores.

  • If the player has chosen to save there score at the end of the game, there is another prompt to allow then to view the scores.

  • At the bottom of there table there is a message saying 'Press Enter To Contiune'.

  • If the player is at the begining of the game this will take the player to the Riddles to begin playing.

  • If the player is at the end of the game then this will take the player to Play Again to allow the player to either exit or restart.

Score Table

5 - Displayed Riddles

  • The player will be Shown a message saying 'Good Luck' before the first riddle only.

Good Luck

  • Then the player will be pressented with the first riddle.

  • This shows The player What riddle there are currently on first.

  • Then Shows The riddle.

  • Then Shows The options to choose from.

  • Then the player is prompr to Type 'A', 'B' or 'C'.

  • Once the player has answered the user will be prompted with the correct output.

  • If the player answers correctly then 'You Answered Correctly' message is show with the current score.

  • If the player answers incorrectly then 'Sorry Wrong Answer' message is show with the current score.

  • If the player answers enters an incorrect value then th you 'Incorrect Value' message is show a prompt saying enter A, B or C.

  • This will be the same steps untill the 20th riddle is answered.

Displayed Riddles

6 - Correct Answer

  • If the player answers the riddle correctly then this 'You Answered Correctly' message will show.

  • The players score will increase by one point and display their currnt score below.

Correct Answer

7 - Incorrect Answer

  • If the player answers the riddle incorrectly then this 'Sorry Wrong Answer' message will show.

  • The players score will not change but will display their currnt score below.

Incorrect Answer

8 - Invalid Entries

  • Whilst the player is answering the riddles and does not enter 'A' or 'a', 'B' or 'b', 'C' or 'c'

    this incorrect value message will show and prompt the user to enter A, B or C.

Invalid Enterys

9 - Final Score

  • After the play has answered all the riddles this final score message will show.

  • The final score message will show the player their score with an accuracy percentage aswell.

  • IF a player get all 20 riddles correct the will be pressented with a 'CONGRATULATIONS (Players Name) YOU ARE A RIDDLE MASTER' message.

Top Score

  • Then the user will be prompted with To Save Your Score* or See Saved Scores.

    *(only displays when player provides a name, is shown before 'See Saved Scores' if name is provided).

10 - Saving Scores

  • This is option only shows whan a player has provided a name.

  • if a name is not given the use will be prompted with the See Save Scores. (See Above For Details).

  • If the player had given a name then they will be asked if they would like to save there score and asked to type 'Yes', 'Or Press Enter To Continue'.

Saving Scores

  • If the user Types Yes then The 'Uploading Score" message will show first and once the proccess has finished the 'Successfully Added' message will appear.

  • Then the user will be prompted with the See Save Scores. (See Above For Details).

Saved Scores

  • If the player presses enter then this process will be skipped and the user will be prompted with the See Save Scores. (See Above For Details).

11 - Play Again

  • The player will be prompt with 'Play Again' message and asked to type 'Yes', 'Or Press Enter To Conintue'.

  • If the player types yes the the game will loop back to the how to play screen so the player can start again.

  • If the plyer presses enter to continue the game will procceed to end.

Play Again

12 - Game End

  • After the player has pressed enter not to play again, this 'Thank You For Playing' message is deployed.

Game End

Data Storage

  • The data for this game is exchanged using google sheets

  • The riddles are generated from a worksheet riddles that holds all the riddles, answer options and correct answer indicater.

  • The player scores are saved to another worksheet scores that then is inputted back to the score table.

Implemented Features

  • Has difreent colour outputs so show the different types of information shown to the player.

  • has a save funtion to save the players scores.

  • Has a function to resart the game.

  • Easily able to implent more riddles buy inputting them to the google sheet worksheet

Features to be Implemented

  • Change the score table from showing all saved scores to the top 10 higest scores.

Design

  • This flow chart shows how the game responds within the different sections.

  • This flow chart will Help through the testing to determine whether the game responds as it should.

Flow Chart

Bugs

  • Through testing there are no current known bugs within the game

  • Throught development there was a bug of same questions being show more than once within one game sequence

    • which was fixed using an if statment to check if a generated item had been used already.

Testing

Test Expected Outcome
Run run.py run.py loads, Welcome banner appears, player name prompt, appears As Expected
Enter Player Name and press enter How To Play Information appear As Expected
Press enter on how to play Loads To See Saved Scores Prompt As Expected
Type yes on To See Saved Scores Prompt and Press enter Loads Saved Scores Table As Expected
Press enter on Saved Score Table to Continue Loads Good Luck Banner And first Riddle As Expected
Enter C For Correct Answer Loads Correct Answer Output and Score Output with score of 1, Loads Second Riddle As Expected
Enter B for Wrong Answer Loads Wrong Answer Output and Score Output with score of 1, Loads Third Riddle As Expected
Enter C For Correct Answer Loads Correct Answer Output and Score Output with score of 2, Loads fourth Riddle As Expected
Enter A for Wrong Answer Loads Wrong Answer Output and Score Output with score of 2, Loads fith Riddle As Expected
Enter B For Correct Answer Loads Correct Answer Output and Score Output with score of 3, Loads sixth Riddle As Expected
Enter C for Wrong Answer LoadsWrong Answer Output and Score Output with score of 3, Loads Seventh Riddle As Expected
Enter C For Correct Answer Loads Correct Answer Output and Score Output with score of 4, Loads 8th Riddle As Expected
Enter D For Incorrect Value Loads Incorrect Value Output, And Enter (A, B, C) Prompt As Expected
Press Enter With No Input Loads Incorrect Value Output, And Enter (A, B, C) Prompt As Expected
Randon Select Rest of Riddle Answers untill final Riddle Diplay Outputs According to Correct, or Wrong Answers As Expected
Enter Last Riddle Choice Displays Correct Output Depening on selection, Loads Finall Score Output, Loads Save Score Prompt As Expected
Type yes to Save Score Shows Uploading output, Shows Successful output, Loads See Saved Scores Prompt As Expected
Type yes on To See Saved Scores Prompt and Press enter Loads Saved Scores Table As Expected
Press enter on Saved Score Table to Continue Loads Play Again Prompt As Expected
Type Yes On Play Again Prompt Loads Up How To Play Output As Expected
Press enter on how to play Loads To See Saved Scores Prompt As Expected
Press Enter To Skip Score Table Loads Good Luck Banner And first Riddle As Expected
Randomly Selectect Answers To all 20 Riddles Diplay Outputs According to Correct, or Wrong Answers, Loads Save Score Prompt As Expected
Press Enter To SkipSave Score Loads See Saved Score Prompt As Expected
Press Enter To See Saved Score Score Loads Play Again Prompt As Expected
Press Enter To Skip Play Again Prompt Loads Thank you for playing Output, Game ends As Expected
Load run.py Skip player Name, Load welcome banner and Player prompt, loads how to play output As Expected
Press enter to continue, and press enter again to not load score table Loads see saved score prompt, loads goodluck banner and first riddle As Expected
Randomly Selectect Answers To 19 Riddles Diplay Outputs According to Correct, or Wrong Answers, Loads Save Score Prompt As Expected
Enter Last riddle Correct ouptput shows depending in Answwer given, Final Score output shows, See Saved Scores prompt As Expected
Press Enter To Skip Save Score Loads See Saved Score Prompt As Expected
Press Enter To Skip See Saved Score Score Loads Play Again Prompt As Expected
Press Enter To Skip Play Again Prompt Loads Thank you for playing Output, Game ends As Expected

Validation

Validation

Technologies

  • Python is the main programming language to produce the game.

  • rich was imported.

    • Table - To create the table in Saved Scores.
    • Box - For the outline of the table in Saved Scores.
    • Console - For the colour styling for the output to the console.
  • random was imported to handle the random numbers to select the riddles at random.

  • gspread was imported to handle the access to the google sheets data.

  • google.oauth2.service_account import Credentials was used to handle the access to the google drive where the google sheet is stored.

  • LucidChart used to create the flow chart showing the game's functionality and flow.

  • GitHub was used to hold the game repository files.

  • Gitpod was used for the coding environment.

  • Heroku was used to deploy the game to the web.

  • NHC Debut Video Capture used to screen recored the game play for gif.

  • To create the gif ezgif.com was used

Deployment

1 - Version Control

Verion controle was maintained using GIT within GitPod to push code to the GitHub repository

  • From the Gitpod terminal use "git add ." which tells git you would like to make changes/updates to the files.

  • Then use "git commit -m " with a comment, this will commit the changes and update the files.

  • Then using the "git push" command this will push the committed changes to your GitHub repository.

2 - Page Deployment

  • Go to Heroku and log in

  • click "New" to create a new app from the dashboard

  • Choose app name and select your region, press "Create app".

  • Go to "Settings" and navigate to Config Vars.

  • Add Config Vars.

    • This app used two
      • One for the credentials to allow access to the google sheets. KEY = CREDS : VALUE = CREDS.json content.
      • Second KEY = PORT : VALUE = 8000.
  • Add buildpacks Python and NodeJS in this order.

  • Now go to the Deploy tab.

  • Scroll Down to Deployment Method and select GitHub.

  • Select repository to be deployed and connect to Heroku.

  • Now Scroll down to depoly :

    • Option 1 is selecting Automatic deploys (Will Update Automaticly when every git push to the repository).
    • Option 2 is selecting Manual deploy (Needs to be redeployed after every change manually via Heroku deploy tab).

Visit the live deployment HERE.

3 - Cloning Repository

  • To clone the repository for download or use within your GitHub head-over to this link

Credits

  • I used Rich from this link here for References rich.readthedocs

  • The use of the Code Institute love_sandwiches walk through project for the linking of the google sheets

  • I used python.org for References for the Pyhton code and functionality

  • I used w3schools for References for the Pyhton code and functionality

  • I used stackoverflow for References for the Pyhton code and functionality

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published