The idea behind Times Table Madness was to make it fun and exciting for kids to practice their times tables. I wanted to build a skill that moved away from the usual repetitive questions that can quickly bore both children and parents to tears. My aim was to create something that really entertains kids, and also genuinely helps them to learn.
So, I thought about the different ways I've tried to motivate my own children over the past few years, when there’s a task they really don’t want to do. Two things came immediately to mind:
- Make the task funny, wacky or absurd; or
- Make it into a competition or a race.
So that led me to Times Table Madness - a wacky times table game that lets you see how quickly you can get them all right.
What it does
Times Table Madness asks you to answer six wacky times table questions, such as, "What is ten times eight pineapples?” or, "What is seven times twelve smelly socks?" To score points you need to answer with the correct number and silly item, such as, “Eighty pineapples,” or "Eighty four smelly socks."
When you open the skill, Alexa gives a clear explanation of what will happen and how you need to phrase your answers. She then asks you to choose a times table to be tested on. To take a times table challenge, you need to say, "Test me on [seven]" (or any other number you choose). You can ask Alexa to test you on any times table, so if you really fancy a challenge, you can test your skills on the 256 times table or even higher.
After you have answered all the questions, Alexa gives you a final score and tells you how long it took you to answer all the questions. Depending on how well you scored and how quickly you completed the test, she will give you one of four comments. For example: "You got them all right, and that was really fast too...well done!" or "You didn't get them all right. Try slowing down a bit until you know them all really well."
When the skill ends, Alexa tells you that you can try the quiz again by saying, "To play again, say...Alexa... ask times table madness to test me on...and then a number of your choice." This allows users to skip the more detailed introduction that they received on their first attempt.
How I built it
I used the Alexa Skills Kit to develop the Voice User Interface. This ensures that Alexa can understand when a user tells her the times table they want to try, or provides an answer to a times table question. I used the ready-made amazon.number slot-type to ensure that she could recognize any number that a user might wish to attempt.
My lambda function uses node.js. I used the “Quiz Game Skill” demo, available on the Amazon Developer website, as a template to get started.
I made sure that all descriptions and messages Alexa could say were in clear language that kids could understand. I also chose a number of silly objects that Alexa could say clearly in both American and UK English.
When the user expresses an intent to start a times table test, the code stores the number they ask to be tested on as a session variable. It then creates a random order for the questions, so that Alexa doesn't just ask "what is 1 times x", then "what is 2 times x", and so on, every time you play. The code also ensures that the same times table can't be asked twice on the same test.
At the time the player starts a test, the code also retrieves a timestamp from the intent, so it can calculate the time taken to complete the quiz once all questions have been answered.
The code then generates a question based on the times table requested by the player, the random order of questions generated earlier, and a random object from the list of silly objects. It also generates a correct answer to the question, which is stored in the session attributes so it can be retrieved when a player answers.
When the player answers, the AnswerIntent code is activated, which retrieves the correct answer and compares this with the player's answer. If the player is correct, the 'score' (also saved as a session attribute) is increased by one. If incorrect, Alexa tells the player what the correct answer should have been.
Once the counter reaches six (this is set to zero when the test starts and increases with every question), the question-answer loop ends and the code calculates a final score and the time taken to complete the test (the difference between two timestamps). The code then tells Alexa to read out the final score, time and invite users to play again.
Challenges I ran into
I'm very new to building Alexa skills, so to be honest, everything was a bit of a challenge.
Some of the most memorable challenges were:
- Working out how to extract a time difference from two timestamps in the format that Alexa provides them;
- Creating the random ordering for the questions and ensuring there were no repeats.
There were also some challenges I couldn't overcome. For example, I'd have liked to make it possible for the user to respond with just a number (rather than also saying the silly object) if they preferred. However, I couldn't find a way to do this whilst also using Alexa’s 'required slots' (which ensure that Alexa actually hears a meaningful response from you). It seems that these two features aren't yet compatible on Alexa - it's one or the other.
Accomplishments that I'm proud of
I only started writing Alexa skills in December, so I'm really pleased to have completed an entry for this competition. I think it's a fun skill that kids will enjoy playing, and hopefully they'll learn something too.
What I learned
I also learned that coding for a voice interface is utterly different from coding for a visual interface. With a website, the user can see lots of information at any given time, and can refer back to it as often as they like. With a voice interface, once something has been said, it can no longer be seen or heard. This totally changes the way developers have to interact with users. Clear messages in relatively short chunks are absolutely essential.
What's next for Times Table Madness
I'd love to add more features to this skill. My top few would be:
- Give kids the option of whether to do a silly version or a normal version of the test;
- Allow a choice between 'learning' a times table and 'practising' a times table;
- Add in some more jokes and silly features to make it even more fun.