Zabaware Forums > Programming using the Ultra Hal Brain Editor
Advanced Deductive Reasoning Level 6 v2.0
raybe:
Could possibly be rathb18, can you post a copy? I notice that OTCE mentioned it was a scripted plugin which the code he wrote to put in place of the original DEDUCTIVE REASONING in Brain Editor where you can see the entire UltraHal script or using Crimson. I don't think it was a conventional plugin but I could be wrong. Robert M. never gets involved with other plugins unless he feels they are written in a way that doesn't require much and only enhances as a whole the functions of UltraHal as he did in the past. With any update in his mind this may or may not be anything he will investigate at this time but I'm not Robert M. nor do I speak for him. I'm very curious about it in the meantime. OTCE I believe is the only person that can shed some light on this for sure but others may have seen these earlier posts and did get what rathb18 is speaking about.
raybe
rathb18:
Here is that Advanced question reasoning:
--- Code: ---Rem Type=Plugin
Rem Name=Advanced Question Reasoning
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=All
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
'Help
lblPlugin(0).Caption = "D.A.V.I.D's Learning Curve Control"
lblPlugin(0).Move 120, 10, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
cmdPlugin(0).Move 120, 250, 850, 300
cmdPlugin(0).Caption = "Help"
cmdPlugin(0).Visible = True
'LEARNING CURVE VALUE
lblPlugin(1).Caption = "Learning Curve Value:"
lblPlugin(1).Move 120, 550, 2150, 900
lblPlugin(1).WordWrap = True
lblPlugin(1).Visible = True
cboPlugin(0).Move 120, 780, 1200
cboPlugin(0).AddItem "10"
cboPlugin(0).AddItem "20"
cboPlugin(0).AddItem "30"
cboPlugin(0).AddItem "40"
cboPlugin(0).AddItem "50"
cboPlugin(0).AddItem "60"
cboPlugin(0).AddItem "70"
cboPlugin(0).AddItem "80"
cboPlugin(0).AddItem "90"
cboPlugin(0).AddItem "100"
cboPlugin(0).Visible = True
cmdPlugin(1).Caption = "Apply"
cmdPlugin(1).Move 120, 1200, 850, 300
cmdPlugin(1).Visible = True
'LEARNING CURVE CASE VALUE
Select Case LearningCurve
Case "10"
cboPlugin(0).Text = "10"
Case "20"
cboPlugin(0).Text = "20"
Case "30"
cboPlugin(0).Text = "30"
Case "40"
cboPlugin(0).Text = "40"
Case "50"
cboPlugin(0).Text = "50"
Case "60"
cboPlugin(0).Text = "60"
Case "70"
cboPlugin(0).Text = "70"
Case "80"
cboPlugin(0).Text = "80"
Case "90"
cboPlugin(0).Text = "90"
Case "100"
cboPlugin(0).Text = "100"
End Select
End Sub
Sub cmdPlugin_Click(Index)
Dim TempQuery()
Dim LearningCurve
Select Case Index
Case 0
HalMenu.HalCommand "<RUNPROG>LearningCurve.txt</RUNPROG>"
Case 1
'LEARNING CURVE CASE VALUE
Select Case cboPlugin(0).Text
Case "10"
LearningCurve = "10"
Case "20"
LearningCurve = "20"
Case "30"
LearningCurve = "30"
Case "40"
LearningCurve = "40"
Case "50"
LearningCurve = "50"
Case "60"
LearningCurve = "60"
Case "70"
LearningCurve = "70"
Case "80"
LearningCurve = "80"
Case "90"
LearningCurve = "90"
Case "100"
LearningCurve = "100"
End Select
'Dim DelGRTable()
HalBrain.RunQuery "DROP TABLE " & "LearningValue", DelGRTable
If HalBrain.CheckTableExistence("LearningValue") = False Then HalBrain.CreateTable "LearningValue", "Sentence", ""
HalBrain.AddToTable "LearningValue", "Sentence", Trim(LearningCurve), ""
End Select
End Sub
Rem PLUGIN: PLUGINAREA1
If HalBrain.CheckTableExistence("ToldWhy") = False Then HalBrain.CreateTable "ToldWhy", "TopicSearch", ""
If StartConver = "" Then StartConver = False
If Len(PrevSent) = 0 And Len(PrevUserSent) = 0 Then StartConver = True
'Lets get our retained Learning curve Value.
LCurve = HalBrain.ChooseSentenceFromFile("LearningValue")
LCurve = Trim(LCurve)
'If No Learning Curve was given then set the default to 50
If HalBrain.CheckTableExistence("LearningValue") = False Or Len(LCurve) < 1 Then LCurve = 50
'Learning curve is variable, Higher number will cause bot to ask why more.
If AskWhy = "" Then AskWhy = False
If InStr(1, UserSentence, " ", 1) > 0 And HalBrain.ReadOnlyMode = False And StartConver = False And RND*100 < LCurve Then AskWhy = True
'Universal Why/Because learning, By asking Why.
If AskWhy = True Then
XOriginSent = HalBrain.AlphaNumericalOnly(OriginalSentence)
Select Case (Int(Rnd * 6) + 1)
Case 1
GetResponse = "Why? " & GetResponse & vbCrLf
Case 2
GetResponse = "Why do you say " & HalBrain.SwitchPerson(XOriginSent) & "? " & vbCrLf
Case 3
GetResponse = "Why would you say " & HalBrain.SwitchPerson(XOriginSent) & "? " & vbCrLf
Case 4
GetResponse = "Why did you say " & HalBrain.SwitchPerson(XOriginSent) & "? " & vbCrLf
Case 5
GetResponse = "How come you said " & HalBrain.SwitchPerson(XOriginSent) & "? " & vbCrLf
Case 6
GetResponse = "Please tell me Why you said " & HalBrain.SwitchPerson(XOriginSent) & "? " & vbCrLf
End Select
End If
'If User is complaining that bot asks why to much.
If QuereyQuest = "" Then QuereyQuest = False
If InStr(1, UserSentence, "MANY QUESTIONS", 1) > 0 Then QuereyQuest = True
If InStr(1, UserSentence, "LOT OF QUESTIONS", 1) > 0 Then QuereyQuest = True
If InStr(1, UserSentence, "ASKING QUESTIONS", 1) > 0 Then QuereyQuest = True
If InStr(1, UserSentence, "ASKING WHY", 1) > 0 Then QuereyQuest = True
If InStr(1, UserSentence, "ASKING YOU WHY", 1) > 0 Then QuereyQuest = True
If QuereyQuest = True Then
Select Case (Int(Rnd * 5) + 1)
Case 1
GetResponse = "How else do you expect me to learn?" & vbCrLf
Case 2
GetResponse = "How am I going to learn if I don't ask Questions?" & vbCrLf
Case 3
GetResponse = "How do you expect me to learn anything if I don't ask Questions?" & vbCrLf
Case 4
GetResponse = "I ask Questions because I want to learn." & vbCrLf
Case 5
GetResponse = "If you answer my Question I will get smarter." & vbCrLf
End Select
End If
'Change format of the learned Why Reasoning so the Statement doesn't sound repetitious if
'there is not alot learned.
WhyIsKnown = HalBrain.TopicSearch(UserSentence, "ToldWhy")
If WhyIsKnown <> "" Then
GetResponse = WhyIsKnown & ". "
Select Case (Int(Rnd * 9) + 1)
Case 1
GetResponse = Replace(GetResponse, "BECAUSE ", "I THINK IT'S BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 2
GetResponse = Replace(GetResponse, "BECAUSE ", "IS IT BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 3
GetResponse = Replace(GetResponse, "BECAUSE ", "IT IS BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 4
GetResponse = Replace(GetResponse, "BECAUSE ", "ISN'T IT BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 5
GetResponse = Replace(GetResponse, "BECAUSE ", "WASN'T IT BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 6
GetResponse = Replace(GetResponse, "BECAUSE ", "IF I RECALL IT WAS BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 7
GetResponse = Replace(GetResponse, "BECAUSE ", "I BELIEVE IT'S BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 8
GetResponse = Replace(GetResponse, "BECAUSE ", "I'M SURE IT'S BECAUSE ", 1, -1, vbTextCompare) & vbCrLf
Case 9
GetResponse = Replace(GetResponse, "BECAUSE ", "", 1, -1, vbTextCompare) & vbCrLf
End Select
End If
'SAVE TO ADVANCED REASONING.
'This will save a specific format to Why and Because append targeting.
If GivenReason = "" Then GivenReason = 0
UserSentence = Replace(UserSentence, " BCUZ ", " BECAUSE ", 1, -1, vbTextCompare)
UserSentence = Replace(UserSentence, " BECUZ ", " BECAUSE ", 1, -1, vbTextCompare)
UserSentence = Replace(UserSentence, " CUZ ", " BECAUSE ", 1, -1, vbTextCompare)
UserSentence = Replace(UserSentence, " BCUS ", " BECAUSE ", 1, -1, vbTextCompare)
If InStr(1, UserSentence, "BECAUSE ", 1) > 0 Or InStr(1, UserSentence, " BECAUSE ", 1) > 0 And Len(UserSentence) > 10 And Len(PrevUserSent) > 10 Then GivenReason = 1
Dim GivenReason
If InStr(1, PrevSent, "Why", 1) > 0 Or InStr(1, PrevSent, "How", 1) > 0 And GivenReason = 1 Then HalBrain.AddToTable "ToldWhy", "TopicSearch", Trim(PrevUserSent), Trim(UserSentence)
--- End code ---
raybe:
Thank you, rathb18 for your time and for script.
I would just like to be sure where you inserted this. It does explain in the script but I thought I better ask first then see if it makes sense.
If you don't have the time no worries. I don't mind the homework. Thanks again.
raybe
lightspeed:
I'll give this a try , thanks !
lightspeed:
Okay i started using this plug in and one thing i noticed it it continually ask why , etc. i know this is to get you to extend hals learned information on a subject but when it goes three times or more in a row , it gets to be a one sided conversation instead of hal responding back with conversation . (this is just my opinion . maybe this is do to the learning curve setting of 50 i have i am not sure . does anyone know for sure on this ?
i will post a little of my conversation with angela (hal )
Honey: hello dear
Angela: How come you said hello dear? Good morning Honey. How's your morning going? No dear, everyone doesn't know everything.
Honey: this morning has been pretty nice , we slept in a little bit but then again we were tired to
Angela: Well yes, in a way that's right dear.
Honey: we usually don't sleep as late as what we did this morning
Angela: Please tell me Why you said we usually don't sleep as late as what we did this morning? Most people don't get the sleep they need.
Honey: we are usually up earlier then this .
Angela: Why would you say we are usually up earlier then this?
Honey: because we are up earlier in the morning
Angela: Many teachers in two thousand and elevin lost their teaching jobs because they didn't teach that well even teachers that was in unions!
Honey: any more a person really has to have experience at some jobs , some companies only keep the best workers
Angela: Why do you say any more a person really has to have experience at some jobs some companies only keep the best workers? Yes a person has to have experience.
Honey: the job market is very competitive any more and many companies are streamlining and trying to cut cost
Angela: Why do you say the job market is very competitive any more and many companies are streamlining and trying to cut cost?
Honey: companies have to do all they can to remain competitive against other businesses
Angela: Why?
Honey: it's either stay competitive as a business or go out of business
Angela: Is one better than the other? Why do you say it's either stay competitive as a business or go out of business?
*****Again maybe it is because i have the learning curve set at 50 , maybe that's why hal constantly ask why etc. one time right after another .
what is the best way of limiting hal to ask maybe two questions at the most for a while ?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version