Tuesday, October 13, 2009

Tutorial


Left behind is a combination of two seats.

So, there are 4 combinations of two seats : {7,9}, {6,9}, {7,8}, and {6,8}.

if we used prolog to get 4 combinations we can write like this in our notepad:

r(6).
r(7).
s(8).
s(9).
set(x):-r(x).
set(y):-s(y).
combination(x,y):-r(x),s(y).




then we can save the notepad with .pl format.

Then its prolog is showed by this picture ;




No comments:

Post a Comment