Skip to content

Instantly share code, notes, and snippets.

@htp

htp/jindosh.pl

Created Mar 11, 2017
Embed
What would you like to do?
A solution to the Jindosh Riddle from Dishonored 2, written in Prolog.
% At the dinner party were Lady Winslow, Doctor Marcolla,
% Countess Contee, Madam Natsiou, and Baroness Finch.
%
% The women sat in a row. They all wore different colors and
% Baroness Finch wore a jaunty green hat. Madam Natsiou was at
% the far left, next to the guest wearing a blue jacket. The lady in
% red sat left of someone in white. I remember that red outfit
% because the woman spilled her whiskey all over it. The traveler
% from Dunwall was dressed entirely in purple. When one of the
% dinner guests bragged about her Ring, the woman next to her
% said they were finer in Dunwall, where she lived.
%
% So Countess Contee showed off a prized War Medal, at which the
% lady from Karnaca scoffed, saying it was no match for her Snuff
% Tin. Someone else carried a valuable Bird Pendant and when
% she saw it, the visitor from Baleton next to her almost spilled her
% neighbor's absinthe. Doctor Marcolla raised her wine in toast.
% The lady from Dabokva, full of rum, jumped up onto the table,
% falling onto the guest in the center guest, spilling the poor
% woman's beer. Then Lady Winslow captivated them all with a
% story about her wild youth in Fraeport.
%
% In the morning, there were four heirlooms under the table: the
% Ring, Diamond, the Snuff Tin, and the Bird Pendant.
%
% But who owned each?
left_of(X, Y) :- X is Y-1.
right_of(X, Y) :- X is Y+1.
next_to(X, Y) :- left_of(X, Y).
next_to(X, Y) :- right_of(X, Y).
party(Guests) :-
Guests = [
guest(1, Name1, Heirloom1, Hometown1, Outfit1, Drink1),
guest(2, Name2, Heirloom2, Hometown2, Outfit2, Drink2),
guest(3, Name3, Heirloom3, Hometown3, Outfit3, Drink3),
guest(4, Name4, Heirloom4, Hometown4, Outfit4, Drink4),
guest(5, Name5, Heirloom5, Hometown5, Outfit5, Drink5)
],
member(guest(_, baroness_finch, _, _, green, _), Guests),
member(guest(1, madam_natsiou, _, _, _, _), Guests),
member(guest(2, _, _, _, blue, _), Guests),
member(guest(A, _, _, _, red, _), Guests),
member(guest(B, _, _, _, white, _), Guests),
left_of(A, B),
member(guest(_, _, _, _, red, whiskey), Guests),
member(guest(_, _, _, dunwall, purple, _), Guests),
member(guest(C, _, ring, _, _, _), Guests),
member(guest(D, _, _, dunwall, _, _), Guests),
next_to(C, D),
member(guest(_, countess_contee, medal, _, _, _), Guests),
member(guest(_, _, snuff_tin, karnaca, _, _), Guests),
member(guest(E, _, _, baleton, _, _), Guests),
member(guest(F, _, bird_pendant, _, _, _), Guests),
next_to(E, F),
member(guest(_, _, bird_pendant, _, _, absinthe), Guests),
member(guest(_, doctor_marcolla, _, _, _, wine), Guests),
member(guest(_, _, _, dabokva, _, rum), Guests),
member(guest(3, _, _, _, _, beer), Guests),
member(guest(_, lady_winslow, _, fraeport, _, _), Guests),
member(guest(_, _, diamond, _, _, _), Guests).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment