Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
en:dydaktyka:ggp:gdl [2019/01/03 22:50] msl reverts <code prolog> to <code> because of the environment bug |
en:dydaktyka:ggp:gdl [2021/01/12 01:05] (current) msl [Fluents] |
</code> | </code> |
| |
Here '':-'' reprenst implication ''<-''. ''&'' is a logical and. In natural language the first line means: "if M and N represent cells' indexes, then there is a fluent for cell with (M, N) coordinates, telling there is a cross in it". If we didn't use rules, we could write all the fluents by hand: | Here '':-'' represents an implication ''<-''. ''&'' is a logical "and". In natural language the first line means: "if M and N represent cells' indexes, then there is a fluent for cell with (M, N) coordinates, telling there is a cross in it". If we didn't use rules, we could write all the fluents by hand: |
| |
<code> | <code> |
| |
| |
Rules in GDL have a one special feature: they can recurse, but they can't loop forever. [[http://www.inf.tu-dresden.de/content/institutes/ki/cl/study/winter09/ggp/kapitel2.pdf|More details here]]. | Rules in GDL have one special feature: they can recurse, but they can't loop forever. [[http://www.inf.tu-dresden.de/content/institutes/ki/cl/study/winter09/ggp/kapitel2.pdf|More details here]]. |
| |
==== Available Actions ==== | ==== Available Actions ==== |
| |
{{ :pl:dydaktyka:ggp:rock-paper-spock.jpg?300|}} | {{ :pl:dydaktyka:ggp:rock-paper-spock.jpg?300|}} |
Please model the "Rock Paper Scissors Lizard Spock" game. You can learn the rules from this [[https://www.youtube.com/watch?v=iapcKVn7DdY|video]]. The image on the right is also a good reference. You can practice it with a colleague or like a modern man: [[http://www.playmycode.com/play/game/cainy393/rock-paper-scissors-lizard-spock|online...]]. | Please model the "Rock Paper Scissors Lizard Spock" game. You can learn the rules from this [[https://www.youtube.com/watch?v=iapcKVn7DdY|video]]. The image on the right is also a good reference. You can practice it with a colleague or like a modern man: [[https://rpsls.net|online...]]. |
| |
===== - Knowledge Interchange Format ===== | ===== - Knowledge Interchange Format ===== |
and KIF: | and KIF: |
| |
<code lisp> | <code scheme> |
(p a ?y) | (p a ?y) |
(not (p a ?y)) | (not (p a ?y)) |
For every example below, tell if the KIF version is a faithful translation of the Prolog one. | For every example below, tell if the KIF version is a faithful translation of the Prolog one. |
| |
<code lisp> | <code scheme> |
r(a,b) :- p(a) & q(b) | r(a,b) :- p(a) & q(b) |
(<= (r a b) (and (p a) (q b))) | (<= (r a b) (and (p a) (q b))) |
</code> | </code> |
<code lisp> | <code scheme> |
r(a,b) :- p(a) & q(b) | r(a,b) :- p(a) & q(b) |
(<= (r a b) (p a) (q b)) | (<= (r a b) (p a) (q b)) |
</code> | </code> |
<code lisp> | <code scheme> |
r(x,y) :- p(x) & q(y) | r(x,y) :- p(x) & q(y) |
(<= (r ?x ?y) (p ?x) (q ?y)) | (<= (r ?x ?y) (p ?x) (q ?y)) |
</code> | </code> |
<code lisp> | <code scheme> |
r(X,Y) :- p(X) & q(Y) | r(X,Y) :- p(X) & q(Y) |
(<= (r ?x ?y) (p ?x) (q ?y)) | (<= (r ?x ?y) (p ?x) (q ?y)) |