Logtalk 2.17.2 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1076 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.1
|
||||
Release 2.17.2
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
To load all entities in this example consult the puzzles.loader
|
||||
utility file (note that this is a Prolog file).
|
||||
To load all entities in this example compile and load the loader file:
|
||||
|
||||
| ?- logtalk_load(loader).
|
||||
|
||||
This folder contains examples of Logtalk implementations for popular
|
||||
logical puzzles.
|
||||
logical puzzles. The description of each puzzle can be found on the
|
||||
source files themselves.
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.1
|
||||
Release 2.17.2
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
% start by loading the example:
|
||||
|
||||
| ?- logtalk_load(loader).
|
||||
...
|
||||
|
||||
|
||||
% Harry Potter's room of potions logical puzzle:
|
||||
|
||||
| ?- potions::potions(P1, P2, P3, P4, P5, P6, P7).
|
||||
|
||||
@@ -41,21 +41,21 @@ Who owns the zebra and who drinks water?
|
||||
argnames is ['Solution']]).
|
||||
|
||||
houses(Solution) :-
|
||||
template(Solution), % 1
|
||||
template(Solution), % 1
|
||||
member(h(english, _, _, _, red), Solution), % 2
|
||||
member(h(spanish, dog, _, _, _), Solution), % 3
|
||||
member(h(_, _, _, coffee, green), Solution), % 4
|
||||
member(h(ukrainian, _, _, tea, _), Solution), % 5
|
||||
next(h(_, _, _, _, green), h(_, _, _, _, white), Solution), % 6
|
||||
member(h(_, snake, winston, _, _), Solution), % 7
|
||||
member(h(_, _, kool, _, yellow), Solution), % 8
|
||||
next(h(_, _, _, _, green), h(_, _, _, _, white), Solution), % 6
|
||||
member(h(_, snake, winston, _, _), Solution), % 7
|
||||
member(h(_, _, kool, _, yellow), Solution), % 8
|
||||
Solution = [_, _, h(_, _, _, milk, _), _, _], % 9
|
||||
Solution = [h(norwegian, _, _, _, _)| _], % 10
|
||||
next(h(_, fox, _, _, _), h(_, _, chesterfield, _, _), Solution), % 11
|
||||
next(h(_, _, kool, _, _), h(_, horse, _, _, _), Solution), % 12
|
||||
member(h(_, _, lucky, juice, _), Solution), % 13
|
||||
next(h(_, _, kool, _, _), h(_, horse, _, _, _), Solution), % 12
|
||||
member(h(_, _, lucky, juice, _), Solution), % 13
|
||||
member(h(japonese, _, kent, _, _), Solution), % 14
|
||||
next(h(norwegian, _, _, _, _), h(_, _, _, _, blue), Solution), % 15
|
||||
next(h(norwegian, _, _, _, _), h(_, _, _, _, blue), Solution), % 15
|
||||
member(h(_, _, _, water, _), Solution), % one of them drinks water
|
||||
member(h(_, zebra, _, _, _), Solution). % one of them owns a zebra
|
||||
|
||||
|
||||
9
Logtalk/examples/puzzles/loader.lgt
Normal file
9
Logtalk/examples/puzzles/loader.lgt
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
:- initialization(
|
||||
logtalk_load([
|
||||
potions,
|
||||
jam_thief,
|
||||
horses,
|
||||
houses,
|
||||
note,
|
||||
camp_swampy])).
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
The description of this puzzle is easily found on the web. For example:
|
||||
|
||||
http://www.csci.csusb.edu/dick/cs320/prolog/Potions.htm
|
||||
*/
|
||||
|
||||
|
||||
:- object(potions).
|
||||
|
||||
@@ -23,7 +29,7 @@
|
||||
contents(H1),
|
||||
list::select(P1, H1, H2),
|
||||
list::select(P7, H2, H3),
|
||||
P1 \= P7, P1 \= forward, P7 \= forward, % second clue
|
||||
P1 \= P7, P1 \= forward, P7 \= forward, % second clue
|
||||
list::select(P2, H3, H4),
|
||||
P2 \= poison,
|
||||
list::select(P3, H4, H5),
|
||||
|
||||
Reference in New Issue
Block a user