Alternatively, join us on Discord.

+-Recent Topics

prgmERMINE: The Sassy Chatbot

Started by Woodrow, January 19, 2018, 06:15:41 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


The original prgmERMINE was made a few months back on the way to Domino's Pizza. I showcased it (her?) at my school's STEAM club a few days(?) later. The reception was pretty good.

Here's the basic format for the code:

Input "CHAT: ", Str1
If Str1="INPUT":Output(1,1,"OUTPUT")

However, this gets really annoying when I have to type my call/response formula over and over again. Another big annoyance is accepting different inputs for the same output.

If Str1="HI" or Str1="HELLO" or Str1="HEY":Output(1,1,"HEY, NERD. "

My main goal here is to:

- Find a way to solve the aforementioned problems
.emaG ehT esol won lliw uoy ,siht gnidaer rof tnemhsinup sA


January 19, 2018, 08:16:31 pm #1 Last Edit: January 22, 2018, 06:46:38 pm by JWinslow23
Hm, interesting. I did a similar project to yours in middle school for my own amusement, using the same method as well. In my junior year, in the tail end of 2016 I made a new scheme for a similar idea, and a year later I made a game with this same engine. I'll see if I can show you what I did to improve my system through the years.

What I ended up doing for processing string input is taking each space-delimited word and looking it up in a little "table" of sorts (which also has synonyms and some misspellings), and checking for a certain list of words in order to give a response. This allows much flexibility in what one can enter.
For example, "WHAT ARE YOU CALLED" might be transformed into "398C" after the words are looked up, as would "WAT R YA CALLED" or "WUTZ R U CALLD". Checking to see if it was transformed into "398C" checks for those and more with one command.

Keep in mind, this was my own method, and perhaps this would be either too hard or too overkill for your purposes. A simpler way to allow a bit more flexibility with input is to do the following:
" "+Str1+" "->Str1
If inString (Str1," HI "):Then
Disp "HEY, NERD."

assuming Str1 contains your input. This would allow the same response for "HI", "HI THERE", "OH HI ERMINE", and much more, but not "I LIKE THIS" (a string that simply has H and I in that order).

As far as producing different outputs, you might want to look into randomized output. Come up with a bunch of different responses, and then do this:
If inString(Str1," HI "):Then
If R=1:Disp "HEY, NERD."
If R=2:Disp "OH, HI."
If R=3:Disp "YO, DUDE."

This code has a 1/5 chance of returning "HEY, NERD.", "OH, HI.", "YO, DUDE.", etc. There are quite a few ways of optimizing this, but for now I'll leave this as an exercise to the reader ;)

One last thing to consider: you cannot possibly code for every possible input individually, but the chatbot should respond to anything inputted to it. To handle this, perhaps code in some catch-all messages for when no pattern was matched. Here's the way I'd do that:

If inString(Str1," HI "):Then
"HI code here
Goto E

Repeat 1
"catch-all code here
Lbl E

This jumps past any other command checking so it doesn't respond twice, and it allows for the chatbot to respond to literally anything, even if it doesn't understand it.

I hope this helps you improve ERMINE!


Thank you so much! prgmERMINE has always taken up the most space on my calculator. People ask me why I don't just code it on a computer, and I quote the late JFK:

QuoteWe choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard[....]


he gave such great speeches even towards the end of his life omg
.emaG ehT esol won lliw uoy ,siht gnidaer rof tnemhsinup sA

Powered by EzPortal