Skip to content

CI-Tom/pub-quiz-challenge

Repository files navigation

Pub Quiz Challenge

Overview

A Python terminal game for uesers to test their knowledge in 5 areas: -

  • Science
  • Sports
  • Movies & TV
  • Music
  • History

Game developed by Tom Manahan for Code Institute Project Portfolio 3 using Python.

Live Game Link

Home Screen

Table of contents

  1. How to play

  2. Project Goals

  3. Features

  4. Future Features

  5. Technologies

  6. Flow Chart

  7. Testing

  8. Deployment

  9. Credits

  10. Acknowledgements

How to play

The Pub Quiz Challenge is a basic terminal game designed to test user's knowledge in the style of a pub quiz.

There are five ares of expertise to choose from.

At the the start of the game the user is presented with the welcome screen and asked to enter their name.

Once a name is entered, the user must then select form the list of five topics to start the game.

The game presents the user with a question and three options to choose from for the answer.

The user must select an answer from the options by entering A, B or C.

A message is the displayed to let the user know if they are correct or not, and the score increments by 1.

When all questions are answered, the total score is displayed as a percentage of correct answers and the user may select to play again or quit.

If play again is chosen, the quiz restarts and the user enters their name again and has the option to pick the same or another topic.

Top of page

Project Goals

This project was created for Code Institute's full stack software development course for Portfolio Project 3

  • Main goals

    • Create a functional terminal game using the Python language.

    • Make the game user friendly and easy to understand while still presenting a challenge

    • Implement technologies learned from the Python module such as Lists, Dictionaries, functions etc.

  • Target audience

    • Users with an interest in quizzes

    • Users who want to test their general knowledge

    Top of page

Existing Features

Welcome screen

When the 'Run Program' button is clicked on the Heroku mock terminal screen, the user is presented with the start screen.

The start screen features a "Pub Quiz" ASCII text message and a message welcoming the user and asks the user to enter their name.

  • When the user enters their name, they are then presented with a message to select one of 5 topics.
  • The user inputs 1,2,3,4 or 5.

Topic selection

The user is presented with a message displaying their choice.

The quiz then starts and presents the user with the first question from their chosen topic with the three possible answers.

All questions and answers are stored on a Google Sheets worksheet and accessed through the Google Cloud API services.

Credentials are stored in the creds.json file to allow access to Google drive and spreadsheets from the app.

Question and Choices

After each question is answered, a message is displayed telling the user if the chosen answer was correct or incorrect.

The quiz then moves on to the next question and this pattern continues until all questions are answered.

A this point the user's score is displayed and the user is asked if they would like to play again.

If 'Y' is entered, the quiz restarts and the user enters their name again and selects the same or a new topic.

If 'N' is entered, a 'Goodbye and thanks for playing' message is displayed and the application stops.

Score and End

Clicking the 'RUN PROGRAM' button will restart the application again.

Top of page

Possible Future Features

Some possible features that could be implemented into the game in the future are

  • Add a leaderboard using player names and scores

Top of page

Technologies

Platforms

  • Python was the programming language used to create this project.

  • Heroku was the platform used to deploy the project.

  • GitHub and Git were used for version control on the project.

  • Gitpod was the I.D.E used to create the project.

Python Modules

Top of page

Flow Chart

The flow chart below represents the structure of the quiz application and how each feature interacts.

Flowchart

Top of page

Testing

Validator Testing

  • PEP8online Python validator link on the Code Institute Portfolio Project Scope page would not work for me and just brings me to a page with ads

Python validator

  • No errors or warnings were found when putting the code through the CI Python Linter

Linter

  • Also no errors returned when checking syntax on Python Syntax Checker

Syntax checker

Bug testing

  • At first there were a lot of "line too long" errors which were solved either by shortening lines of code, where possible, or rewriting code in a different way i.e. creating nested lists.

  • Had an issue when testing on Heroku where text was not displaying correctly and went back through the Love Sandwiches walkthrough project and found that the new line method was required at the end of input methods

  • Fixed bug where program restarted if incorrect topic was selected. Now the user is notified of an incorrect entry and given the option to choose again.

  • Fixed bug that accepts empty/invalid entry for name. User is informed that there must be an entry and it must only consist of letters. The program also requires a minimum of two letters to be entered.

  • Fixed bug that accepts empty/invalid entry when asked if the user wants to play again. User is informed that only Y or N is accepted(lower case is also accepted).

  • Fixed bug that accepts empty/invalid entry when entering an answer selection. User now receives invalid entry notification and the option to enter the answer again.

Top of page

Deployment

This project was deployed to Heroku using Code Institute's mock terminal.

  • Steps

    • Go to Heroku and click on the new button at the top right of the page. Select create new app from the dropdown menu.

    • Enter a name, change region to Europe and click create app.

    • Go to settings and select Config Vars

    • Locate Buildpacks and add Python and NodeJS in that order.

    • Add a new Config Var with a keyword of PORT and a value of 8000

    • Exit settings and click Deploy. Select GitHub from the deploy options.

    • Select your repository and connect it to Heroku.

    • Click Enable Automatic Deploys in the automatic deploys section or make sure main branch is selected and click Deploy Branch in the manual deploy section.

    • The live version of the app can be found here Live Game Link

Top of page

Credits

  • fun quizzes used to get questions and answers for different topics

  • The template used for this project was the Code Institute python essentials template found Here

  • The flowchart used in this project was created on Lucidchart

  • Validation was done using the CI Python Linter found Here

  • The idea to use a Google worksheet to store the quiz questions and answers was from the Code Institute Love Sandwiches walkthrough project

  • Stack Overflow was used for solutions for various bug fixes.

  • W3Schools was used for research on various syntaxes.

  • This readme structure was adapted from my classmate Sean Johnston and the Code Institute's Ultimate Battleships readme template

Top of page

Acknowledgements

  • To the slack community for all the help and support throughout the Python module and project.

  • To my friends and family for all their help and support.

Top of page

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages