ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Prolog Collaborator/Instructor: Tim Heath Second Life Host:  Annie Ogborn Date:  9/12/10
Overview Why Prolog? What is Prolog? What is the best version of Prolog?
Quick Start I Hello World: q00(X00):-  write('hello world'). save to classex1.pl execute with pl -s classex1.pl 1 ?- q00(X). hello world true.
Quick Start II q00(X00, R):-  write('Are you under 13?'), read(INPUT), write('INPUT: '), write(INPUT). pl -s classex2.pl 1 ?- q00(X,R). Are you under 13?y. INPUT: y true.
Edusmart Purpose Url:  http://www.graysonconsulting.biz/edusmart.swf Sourceforge url:  http://sourceforge.net/projects/edusmart/ Architecture: flash rtmp -> python server -> swipl prolog
Edusmart in Action
Example Decision Tree XML raw xml: <root> <node label=&quot;Are you under 13?, y/n&quot;>    <node label=&quot;y, Are your parents wealthy?, y/n&quot;>      <node label=&quot;y, You are lucky&quot;/>      <node label=&quot;n, Just get a loan&quot;/>    </node> </node> <node label=&quot;Are you over 13?, y/n&quot;>    <node label=&quot;y, You are passed the hardest year&quot;/> </node> <node label=&quot;You are 13&quot;/> </root>
Prolog from XML q00(X00, R):-  write('Are you under 13?'), read(INPUT), write(''), q10(INPUT, R). q10(X10, R):-  X10=y, write(' Are your parents wealthy?'), read(INPUT), write(''), q20(INPUT, R). q20(X20, R):-  X20=y, write(' You are lucky'), !. q20(X20, R):-  X20=n, write(' Just get a loan'), !. q00(X01, R):-  write('Are you over 13?'), read(INPUT), write(''), q11(INPUT, R). q11(X11, R):-  X11=y, write(' You are passed the hardest year'), !. q00(X02, R):-  write('You are 13'), !.
Execution of Decision Tree pl -s brain2.pl 1 ?- q00(X,R). Are you under 13?n. Are you over 13?n. You are 13 true.
Conclusion Prolog is the best rule based engine in existence Other rule based implementations are not as clear Python has a very similar syntax to prolog Do you see any future opportunities for improvement of the edusmart decision tree approach?

More Related Content

Prolog class slides_for_second_life

  • 1. Prolog Collaborator/Instructor: Tim Heath Second Life Host:  Annie Ogborn Date:  9/12/10
  • 2. Overview Why Prolog? What is Prolog? What is the best version of Prolog?
  • 3. Quick Start I Hello World: q00(X00):-  write('hello world'). save to classex1.pl execute with pl -s classex1.pl 1 ?- q00(X). hello world true.
  • 4. Quick Start II q00(X00, R):-  write('Are you under 13?'), read(INPUT), write('INPUT: '), write(INPUT). pl -s classex2.pl 1 ?- q00(X,R). Are you under 13?y. INPUT: y true.
  • 5. Edusmart Purpose Url:  http://www.graysonconsulting.biz/edusmart.swf Sourceforge url:  http://sourceforge.net/projects/edusmart/ Architecture: flash rtmp -> python server -> swipl prolog
  • 7. Example Decision Tree XML raw xml: <root> <node label=&quot;Are you under 13?, y/n&quot;>    <node label=&quot;y, Are your parents wealthy?, y/n&quot;>      <node label=&quot;y, You are lucky&quot;/>      <node label=&quot;n, Just get a loan&quot;/>    </node> </node> <node label=&quot;Are you over 13?, y/n&quot;>    <node label=&quot;y, You are passed the hardest year&quot;/> </node> <node label=&quot;You are 13&quot;/> </root>
  • 8. Prolog from XML q00(X00, R):-  write('Are you under 13?'), read(INPUT), write(''), q10(INPUT, R). q10(X10, R):-  X10=y, write(' Are your parents wealthy?'), read(INPUT), write(''), q20(INPUT, R). q20(X20, R):-  X20=y, write(' You are lucky'), !. q20(X20, R):-  X20=n, write(' Just get a loan'), !. q00(X01, R):-  write('Are you over 13?'), read(INPUT), write(''), q11(INPUT, R). q11(X11, R):-  X11=y, write(' You are passed the hardest year'), !. q00(X02, R):-  write('You are 13'), !.
  • 9. Execution of Decision Tree pl -s brain2.pl 1 ?- q00(X,R). Are you under 13?n. Are you over 13?n. You are 13 true.
  • 10. Conclusion Prolog is the best rule based engine in existence Other rule based implementations are not as clear Python has a very similar syntax to prolog Do you see any future opportunities for improvement of the edusmart decision tree approach?