hi experts,
i need to convert the following program so that it reads from a database.
it currently reads from a txt file. i only got this code from someone else, but i have already edited it. its an expert system...it asks the user questions that are answerable by yes or no then it concludes a hypotheses.
here is the data structure for the rules that are in the txt file.
IF,IS COUGHING,THEN HAS FEVER
IF,IS FEVER,THEN....you get the picture.
Code:Sub LOAD_RULES() R7 = 0 R8 = 0 Open App.Path & "\Knowledgebase\Rules\ANIMAL.txt" For Input As #2 Do While (Not (EOF(2))) If R8 >= R9 Then Display_Message "Out of room for Rules" & vbNewLine Stop End If ' READ NEXT RULE INTO RULE$ ' FORMAT: <name> IF <ant>...<ant> THEN <con>...<con> R8 = R8 + 1 Input #2, RULE$(R8) If RULE$(R8) = "IF" Then R7 = R7 + 1 RULES(R7) = R8 - 1 End If Loop Close #2 End Sub




Reply With Quote