Welcome to the Jeopardy Trivia Game! This project is a fun, interactive web-based game inspired by the classic quiz show Jeopardy. Players select categories and answer trivia questions to accumulate points.
- Dynamic Question Pool: Pulls trivia questions from a JSON file.
- Category Selection: Players are able to specify up to five categories to play each round, or they are automatically randomized each playthrough.
- Two Rounds: Includes Single Jeopardy and Double Jeopardy rounds with scaling points.
- Scorekeeping: Tracks player score across the game through single and double Jeopardy.
- Levenshtein-Based Matching: Evaluates similarity between user answers and correct answers for better accuracy, set to around 90% accuracy based match.
- Randomized Questions: Provides unique gameplay experiences in each round through random questions for each category.
- HTML/CSS: For the game's structure and style.
- JavaScript: Core logic, game flow, and interactivity.
- JSON: To store and fetch trivia questions.
To run this game locally, ensure you have:
- A modern web browser (e.g., Chrome, Firefox, Safari)
- A basic text editor (optional, for viewing/editing code)
- Clone or download this repository to your computer.
- Place the
questions.jsonfile in the/srcdirectory. - Open the
index.htmlfile in your web browser.
-
Start Menu:
- Choose up to five categories from the available list.
- You do not have to choose any categories, this is just an option to study specific topics/categories.
- Start the game to begin the Single Jeopardy round.
-
Single Jeopardy:
- Each category contains five clues each.
- Answer questions by typing your response in the input box and pressing submit or the enter key.
- You will gain or lose points based on correct or incorrect answers.
- Players must complete all clues to advance to Double Jeopardy.
-
Double Jeopardy:
- Questions in the Double Jeopardy round have double the point value.
- Play through another set of five clues per category.
-
Final Score:
- Players have the chance to view their total score at the end of the game.
- Statistics for each category
- There is also the option to restart and try again.
index.html: Defines the game’s structure and elements.style.css: Adds styling for the game.script.js: Implements game logic, including:- Category and question management
- Answer validation using Levenshtein similarity
- Gameplay progression and score tracking
questions.json: Stores trivia questions, answers, and point values.
setupGameBoard(data, roundMultiplier): Prepares the game board for each round by populating categories and clues.handleSubmission(clue, pointValue): Validates user answers, provides feedback, and updates the score.calculateSimilarity(str1, str2): Uses the Levenshtein algorithm to match player answers with correct ones.updateScoreDisplay(): Updates the score shown to the player.
This project is licensed under the MIT License.
Thank you to the creators of the classic Jeopardy game show for the inspiration. This project aims to emulate the fun and challenge of trivia!
Enjoy the game and aim for the highest score!