How aayantasneem/quiz-game works
Main Components
a. User Interface (CLI) – handles input/output via the terminal.
b. Quiz Engine – core logic that drives question selection, shuffling, input validation, and score tracking.
c. Data Loader – reads quiz questions and answers from the CSV files in the data/ directory.
d. Score Tracker – maintains the current score and produces the final result summary.
e. Result Presenter – shows correct answers and final score at the end.
Relationships and Data Flow
• The User (player) issues commands (start game, choose category, answer A/B/C/D).
• The CLI component captures that input and forwards it to the Quiz Engine.
• The Quiz Engine invokes the Data Loader to fetch and shuffle questions from data/python_quiz.csv, data/math_quiz.csv, or data/sql_quiz.csv.
• Each question → CLI → User’s answer → Quiz Engine → Input Validator → Score Tracker (updates score) → CLI (feedback).
• After all questions, the Score Tracker passes results to the Result Presenter, which outputs final score and the list of correct answers.
Architectural Patterns & Design Principles
• Single‐process, procedural flow with clear separation of concerns:
• I/O layer (CLI)
• Business logic layer (Quiz Engine & Score Tracker)
• Data access layer (CSV Data Loader)
Technologies & Libraries
• Runtime: Python 3.10
• File Handling: Python’s built-in csv module
• Data Structures: Lists & Dictionaries for question/answer storage
• Control Flow: Loops (for, while), Conditionals (if/else)
• Clear labels: “CLI Interface”, “Quiz Engine”, “Data Loader”, etc.
• External actors: “Player” on the far left.