When I created my first Alexa skill Craft Helper, a Minecraft Assistant, I knew I also wanted to make a trivia game based on the data I compiled for that. For a while it was simply going to be part of Craft Helper, I quickly found out it would be better as a separate skill that can exist independently of it.
Randomized QuestionsOne major requirement of the Mine Quiz is that there would be no pre-written questions. Everything would be dynamically generated so no two games would ever be the same.
- First a recipe is randomly selected to turn into a question.
- Then it randomly selects whether the question will be a true/false or a multiple choice.
- If it's a true/false question then it will determine if it should have true or false as a correct answer. If it's true, then it simply generates the question. If false, then it moves onto the apply modifications step.
- Modifications are only needed for multiple choice and false questions. Each modification type will look at the recipe and determine what adjustments it will make to create the question. A modification could be changing the crafting result, changing an ingredient, removing or adding an ingredient, and even changing ingredient amounts.
- Once it has all the modifications that can be used for the recipe, it chooses a random one. For this part it will create an invalid recipe for false questions. If it's a multiple choice, it will make a modification, then add several invalid options to be chosen from.
- After this it generates the question and passes it back to the game to use.
The first edition of Mine Quiz was a simple one player game. This allowed a player to answer 10 questions and at the end it would tell them how many they got right. This was a good beginning but I wanted it to be multiplayer too.
Echo Buttons VersionTo enable it to support buttons I looked toward the sample skill published on GitHub by Amazon. Using this as a base I integrated my dynamic question generation into it to create the current version of Mine Quiz. There were several modifications that were needed to make this functional, since the base used static questions.
- Remove static questions file and all references to it and ordered questions.
- When a question is needed, call my question helper which will pass back a question, the correct answer, the correct answer as a string if it's false, and a few incorrect answers for it to randomize with the correct answer.
- Modify the question result to say the correct answer string if there is one. This is only needed for false questions.
Future versions of Mine Quiz will support more features like the following.
- Multiple choice questions
- Button-less multiplayer support
- Ladder/Endless mode
Single Player Example
Multiplayer Example
Comments