Chatbots

Miscellaneous Forums/Blitz Showcase/Chatbots

hi!

well, it is a crazy idea, but i have programmed some chatbots in combination with a word createtor...

WARNING: FUNNY!

Graphics 640, 480, 32, 2
SetBuffer BackBuffer()
SeedRnd MilliSecs()

Type ChatBot
	Field name$
End Type

For i = 1 To 5
	c.ChatBot = New ChatBot
	If Rand(0, 4) = 0 Then c\name$ = CreateWord$(3, 5) + " " + CreateWord$(3, 5) Else c\name$ = CreateWord$(5, 8)
	c\name$ = Upper(Left(c\name$, 1)) + Right(c\name$, Len(c\name$) - 1)
Next

timer = CreateTimer(10)
While Not KeyHit(1)
	For c.ChatBot = Each ChatBot
		If Rand(0, 100) = 0 Then Print c\name$ + " :: " + CreateSentence$()
	Next
	WaitTimer(timer)
Wend
End

Function CreateSentence$()
cnt_words = Rand(2, 3) * Rand(2, 3)
For i = 1 To cnt_words
	txt$ = txt$ + CreateWord$()
	If i <> cnt_words Then
		If Rand(0, 5) = 0 Then txt$ = txt$ + ", " Else txt$ = txt$ + " "
	EndIf
Next
num = Rand(0, 100)
If num < 20 Then
	c$ = "?"
ElseIf num > 20 And num < 40 Then
	c$ = "!"
ElseIf num > 40 And num < 50 Then
	Select Rand(1, 9)
		Case 1: c$ = "!!"
		Case 2: c$ = "!!!"
		Case 3: c$ = "??"
		Case 4: c$ = "!?!"
		Case 5: c$ = ";"
		Case 6: c$ = "!?"
		Case 7: c$ = "?!"
		Case 8: c$ = ".."
		Case 9: c$ = "..."
	End Select
Else
	c$ = "."
EndIf
txt$ = txt$ + c$
txt$ = Upper(Left(txt$, 1)) + Right(txt$, Len(txt$) - 1)
Return txt$
End Function

Function CreateWord$(min_ln = 0, max_ln = 999999)
Repeat
	ln = Rand(1, 3) * Rand(1, 3)
Until ln => min_ln And ln <= max_ln
sign = 0
For i = 1 To ln
	sign = 1 - sign
	If sign Then txt$ = txt$ + CreateVocal$() Else txt$ = txt$ + CreateConsonant$()
Next
Return txt$
End Function

Function CreateVocal$()
Select Rand(1, 5)
	Case 1: txt$ = "a"
	Case 2: txt$ = "e"
	Case 3: txt$ = "i"
	Case 4: txt$ = "o"
	Case 5: txt$ = "u"
End Select
Return txt$
End Function

Function CreateConsonant$()
If Rand(0, 2) = 0 Then
	For i = 1 To Rand(1, 2)
		txt$ = txt$ + Chr(Rand(97, 122))
	Next
	Return txt$
EndIf
If Rand(0, 3) = 0 Then txt$ = Chr(Rand(97, 122))
If Rand(0, 15) = 0 Then
	c$ = Chr(Rand(97, 122))
	txt$ = c$ + c$
EndIf
If txt$ = "" Then txt$ = CreateConsonant$()
Return txt$
End Function


hint: it is worth trying to combine this with the TextToSpeech dll ;)

hehe. Seems like they are using ultra strong encryption - very suspicious!! Call the cops! spooks!

Not sure about TextToSpeech, I'd rather try to wire one of the online AI's (eg. Alice) with speech, then set up a $$ astro phone line or something like that. \_/

Somehow this looks creepy. :-)

Reminds me of Finnish.

hey, thx for compliments! :)
When someone could manage this in a REAL languange, this would be great:D

interesting