Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: Larry on September 14, 2003, 01:54:43 pm
-
'2-Process: Time for a question
Burn1 = False
Burn2 = False
Burn3 = False
Burn4 = False
Burn5 = False
Burn = False
If JokeA = False Then Burn1 = True
If JokeB = False Then Burn2 = True
If Instr (1, OriginalSentence, "?", 1) = 0 Then Burn3 = True
If (Rnd * 100) > 30 Then Burn4 = True
If DoingSomething = False Then Burn5 = True
If Burn1 = True And Burn2 = True And Burn3 = True And Burn4 = True And Burn5 = True Then Burn = True
If Burn = True And Left(Prevsent, 9) <> "I ask you" then
DebugInfo = DebugInfo & "2-Time for a Question: " & vbCrLf
HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir & "PersonalQuestions4U" & ".brn", UserBrainRel)
Pass = False
If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Then Pass = True
If HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Then Pass = True
If HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then Pass = True
If Pass = False then
If UserBrainRel > 1 Then
UserBrainRel = 100
'found a question
GetResponse = HalUserBrain
GetResponse = "I ask you " & GetResponse
GetResponse = Trim(GetResponse)
GetResponse = HalBrain.FixCaps(HalBrain.HalFormat(GetResponse)) & vbCrLf
BlockSave = True
LearningLevel = 0
If UserBrainRel > HighestRel Then
HighestRel = UserBrainRel
HighestRelResponse = GetResponse
End If
Score = UserBrainRel + 1
Hurdle = GainControl + 20
DoingSomething = True
QuestionSent = " I asked you: " & HalUserBrain
QuestionSent = Trim(QuestionSent)
QuestionSent = HalBrain.FixCaps(HalBrain.HalFormat(QuestionSent))
HalBrain.AppendFile WorkingDir & Trim(UserName) & ".txt", QuestionSent
DebugInfo = DebugInfo & "2e-Time for a question: " & vbCrLf
DebugInfo = DebugInfo & "2f-GetResponse: " & GetResponse
DebugInfo = DebugInfo & "2g-UserBrainRel: " & UserBrainRel & vbCrLf
DebugInfo = DebugInfo & "2h-Hurdle: " & Hurdle & vbCrLf
End If
End If
Else
'DebugInfo = DebugInfo & "2i-JokeA: " & JokeA & vbCrLf
'DebugInfo = DebugInfo & "2j-JokeB: " & JokeB & vbCrLf
'DebugInfo = DebugInfo & "2k-DoingSomething: " & DoingSomething & vbCrLf
End If
'2-Process: Time for an answer
If Left(Prevsent, 9) = "I ask you" then
AnswerSent = " And you said: " & OriginalSentence
AnswerSent = Trim(AnswerSent)
AnswerSent = HalBrain.FixCaps(HalBrain.HalFormat(AnswerSent))
HalBrain.AppendFile WorkingDir & Trim(UserName) & ".txt", AnswerSent
BlockSave = True
LearningLevel = 0
End If
'2-Process: What do you know about me
If InStr(1, UserSentence, " YOU KNOW WHAT I KNOW ABOUT YOU ", 1) > 0 Or InStr(1, UserSentence, " WHAT DO I KNOW ABOUT YOU ", 1) > 0 Then
HalUserBrain = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UserName) & ".txt")
GetResponse = HalUserBrain & vbCrLf
UserBrainRel = 100
BlockSave = True
LearningLevel = 0
If UserBrainRel > HighestRel Then
HighestRel = UserBrainRel
HighestRelResponse = GetResponse
End If
Score = UserBrainRel + 1
Hurdle = GainControl + 20
DoingSomething = True
DebugInfo = DebugInfo & "2l-Time for a question: " & vbCrLf
DebugInfo = DebugInfo & "2m-GetResponse: " & GetResponse
DebugInfo = DebugInfo & "2n-UserBrainRel: " & UserBrainRel & vbCrLf
DebugInfo = DebugInfo & "2o-Hurdle: " & Hurdle & vbCrLf
End If
Ok... first problem is, ever time their is info added to the file, then there is a crlf - so the info can't be gotten as a whole...
Second problem, HalBrain.ChooseSentenceFromFile returns nothing after I took out all the crlf from the file... must be it has to have more than one line...
A little background here... JokeA and JokeB are used with knock knock joke covered elsewhere on this forum... DoingSomething is used with 'just answer the question' also covered elsewhere on this forum...
-
'Hi Larry.
'Would something like this work?
If HalBrain.AppendFile WorkingDir & Trim(UserName) & ".txt", AnswerSent = True Then
vbCrLf = False
If HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UserName) & ".txt") = True Then
vbCrLf = False
End If
End If
'It would be cool if we can get it to work the way you want it to.
Best of wishes and new discoveries.
Jerry.
-
Don't seem to help it... [V]