Re: exercise in prolog
- From: "Mauro Di Nuzzo" <picorna@xxxxxxxxx>
- Date: Thu, 17 May 2007 12:34:08 +0200
This could be the syntax... try to implement semantics by yourself.
:- op(500, xfy, says).
:- op(400, yf, lies).
:- op(400, yf, says_the_truth).
:- op(450, xfy, when).
person(a).
person(b).
person(c).
sentence(lies(Who)) :-
person(Who).
sentence(says_the_truth(Who)) :-
person(Who).
sentence(when(If, Then)) :-
sentence(If),
sentence(Then).
says(Who, What) :-
person(Who),
sentence(What).
Ciao
"pachanguero" <boehrs@xxxxxxxxx> ha scritto nel messaggio
news:1179395859.385898.254650@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hi!
i got a little problem. we have to implement a program for prolog.
that's the situation:
we got some person who say something about another person. for
example:
a says: b lies when c says the truth.
b says: a says the truth.
c says: b lies.
that's only an example. our task is harder.
anyone has a hint for me? shall I use lists? in addition, we should
use the facts: bool(true) and bool(fail).
thanks for every answer!
.
- Follow-Ups:
- Re: exercise in prolog
- From: Markus Triska
- Re: exercise in prolog
- References:
- exercise in prolog
- From: pachanguero
- exercise in prolog
- Prev by Date: exercise in prolog
- Next by Date: Newbie question
- Previous by thread: exercise in prolog
- Next by thread: Re: exercise in prolog
- Index(es):
Relevant Pages
|
|