We're on Discord! Please join our server now if you don't want to miss anything! (More info) | Join the UCC4 contest! (More info)

* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: prgmERMINE: The Sassy Chatbot  (Read 2584 times)

0 Members and 1 Guest are viewing this topic.

Offline Woodrow

  • New User
  • Join Date: Jan 2018
  • Location: Miami, Florida
  • Posts: 11
  • Post Rating Ratio: +0/-0
  • Jack of all trades, master of none.
    • @@TheTreeOfComedy
    • eyeoftheaxolotl.tumblr.com
  • Gender: Female
prgmERMINE: The Sassy Chatbot
« on: January 19, 2018, 06:15:41 pm »
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:
Code: [Select]
ClrHome
Input "CHAT: ", Str1
ClrHome
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.

Code: [Select]
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


  • Calculators owned: TI-83+
  • Consoles, mobile devices and vintage computers owned: TI-83+, iPhone, Nintendo Switch, iPad, Kindle

Offline JWinslow23

  • Should my fans be called "Elephants", "Cookie Clickers", or "Descenders"?
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and 2↑↑↑6
  • Posts: 797
  • Post Rating Ratio: +14/-1
  • 99.999...% of mathematicians agree, tau > pi.
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
  • Gender: Male
Re: prgmERMINE: The Sassy Chatbot
« Reply #1 on: January 19, 2018, 08:16:31 pm »
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:
Code: [Select]
" "+Str1+" "->Str1
If inString (Str1," HI "):Then
Disp "HEY, NERD."
End
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:
Code: [Select]
If inString(Str1," HI "):Then
randInt(1,5->R
If R=1:Disp "HEY, NERD."
If R=2:Disp "OH, HI."
If R=3:Disp "YO, DUDE."
If R=4:Disp "WHAT IS IT THIS","TIME?"
If R=5:Disp "HEY, DIDN'T SEE","YOU THERE."
End
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:

Code: [Select]
If inString(Str1," HI "):Then
"HI code here
Goto E
End

Repeat 1
"catch-all code here
Disp "SORRY, I DON'T","UNDERSTAND."
Lbl E
End

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!

Offline Woodrow

  • New User
  • Join Date: Jan 2018
  • Location: Miami, Florida
  • Posts: 11
  • Post Rating Ratio: +0/-0
  • Jack of all trades, master of none.
    • @@TheTreeOfComedy
    • eyeoftheaxolotl.tumblr.com
  • Gender: Female
Re: prgmERMINE: The Sassy Chatbot
« Reply #2 on: January 22, 2018, 09:41:51 pm »
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:

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

he gave such great speeches even towards the end of his life omg
  • Calculators owned: TI-83+
  • Consoles, mobile devices and vintage computers owned: TI-83+, iPhone, Nintendo Switch, iPad, Kindle

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games