The game is based on the classical word game, that probably most of us have played in kinder-garden, at school, on gatherings with friends or on road-trips. Players take turns in coming up with words, from a specific category, that begin with the letter that the previous word ended. It's a fun way to build up and refresh your vocabulary.

I thought that Alexa's VUI is a great fit for a game like word chain. Alexa can be a referee, validating the words are correct and not used, and it can be a fully qualified player that can play with us to build the longest word chain, or competing with us, depending on the mode.

Note: in this text when speaking about Alexa in 3rd person, we mean the player that the voice interface is impersonating.

What it does

It allows the user to select the category that will be used for the word chain. We can also specify other people around us that will play, more players - more fun! After every player introduces themselves, including Alexa, we can select a game mode. 2 modes are supported, competitive and cooperative.

In order to be more challenging, all words are shuffled from the beginning of the game, so Alexa will often pick different words in different games. In order to make games more interesting it also picks words by a specific algorithms, described in Challenges I ran into

If a player does not know a word, she or he can skip it's turn. If the game mode is competitive, skipping a turn will lead the player forfeiting the game. When there is only one player left or no other possible words to pick from the game is completed.

Once a game is completed you will be presented with the whole word chain in the Alexa companion app. It is useful if you want to share your success or learn words that you were not able to guess.

It also keeps track of the played games and can statistics for them can be presented, once you say Alexa, ask Word Chain to show me my stats.

How I built it

It is built with Node.js using the Alexa Skills Kit SDK, based on Amazon Lambda. It includes large list of words, for the following categories: countries, capitals, animals, fruits and vegetables, built up from Wikipedia and other open thesaurus web sites.

Other than that, I am using classical string manipulation algorithms to pick the right and most appropriate words (see Challenges I ran into)

Challenges I ran into

There were few phases of the game that introduced interesting problems

In competitive mode Alexa could easily beat novice and intermediate players

This was caused mainly by the fact that she knows 100% of the thesaurus available for a given category. This would easily turn down players without even giving them a chance to learn new words.

So how we solved it? We restricted Alexa's (the player) knowledge to a fraction of all the words, initially only 70% of all of them. With that she can validate any word said by a player, but she will not be able to use all of the words when it's her turn. This makes things more realistic and gives a chance to novice and intermediate players to become better. Now of course this will turn down the more skilled players, so we added this auto-configure option, once you beat Alexa, on the next game she will be better, using more available words, eg. 70% + 2%. When you win again, it will become 72% + 2% and so on up to 100%. The same when a player loses, Alexa will adjust it's available thesaurus.

In cooperative (and competitive) mode, Alexa picking a random word that satisfies the rules is not the best approach for a better and longer game

The target of this game is to have fun, to build a long word chain and learn new words. This is why the game should be a long as possible and why we built Alexa to pick the next word in such a fashion that it gives more options to the other players. E.g. if it can pick between two words, both starting with the right letter, then we should ask ourselves, if one is picked, how many options the player will have vs if we pick the other. This also includes checking already played words.

Doing only this, however, led us to the next problem

In cooperative (and competitive) mode, Alexa picking the word that ends with a letter, that many other unused words start is also not the best option.

This can be very nicely shown in the countries category. There you can easily observe that a majority of the countries start with the letter 'A', but what's more interesting that almost all of them also end with the letter A. And in addition there are also quite a few other countries that also end with the letter A. That means that we can very easily end up in "A" letter words loop, that is hard to break out. We have ran thousands of simulations and games almost every-time end up after one have gone through all A words and have no other options left.

So we solved it by learning about such words, and making Alexa drive the user to pick up other words, when it is possible. Inevitably we can end up in the "A" letter words loop. If possible we will try to break out. If not, then our best strategy is to call out all words until we run out of options.

Of course it has been generalized this and is irrelevant of the category, we observe the properties of the thesaurus and make decisions based on this.

Accomplishments that I'm proud of

I'm proud that we were able to bring the classical word chain game to a next level with Alexa's Voice User Interface, while still allowing the flexibility of the original game where it can be played by any number of players and having the option of the two game modes, competitive and cooperative.

What I learned

I learned how to build multi-step interactive VUI, how to wait for user input that could take longer than the usual answer timeout. How to be able to resume the interaction from any point and how to handle unexpected intents.

What's next for Word Chain

Word Chain definitely needs more categories, as we already got the feedback from users. I think that something valuable will be the option to create user-defined lists. This way you could engage your kids or friends to learn words in a certain area of interest while playing.

Built With

Share this project: