1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
go:- initialize,
collect_symptoms,
rule(Number,Fault),
reply(Fault,Reply),
write(Reply),nl,
write('The rule used was number'),
write(Number),nl,nl,
retractall(symptom(_)).
go:-
write('Sorry cannot help'),nl,nl,
retractall(symptom(_)).
initialize:-
put(12),
write('*** Troubleshooting Network Expert System ***'),nl,nl,
write('assuming there is no internet connection '),
write('please answer the following questions'),
write('with y(yes) or n(no).').
collect_symptoms:-
question(Ques,Sympt)
,write(Ques),nl,
getyesno(Yesno),nl,Yesno=y,
assertz(symptom(Sympt)),fail.
collect_symptoms.
getyesno(X):-
repeat,
write('Please answer y or n:'),
read(Z),nl,
check(Z),X=Z,!.
check(y).
check(n).
question('There is no red cross on the screen?',red_cross).
question('The Wall Cable is not connected?',wall_cable).
question('The Cable is not connected to your Computer?',computer_cable).
question('The Administrator of the Network has internet connection?',check_admin).
question('Your Firewall is not disabled?',fwall_disabled).
question('Your Antivirus is not disabled?',antivirus_disabled).
rule(1,red_cross):-
not(symptom(wall_cable)).
rule(2,wall_cable):-
symptom(red_cross),
symptom(wall_cable).
rule(3,computer_cable):-
symptom(red_cross),
symptom(wall_cable),
symptom(computer_cable).
rule(4,check_admin):-
symptom(red_cross),
not(symptom(wall_cable)),
not(symptom(computer_cable)).
rule(5,fwall_disabled):-
symptom(red_cross),
not(symptom(wall_cable)),
not(symptom(computer_cable)),
not(symptom(check_admin)),
not(symptom(fwall_disabled)).
rule(6,antivirus_disabled):-
symptom(red_cross),
not(symptom(wall_cable)),
not(symptom(computer_cable)),
not(symptom(check_admin)),
not(symptom(fwall_disabled)),
not(symptom(antivirus_disabled)).
reply(red_cross,'Check your wall cable.').
reply(wall_cable,'check your wall cable').
reply(computer_cable,'check your computer cable').
reply(check_admin,'check with your Network Administrator').
reply(fwall_disabled,'disable your firewall').
reply(anti_virus,'disable your antivirus'). |
Partager