I wanted to build an engaging Alexa-skill game for young children that also exercises their minds. I believe that interacting with Alexa is much better for a child than sitting in silence looking at a computer screen by themselves, which is becoming more common in their everyday lives. Playing an Alexa-skill like Categories forces children to practice their listening, speaking, and critical thinking skills.

What it does

Categories is a classic odd-man-out game designed specifically for young children. Once a Categories game is started, Alexa will repeatedly give the user a list of four common words but one of them will not be associated with the other three. An example list of words would be [dog, cat, apply, bear]. Because 'dog', 'cat', and 'bear' are all mammals and 'apple' is a fruit, 'apple' would be the word that doesn't belong.

Once Alexa gives the list of words, the user must reply with the answer is {word}

How I built it

This is a typical Alexa-skill built through the Alexa developer's portal and a lambda function written in python. Once the skill is called and the game is started, the user enters a continuous session going back and forth with Alexa as she asks questions. In order to check answers and teach users categories that they are not familiar with, I save the question, answer, and category in the session (so the skill has a small amount of "memory" to it). In order to save the session, I store the session attributes inside a small dictionary which is passed back and forth between the lambda function and echo.

Challenges I ran into

The biggest challenge I had was the corner case of the user saying a phrase that is not allowed in the game. When you set up an Alexa-skill, you must create 'Intents' for phrases that the user may say as the go through the game. If the user says an incoherent word or there is chatter in the background, Alexa defaults to a random Intent (for me it was the 'Start Game Intent'. To combat this problem, I made an 'Error Intent' which is programmed to expect incoherent/nonexistent words. After incorporating this intent, it seemed to become the default intent for bad user inputs and solved all of my corner cases.

Accomplishments that I'm proud of

I'm most proud of my random choosing algorithm for the list of words. First, I created a pickle in python of a dictionary containing all of the different categories and their corresponding words. This cut down on the time it takes to generate the list of words sent to the user. Secondly, I designed the choosing algorithm so that it is dynamic. The list of words sent to the user are not static or hard-coded. Instead, the function chooses a random main category (choosing 3 random words from that list) and then a random answer category (choosing 1 random word from that list). It then combines those words into another random list and sends those along to the user. The number of items in each category range from 3-10, so you can often see the same category but have different words from it.

What I learned

I was already familiar with many AWS services before starting this project, so learning how to build an Alexa-skill was relatively easy and fun. One skill that I did not expect to learn was networking. Working in the Alexa development environment introduced me to networking, sockets, and server frameworks such as Flask. It is really cool technology and got me very interested in smart technology. This is the first Alexa skill that I ever created. I learned

Share this project: