A CLI fun quiz app using node.js that tests how much of a potterhead you are!
-
- This is the main module that connects all modules and makes calls to functions in other modules.
- This module calls the
welcome()
method in thewelcome.js
module, which welcomes the user to the game. - The
questions.js
module contains 50 questions in the form of an array of object - The module then calls the
generateQuestions()
method in thegenerate.js
module, which generates 10 random unique questions and exports it. - The
quiz.js
module displays the 10 uniquely generated questions, allows user to enter their choice, checks the answer and also updates score. - This module also displays the final score card for the user, along with high scorers, and then exits the game.
- It also checks if the user is one of the high scorer by comparing the final score with that of the high scorers from the
highScore.js
module.
-
- This module has a
welcome()
method that asks for the user's name and then displays instructions after importing them from theinstructions.js
module. - The user is also asked whether they want to start the quiz or exit the game.
- The
welcome()
returns the user name and the answer to whether the user wants to begin the quiz or not. - Finally the module exports the
welcome()
method, which is invoked by theapp.js
module.
- This module has a
-
- The module stores 50 questions in the form of
array of object
which are exported to theapp.js
module.
- The module stores 50 questions in the form of
-
- This module randomly generates 10 numbers from 0-49 (inclusive) and selects those indices of objects from questions array of objects.
- Then exports these 10 questions as an array of object to
app.js
module
-
- This module has
quiz()
method that imports the 10 questions in the form of array of object from thequestions.js
module. - These questions are displayed to the user, and then user enters the choice of answer.
- This answer is checked with the original answer and the score is updated.
- The final score is returned to the
app.js
module where the final score is displayed using various styles fromCHALK
andboxen
. - The module also returns the number of questions user attempted, the final level of the user at the end of the game, and whether the user ended the quiz abruptly.
- This module has
-
- This module holds the high scores in the form of an array of object
- It then exports it to the
app.js
module, where the high scorers are displayed after the user ends the quiz.
-
- This package is used to add colors, styles and weights to plain console.log displays
-
- This package provides box like styles with padding, borders, margins, colors and backgrounds
-
- This package provides interactivity to have a conversation with the user via a console.
-
- This package provides spinners and loading objects to indicate a loading process.
-
- This package is used to clear the terminal screen or move the cursor position to the topmost left of the terminal (0,0).
- This is an MCQ based quiz on Harry Potter Books Trivia.
- Every question is played for 1 score, and there are no negative marks for incorrect answer.
- Correct answer is displayed after user attempts each question.
- There are 3 levels to this game: level 0, level 1, level 2, and level 3.
- Answer 2 questions correctly, user goes to level 1.
- Answer 5 questions correctly, user goes to level 2.
- Answer 8 questions correctly, user goes to level 3.
- Final score is displayed at the end of the quiz, along with the result if user is a high scorer or not.