/* -*- prolog -*- ********************* FARMER, WOLF, GOAT, CABBAGE ******************** File: farmer.pl Description: Farmer, wolf, goat, cabbage problem from luger & stubblefield, p. 228ff. This is a production system version of the problem.
Details Hits: 32
Votes: 0
Ratings:
Reviews:
Google PR:
move(state(X,W,X,C), state(Y,W,Y,C)):- opp(X,Y), not(unsafe(state(Y,W,Y,C))), writelist(['try farmer takes goat ', Y, W, Y, C]), nl. move(state(X,W,G,X), state(Y,W,G,Y)):- opp(X,Y), not(unsafe(state(Y,W,G,Y))), writelist(['try farmer takes cabbage ', Y, W, G, Y]), nl.
Details Hits: 11
Votes: 0
Ratings:
Reviews:
Google PR:
3.
%farmer, wolf, goat, cabbage go :- path(st(w,w,w,w),st(e,e,e,e))....
%farmer, wolf, goat, cabbage go :- path(st(w,w,w,w),st(e,e,e,e)). path(Start, Goal) :- empty(EmptyBeen), push(Start,EmptyBeen,Been), path1(Start, Goal, Been). path1(Goal, Goal, Been) :- nl, nl, write('Solution is: '), nl, writeR(Been).
Details Hits: 18
Votes: 0
Ratings:
Reviews:
Google PR: