We all encounter decision dilemma. Should I go to bed or study? Should I go to a career fair or go to class?.... When all of these questions pop out, you can just ask Coinflipper Bot to make a decision for you simply by flipping a coin! Moreover, Coinflipper Bot is also a coin expert. He can tell you many fun facts about coin!
Before I begin my project, I did research and found that there are a lot of coin-flipper apps. However, coin-flipper is a too simply to be an app. Users may be not willing to install an app just in order to flip a coin. A more efficient way is designing a chatbot for it. Based on this, I developed and designed Mr. Coin.
The main process including:
Design Bot Personality
Based on its core function, I mapped out Mr.Coin, who is an energetic and knowledgeable bot. This personality setting further defined its language style: using emoji and exclamation mark to leave an energetic impression to users.
Design Conversation Flow
Conversation flow mainly includes three parts:
On-boarding conversation helps users to know bot's core function quickly and establish the first impression of the bot. Task conversation is more straightforward in order to execute a task effectively. The comforting response is designed to adapt to when users' inputs are out of defined conversation flow.
Construct Function Matrix
I try to make Mr.Coin more interesting and interactive. So I come out with 3 core functions:
Flip a coin and show a random result
Tell fun facts about coin
Programming & Development
This part is time-consuming but also rewarding. By programming, debugging and iterating, I finally developed functional Mr. Coin.
A good way to do this is to pretend you are the bot and talk to a real user to find out what are their inputs and mental model while interacting with bots. Also, it is good to let people use your bot after development to have feedback on it.
Some feedback I found from user testing are they think bot's reply is a bit long and not interesting. So I drafted a more concise response and add some unexpected responses to make it more fun.
Use Twilio to send texts to users.
Use global arrays to store different kinds of input keywords
Use session to store user's information
Use file as a small database to store fun facts about a coin.
The main reflection of this project is that I feel programming capability have a huge impact in bot design. What I would do differently is to fully develop my own programming skills so that I can come out with more technically feasible designs.
def determin_response body
body = body.downcase.strip
media = nil
if str_check body,"hi"
message = "Hi, I am Mr Coin🤖. What can I do for you?"
media = "https://media.giphy.com/media/g0ym52S4egOMqG9oPY/giphy.gif"
elsif str_check body,"who"
message = "I'm Mr Coin🤖. I can flip a coin to help you make decision. I am also a coin expert! You can ask me anything about coin."
elsif str_check body,"what"
message = "I can flip a coin to make decision for you. Also I am a coin expert!You can ask me anything about coin."
elsif str_check body,"how"
message = "Type #️⃣flip to flip a coin. \n Type #️⃣funfact to get a fun fact about coin. \n Type #️⃣game to start a guess game!"
elsif str_check body,"when"
message = "I was made in Fall 2018 by Lingzhi Li on Programing for Online Prototype Course."
elsif str_check body,"why"
message = "That's a good question🤔. Where am I from?"
elsif str_check body, "flip"
message = $coin_sides.sample
elsif str_check body,"joke"
array_of_lines = IO.readlines("jokes.txt")
message = "there is a funny joke, " + array_of_lines.sample #retun is compulsory
elsif str_check body, "fact"
array_of_lines = IO.readlines("facts.txt")
message = "I found a fun fact about coin! \n" + array_of_lines.sample
#File.close #not sure if "file" should be uppercase
elsif str_check body, "game"
message = "let's play the game! I have flipped a coin🤛. Type 'heads' or 'tails' to take a guess!"
elsif str_check body, "heads"
message = guess_game "heads", $right_answer
elsif str_check body, "tails"
message = guess_game "tails", $right_answer
elsif str_check body, "bye"
message = "Nice to talk to you. Enjoy your Mini 1 break!!! Bye👋"
else message = $comfort_reply.sample
return message, media