Euro 2016 may have been a little disappointing and flat (especially for England fans), but the same can’t be said for the Scott Logic Euro 2016 table football tournament. It’s the third annual competition held in the Newcastle office and as ever, it was full of surprises and enjoyment; 32 players battled it out to be crowned champion (and have bragging rights until the next noteworthy sporting event). Each player was randomly assigned a team from the real tournament, and matches were more or less synchronised with when your host nation played. The competition was so popular that we had to introduce eight additional teams in the form of micronations such as The Principality of Sealand and Frestonia.

One of the annoyances in the previous two years was organising matches, recording results and pestering people to get their matches played! These were all tasks that technology could easily solve for us, so this year we decided to use the competition to gain experience using new and exciting technologies. Slack is gaining widespread adoption globally and bots are becoming a big talking point in the tech world, so we decided to create a Slack table football-bot, affectionately known around the office as MottyBot, after famed football commentator John Motson.

Mottybot_capture_1-1.jpg

See MottyBot in action here.

Bots it all about?

Coupled with the rise of bots there has been a massive surge of interest in natural language text processors, or parsers, with Facebook’s Wit, Google’s Parsey McParseface and many others still in development. We wanted our bot to be easy to talk to, so incorporating a natural language parser would allow us to gather information using specific commands. To make quick progress we used several packages to handle the core functionality: Botkit provided easy integration with Slack, and Microsoft’s recently released Botbuilder provided integrated access to its natural language parser LUIS.

With these packages as a foundation, we quickly enabled the bot to record results, display upcoming matches and post new results to the main table football channel. Thanks to LUIS, people were able to interact with these core features in a natural way, talking to the bot rather than issuing instructions. There were plenty of features we still wanted to add, as well as challenges caused by working with emerging technologies. On several occasions LUIS, which was in beta, suffered outages and the bot failed as a result. Alongside that, the two bot kits were so new (Botbuilder was only three weeks old when we started), we had to inspect their code to understand or find functions and communicate directly with the developers to get help or report bugs. Working with such young technologies was certainly challenging, but it felt great to be part of such an early stage in its development.

Bot’s next?

One of our main goals was to make the bot feel less bot-like. Having the bot understand natural language helped with this, but only with one direction of the conversation. We worked hard to train the parser to interpret incoming sentences, but if the bot always replied with the exact same messages and only spoke when spoken to, it would still appear robotic. We solved this by introducing a great deal of randomness to the bot’s communication. This made it increasingly difficult to test.

For every possible function we provided a plethora of replies the bot could randomly pick from and personalise. We also added functionality to allow it to react to simple things such as “hello” and “thank you”. As well as randomising the responses, we gave the bot the capability to initiate posts, sending gifs, jokes and news stories randomly throughout working hours. This helped give the impression that it was active and not just waiting for people to talk to it. In the end you could have an interesting, albeit table football-based conversation with the bot.

Woops - botty mouth!

When it came to releasing the bot we quickly realised how differently everyone speaks. The bot had been trained to understand as many different ways to be asked and told things as we could imagine, and we were pretty confident in how it would perform. Within the first few hours we realised how wrong we’d been. LUIS made it easy to examine incorrectly parsed sentences and correct them, so the more the bot was used the better it became. It wasn’t long before MottyBot started to understand everything again, but this exposed him as a bot, and limited the user interactions we received.

One unintended effect of MottyBot’s randomness was that he could be inappropriate. While his replies were specifically written by us, his joke and gif sources were scraped from rss feeds and websites. We checked these to ensure they were appropriate for the workplace, but one slipped past us. We quickly implemented a censorship feature that made the bot check with us whether a joke was ok to post. After Microsoft’s bot which went a little too far, we’re in good company, but it’s a cautionary tale for those giving their bot too much freedom.

Bot's all folks

The bot was initially a two week exploratory project to see what could be accomplished, but as we made good progress we were given extra time to complete the bot and implement additional features people had requested.

Given the experimental and fast paced nature of the project, our choice of LUIS as a language parser was driven by its easy integration with the Botbuilder SDK. Given more time it would’ve been interesting to look more closely at the other parsers available such as Wit or API.ai. If you’re interested, our UX team has been looking at language parsers and Graham Odds has written a couple of blog posts on their possible applications.

We had a lot of fun developing our bot and, more importantly, we gained a great deal of knowledge about bot development and language parsing. We also experienced what it was like to work with constantly changing requirements to a tight deadline. The Scott Logic Euro 2016 table football final took place at our Friday Bar last week with an end result of 6-3 to England. Congratulations to Ali Sheehan-Dare who is now the official Scott Logic Euro 2016 table football tournament champion of 2016!