Create a Rock-Paper-Scissors game with Chatbot

Norfa Bagas
2 min readApr 15, 2020

--

Rock-Paper-Scissors illustration

If you ever feel bored and don’t know what to do, then I recommend you to play a Rock-Paper-Scissors game. But how if your friends are so busy and nobody wants to play it with you?

So, let’s build a Chatbot that can change your friend’s position when playing the Rock-Paper-Scissor game.

This Chatbot is built using IBM Watson Assistant. It is a great service that can allow the developers to get Natural Language understanding (NLU) so we just need to focus on making the dialogs for our Chatbot. Here is the demo of the Rock-Paper-Scissors Chatbot game.

First, create a new Watson Assistant service by following the official tutorial from IBM:
https://cloud.ibm.com/docs/assistant?topic=assistant-getting-started

Learn more about IBM Watson Assistant here:
https://developer.ibm.com/articles/introduction-watson-assistant/

After having an empty assistant, let’s move to create intents, entities, and dialog parts.

Create Intents

We will use 3 intents for our Chatbot

  • #accept (Accept to play the game)
  • #decline (Refuse/decline to play the game)
  • #play_game (Asking the assistant to start the game)

Create Entities

We only need to create 1 entity. I named it @choice. In our entity, define value for Rock, Paper, and Scissor.

Create Dialog

Here is the flowchart of our Chatbot

To use this skill, check out the source code:
https://github.com/norfabagas/rock-paper-scissors-watson-assistant

Alright, let’s create your own Rock-Paper-Scissors game and now you can play Rock-Paper-Scissors alone.

--

--

Norfa Bagas
Norfa Bagas

Written by Norfa Bagas

Software engineer. I also do some research related to Computer Vision and Artificial Intelligence

No responses yet