Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Prolog

Name: Anonymous 2008-02-02 18:45


% -*-Prolog-*-

% BD directa de nacionalidades para *
color(english, red).
animal(swede, dog).
drink(danish, tea).
number(norwegian, 1).
cigar(german, prince).

% Relacoes com 1 grau
color(N, green) :- drink(N, coffee).
cigar(N, pallmall) :- animal(N, bird).
color(N, yellow) :- cigar(N, dunhill).
number(N, 3) :- drink(N, milk).
drink(N, beer) :- cigar(N, bluemasters).

color(N, green) :- number(N, X), color(N2, white), number(X2, X+1).
cigar(N, blends) :- number(N, X), animal(N2, cat), number(X2, X+1);
                  number(N, X), animal(N2, cat), number(X2, X-1).
animal(N, horse) :- number(N, X), cigar(N2, dunhill), number(X2, X+1);
                 number(N, X), cigar(N2, dunhill), number(X2, X-1).
number(N, X) :- color(N2, blue), number(N2, X+1);
            color(N2, blue), number(N2, X-1).
cigar(N, blends) :- number(N, X), drink(N2, water), number(N2, X+1);
                  number(N, X), drink(N2, water), number(N2, X-1).



$ swipl
%...
$- [einstein].
% ... Some stupid warnings...

Yes
$- animal(N, fish).

No
$-


Me fail Prolog? That's unpossible.
Why?

Name: Anonymous 2008-02-03 12:28

>>7
Then you should be able to point out the obvious mistake OP is doing.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List