III.3 SOURCE CODES
A code is symbols, numbers, or signals that conveys information
to a computer.
a) Codes for the global variables
(defglobal ?*name* = "")
(defglobal ?*pwd* = "")
(defglobal ?*cote* = 0)
(defglobal ?*course* = "in Network course")
(defglobal ?*cota* = 0)
b) Rule 1
(defrule display_logo
=>
(clear-window)
(printout t
"*===================================================================*"crlf
"*
*"crlf
"*
UNIVERSITY OF KINSHASA *"crlf
"*
*"crlf
"*
FACULTY OF ART AND HUMAN SCIENCES *"crlf
"* DEPARTEMENT OF BUSINESS
ENGLISH AND COMPUTER *"crlf
"*
*"crlf
"*
*"crlf
"*
*"crlf
"*
*"crlf
"*
================================================ *"crlf
"* =
=
*"crlf
"* = NETWORK COURSE EVALUATION
EXPERT SYSTEM = *"crlf
"* =
=
*"crlf
"*
================================================ *"crlf
"*
*"crlf
"*
*"crlf
"*
*"crlf
"*
*"crlf
"*
*"crlf
"*
*"crlf
"*
DONE BY:
*"crlf
"*
*"crlf
"*
ILUNGA MANDALA Jacques *"crlf
"*
*"crlf
"*
*"crlf
"*
MONITORED BY:
*"crlf
"*
*"crlf
"* -Phd
KUTANGILA MAYOYA Sanctus *"crlf
"*
*"crlf
"* -Phd
MALEKANI ATHNASE *"crlf
"====================================================================="crlf
crlf crlf)
(printout t" PRESS ANY KEY TO CONTINUE...")(readline)
(assert(home)))
c) Rule 2
(defrule display_home
?a<-(home)
=>
(retract ?a)
(reset)
(clear-window)
(printout t
"*======================================================*"crlf
"*
*"crlf
"* WELCOME TO
NETWORK EXAM *"crlf
"*
*"crlf
"*======================================================*"crlf
crlf crlf)
(printout t" INPUT YOUR FULL NAME: ") (bind ?*name*(readline))
(while(neq ?*name* "ILUNGA MANDALA" "NANA MUNDA" "IHEMBA KATOMBA"
"KANKU RUBEN" "NGUABA JOSEPH") (clear-window) do
(printout t" SORRY, INVALID USERNAME...TRY AGAIN PLEASE, AND BE
SURE THAT IT IS IN CAPITAL LETTER!" crlf crlf crlf
"INPUT A VALID NAME: ")(bind ?*name*(readline)))
(assert(password))
)
d) Rule 3
(defrule display_password
(password)
=>
(clear-window)
(printout t
"======================================================"crlf
"=
="crlf
"=
WELCOME" " "?*name*"! ="crlf
"=
="crlf
"======================================================"crlf crlf
crlf crlf
"INPUT YOUR PASSWORD PLEASE: ")(bind ?*pwd*(readline))
(while(and(eq ?*name* "ILUNGA MANDALA") (neq ?*pwd*
"NANA"))(clear-window) do(printout t"SORRY, YOUR PASSWORD IS INCORRECT! TRY
AGAIN, AND BE SURE THAT IT IS IN CAPITAL LETTER."crlf crlf crlf
"INPUT A VALID PASSWORD PLEASE: ") (bind ?*pwd*(readline)))
(while(and(eq ?*name* "IHEMBA KATOMBA") (neq ?*pwd*
"MUNDA"))(clear-window) do(printout t"SORRY, YOUR PASSWORD IS INCORRECT! TRY
AGAIN, AND BE SURE THAT IT IS IN CAPITAL LETTER."crlf crlf crlf
"INPUT A VALID PASSWORD PLEASE: ") (bind ?*pwd*(readline)))
(while(and(eq ?*name* "KANKU RUBEN") (neq ?*pwd*
"MBUYI"))(clear-window) do(printout t"SORRY, YOUR PASSWORD IS INCORRECT! TRY
AGAIN, AND BE SURE THAT IT IS IN CAPITAL LETTER."crlf crlf crlf
"INPUT A VALID PASSWORD PLEASE: ") (bind ?*pwd*(readline)))
(while(and(eq ?*name* "NGUABA JOSEPH") (neq ?*pwd*
"EKOLO"))(clear-window) do(printout t"SORRY, YOUR PASSWORD IS INCORRECT! TRY
AGAIN, AND BE SURE THAT IT IS IN CAPITAL LETTER."crlf crlf crlf
"INPUT A VALID PASSWORD PLEASE: ") (bind ?*pwd*(readline)))
(if(and(eq ?*name* "ILUNGA MANDALA") (eq ?*pwd* "NANA"))
then(assert(order)))
(if(and(eq ?*name* "IHEMBA KATOMBA") (eq ?*pwd* "MUNDA"))
then(assert(order)))
(if(and(eq ?*name* "KANKU RUBEN") (eq ?*pwd* "MBUYI"))
then(assert(order)))
(if(and(eq ?*name* "NGUABA JOSEPH") (eq ?*pwd* "EKOLO"))
then(assert(order)))
)
e) Rule 4
(defrule display_order
(order)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
GOOD LUCK" " "?*name* "! ""*"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO START YOUR EXAM")(readline)
(assert(questiona)))
f) Rule 5
(defrule display_questiona
(questiona)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* QUESTION NUMBER 1.
*"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"The concept of network means?:" crlf
"-----------------------------" crlf crlf crlf
"a. A distributed group of people or things that communicate with
one another and work together as a unit or system"crlf crlf
"b. A tool or machine designed to perform a particular task or
function"crlf crlf
"c. An electronic device enabling the user to speak to and hear
others with similar equipment"crlf crlf
"d. A system of communications using telephones"crlf crlf
"e. A communication carried out using the telephone"crlf crlf
crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "a") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "a") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resulta))
)
g) Rule 6
(defrule display_resulta
(resulta)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questionb))
)
(defrule display_questionb
(questionb)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 2. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"Wide Area Network (WAN) is:" crlf
"-----------------------------" crlf crlf crlf
"a. A private network whose size does not exceed 1
kilometer."crlf crlf
"b. A public network whose size does not exceed 1 kilometer."crlf
crlf
"c. A network at short distance which can not cover a significant
geographical area"crlf crlf
"d. A network at long distance which covers a significant
geographical area"crlf crlf
"e. All these answers are corrects"crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "d") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "d") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resultb))
)
h) Rule 7
(defrule display_resultb
(resultb)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questionc))
)
i) Rule 8
(defrule display_questionc
(questionc)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* QUESTION NUMBER 3.
*"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"The difference between peer to peer and customer-server network
is:" crlf
"-----------------------------" crlf crlf crlf
"a. Customer-server network is smallest than peer to peer
network."crlf crlf
"b. Peer to peer uses 12 computers at least while customer-server
uses at most ten computers"crlf crlf
"c. The correct answer is the assertion a"crlf crlf
"d. all these answers are corrects"crlf crlf
"e. All these answers are incorrects"crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "e") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "e") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resultc))
)
j) Rule 9
(defrule display_resultc
(resultc)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questiond))
)
k) Rule 10
(defrule display_questiond
(questiond)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 4. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"Physical topology of network refers to:" crlf
"-----------------------------" crlf crlf crlf
"a. The wireless network."crlf crlf
"b. Computers which are not connected"crlf crlf
"c. The way in which equipments (computers) are connected between
them. "crlf crlf
"d. all these answers are corrects"crlf crlf
"e. The way of communication between computers"crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "c") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "c") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resultd))
)
l) Rule 11
(defrule display_resultd
(resultd)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questione))
)
m) Rule 12
(defrule display_questione
(questione)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* QUESTION NUMBER 5.
*"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"The topology of network characterized by a central point on
which all the members of the network are connected is:" crlf
"-----------------------------" crlf crlf crlf
"a. Ring topology."crlf crlf
"b. Wireless topology"crlf crlf
"c. Bluetooth topology"crlf crlf
"d. Bus topology"crlf crlf
"e. Star toplogy"crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "e") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "e") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resulte))
)
n) Rule 13
(defrule display_resulte
(resulte)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questionf))
)
o) Rule 14
(defrule display_questionf
(questionf)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 6. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"The topology of network characterized by a central cable on
which all the members of the network are connectedis:" crlf
"-----------------------------" crlf crlf crlf
"a. Ring topology."crlf crlf
"b. Wireless topology."crlf crlf
"c. Bluetooth topology."crlf crlf
"d. Bus topology."crlf crlf
"e. Star toplogy."crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "d") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "d") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resultf))
)
p) Rule 15
(defrule display_resultf
(resultf)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questiong))
)
q) Rule 16
(defrule display_questiong
(questiong)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 7. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"Wireless network is:" crlf
"-----------------------------" crlf crlf crlf
"a. A network in which terminals can communicate without
telegraphic connection."crlf crlf
"b. A network in which at least two computers are connected."crlf
crlf
"c. A network which is able to share date with others"crlf
crlf
"d. All answers are corrects."crlf crlf
"e. All answers are incorrects."crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "a") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "a") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resultg))
)
r) Rule 17
(defrule display_resultg
(resultg)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questionh))
)
s) Rule 18
(defrule display_questionh
(questionh)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 8. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"The principal technology used for the wireless personal network
is :" crlf
"-----------------------------" crlf crlf crlf
"a. Wifi."crlf crlf
"b. Bluetooth."crlf crlf
"c. MODEM"crlf crlf
"d. RJ-45."crlf crlf
"e. All answers are incorrects."crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "b") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "b") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resulth))
)
t) Rule 19
(defrule display_resulth
(resulth)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questioni))
)
u) Rule 20
(defrule display_questioni
(questioni)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 9. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"GPRS is the meaning of:" crlf
"-----------------------------" crlf crlf crlf
"a. General Packet Radio operator Service"crlf crlf
"b. General Packet Radio Service."crlf crlf
"c. Generalization of Packege Radio Service"crlf crlf
"d. All answers are corrects"crlf crlf
"e. The correct enswer is the assertion is b."crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "a") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "a") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resulti))
)
v) Rule 21
(defrule display_resulti
(resulti)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"* YOUR CURRENT GRADE IS:" " "?*cote*"
""/20"" *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf
"PRESS ENTER TO CONTINUE: ")(readline)
(assert(questionj))
)
w) Rule 22
(defrule display_questionj
(questionj)
=>
(clear-window)
(printout t
"***********************************************************"crlf
"*
*"crlf
"*
QUESTION NUMBER 10. *"crlf
"*
*"crlf
"***********************************************************"crlf
crlf crlf crlf
"CHOOSE THE LETTER CORRESPONDING TO THE CORRECT ANSWER."crlf crlf
crlf
"IEEE 802.15.1 is the equivalence to:" crlf
"-----------------------------" crlf crlf crlf
"a. WiFi"crlf crlf
"b. ZigBee technology ."crlf crlf
"c. HRF (Home Radio operator Frequency)"crlf crlf
"d. Bluetooth"crlf crlf
"e. The correct enswer is the assertion is c."crlf crlf crlf)
(printout t "THE CORRECT ANSWER IS THE LETTER: ") (bind
?ansa(readline))
(while(neq ?ansa "a" "b" "c" "d" "e") do(printout t" YOU HAVE
TYPED AN INVALID VALUE, PLEASE INPUT A VALID VALUE: ")(bind
?ansa(readline)))
(if(eq ?ansa "d") then (bind ?*cote*(+ 2 ?*cote*)))
(if(neq ?ansa "d") then (bind ?*cote*(+ 0 ?*cote*)))
(assert(resultj))
)
x) Rule 23
(defrule display_resultj
(resultj)
=>
(clear-window)
(printout t
"============================================================"crlf
"=
="crlf
"= RESULT:"" "?*name*" ""got""
"?*cote*"/20"" ="crlf
"=
="crlf
"============================================================"crlf
crlf crlf
"PRESS: (s) TO SAVE YOUR RESULT "crlf crlf
"PRESS: (r) TO RESTART THE EXAM "crlf crlf
"PRESS: (e) TO EXIT "crlf crlf)
(bind ?ans(readline))
(while(neq ?ans "s" "r" "e") do(printout t"INPUT A VALID
LETTER:") (bind ?ans(readline)))
(if(eq ?ans "s") then (assert(next)))
(if(eq ?ans "r") then (assert(nexta)))
(if(eq ?ans "e") then (exit))
)
y) Rule 24
(defrule display_next
(next)
=>
(clear-window)
(printout t
" "crlf
"YOUR RESULT WAS SUCCESSFULLY SAVED"crlf crlf crlf)
(printout t" PRESS ENTER TO EXIT: ") (readline)
(assert(finish))
)
z) Rule 25
(defrule display_finish
(finish)
=>
(exit))
|