Title: Surf and Turf
Solved by: Doug Edmunds
Publication: Dell Logic Puzzles
Issue: February, 2000
Page: 38
Stars: 4

Clues

/*
Dell Logic Puzzles 2/2000 Edition pg:38 Title: Surf and Turf(4 star)
solved 8 Jan 2000

correct solution:
unit(g, c, steak, baked, lemonade, m)
unit(o, o, ribs, french, water, m)
unit(c, p, filet, mash, beer, f)
unit(p, t, crab, scal, tea, f)
unit(t, g, shrimp, lyon, ale, f)

*/

:- use_module(library(fd)).
:- writeln("type: start(Units)").

start(Units) :-

Units =
[
unit(g,_,_,_,_,m),
unit(o,_,_,_,_,m),
unit(c,_,_,_,_,f),
unit(p,_,_,_,_,f),
unit(t,_,_,_,_,f)
],
%Firsts = [FG,FO,FC,FP,FT],

Lasts = [LG,LO,LC,LP,LT],
Lasts ::[c,g,o,p,t],

Mains = [MG,MO,MC,MP,MT],
Mains :: [crab,filet,ribs,shrimp,steak],

Sides = [SG,SO,SC,SP,ST],
Sides :: [baked,french,lyon,mash,scal],

Bevs = [BG,BO,BC,BP,BT],
Bevs :: [ale,beer,lemonade,tea,water],


Constraints =
[
unit(g,LG,MG,SG,BG,m),
unit(o,LO,MO,SO,BO,m),
unit(c,LC,MC,SC,BC,f),
unit(p,LP,MP,SP,BP,f),
unit(t,LT,MT,ST,BT,f),

unit(FRibs,LRibs,ribs,_,_,_),
unit(_,p,MLP,SLP,BLP,_),
unit(FShrimp,LShrimp,shrimp,SShrimp,BShrimp,SexShrimp),

unit(FFilet,LFilet,filet,_,BFilet,_),
unit(_,_,MScal,scal,BScal,_),

unit(FBeer,_,_,_,beer,_),
unit(_,_,_,baked,_,SexBaked),

unit(FCrab,LCrab,crab,_,_,f),
unit(_,LMash,_,mash,_,_),

unit(FLem,_,_,_,lemonade,_),
unit(_,LLyon,_,lyon,_,_),

unit(FLc,c,_,SLc,_,_),
unit(_ ,t,_,SLt,BLt,_),

unit(FSteak,LSteak,steak,_,_,_)
] ,

alldifferent(Lasts),
alldifferent(Mains),
alldifferent(Sides),
alldifferent(Bevs),

%clue1
FRibs #= LRibs,
FCrab ## LCrab,
FFilet ## LFilet,
FShrimp ## LShrimp,
FSteak ## LSteak,

%clue2
MLP ## shrimp,
one_or_other(SLP,BLP,SShrimp,BShrimp),

%clue3
BFilet ## lemonade,

%clue4
MScal ## steak,
BScal ## water,

%clue5
FBeer #= LG,

%clue6
BT ## water,
%clue7
SexBaked ## SexShrimp,

%clue8
FCrab #= LMash,

%clue9
FLem #= LLyon,

%clue10
FLc ## p,
SLc ## french,
SLc ## lyon,

%clue11
SLt ## french,
SLt ## mash,
BLt ## ale,

%clue12
order_MC(MC),

psubset(Constraints, Units),
(foreach(Unit,Units)
do
writeln (Unit)
).


psubset([],_).
psubset([H|T],List) :-
member(H,List),
psubset(T,List).


one_or_other(SLP,_BLP,_SShrimp,BShrimp) :-
SLP #= lyon,
BShrimp #= beer.
one_or_other(_SLP,BLP,SShrimp,_BShrimp) :-
SShrimp #= lyon,
BLP #= beer.


order_MC(MC) :- MC #= filet.
order_MC(MC) :- MC #= steak.

% © Copyright Doug Edmunds 2000