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?