When I was growing up and learning addition in elementary school, we played all the same, boring games to drill simple addition facts into our heads. The games felt terrible, and if you played one, you essentially had played them all. I wanted to change that. The generation of kids that are learning these facts today is the generation of the future. They have to stay engaged and interested in learning, and the best way to promote an interest in learning is by making learning fun. So that is what I tried to do with Robbery Math.
Another piece of motivation for me to make this project was the fact that I would learn how to use AWS Lambda, the Alexa Skills Kit, and just the Alexa interface in general. My family enjoys programming for fun, and I enjoy learning more about the code. The constant problems to troubleshoot were difficult to solve, but they made me think, which I believe is very important. It’s necessary to challenge yourself as much as possible to push yourself to be the best you can be. I challenged myself to complete this project, and that is exactly what I managed to do.
What it does
This is an engaging skill geared towards children working on learning addition. It is meant to be provide fun and helpful math review by presenting a scenario. The user is an agent, and "Captain Alex" gives the user math problems to work towards catching three robbers. By getting a question right, the user gets a point, and if a question is answered incorrectly, one of the robbers escapes. This method is used instead of losing lives, and meant to keep the user engaged in the activity.
How I built Robbery Math
The Amazon Alexa Skill "Robbery Math" was built with JSON and node.js. I used a basic template provided by Amazon on GitHub, and then expanded upon that. After working on the project for many, many hours, very little of the code is the same as it was on the template. I changed a lot of code, added the wrong answer element (see below), and generally made it work much better for my needs. The template was not meant for the sort of game that I made, so I dove headfirst into the code and made it more suitable for my game.
The first thing I did was outline my plan. I am a big fan of organization and outlines, so I organized everything to the best of my abilities before beginning the actual project. I figured out all the problems, all the answers, potential variations of answers, and the outline for the project, all before I opened a single file for coding. I had countless documents full of tables organizing some thing or another, yet they all had a very specific overall purpose: they made me much more organized so I knew exactly what I was doing. This is also beneficial because rather than having to come up with the ideas for questions and answers while I’m working on the code, I could just copy and paste them into the files.
My next step in this project was coding the actual program. I began by changing the JSON file that contained the prompts given by Alexa and the utterances that the skill recognizes. If these utterances are recognized, the skill goes to the next scene, and reads the next prompt. This was the easiest part of the project. I then went on to build the interaction model, and tested it for the first time. I was very excited about the progress I made, and then it didn’t work. So I worked on fixing the problems that arose. When I eventually the skill working again, I started making the “UnrecognizedIntent” lead to the scene for the wrong answer if called (see Challenges I ran into below for more details on this).
Challenges I ran into
The biggest problem that I had while making this program was figuring out a way for the program to react to incorrect answers, and make the user lose a life. I thought about making an intent that had all possible wrong answers, but quickly decided against that. I ended up using an "Unrecognized Intent" to my advantage. When called, I previously had the intent say "I'm sorry, I didn't catch that. Please repeat your command." Instead, I dove into the code, and made it go to different parts of the game based on which scene it was in. Each question asked is in a scene, and each scene leads to other scenes based on if the question is correct or not. I changed the code so the "Unrecognized Intent" leads to a different scene if the response is not recognized. After doing this, the program worked flawlessly!
Another major challenge that I ran into was the fact that usually when I fixed one error, three more things would break. There were times where I spent an hour working to fix one thing, only to break three others once I fixed the first, or I would modify something, breaking a couple other things in the process. One of those big examples was when I made the program give an encouraging response for correct answers. However, in doing that, I messed up the LaunchIntent, making it not recognize the beginning of the game, and the program would not generate a response. I fixed it, multiple times, but doing so took a lot of time and energy.
Accomplishments that I'm proud of/What I learned
Whenever you work on a project, there are certain achievements you end up being proud of. In this case, I learned the basics of JSON and node.js interaction, and was able to extend my knowledge on AWS Lambda, AWS DynamoDB, and the ASK (Alexa Skills Kit). These topics I gradually began to understand, and yet am still learning about them. This project taught me a lot about how all the different parts of the program work together to make an interactive, entertaining, working game.
What's next for Robbery Math
After getting Robbery Math published on the Amazon Alexa Skill Store, I felt pretty much done with Robbery Math. However, I am still hoping to update the code occasionally, and might change some of the questions at times to keep the program interesting. Nonetheless, Robbery Math likely will not go through any big changes in the near future.