4 ms·
The author's interpretation of clue 2 seemed odd: % % 3. Clue 2: Barbara was either in the study or the bathroom; Yolanda was in the other. % % Which room
by waterhouse 8y ago
The author's interpretation of clue 2 seemed odd:
% % 3. Clue 2: Barbara was either in the study or the bathroom; Yolanda was in the other.
% % Which room was Barbara found in?
woman(Bathroom), woman(Study), \+christine=Bathroom, \+christine=Study,
\+barbara=Dining, \+barbara=Kitchen, \+barbara=Livingroom, \+barbara=Pantry,
I thought, surely there's a better way to write that, a way that closely resembles the English "either a and b, or c and d". And Prolog in fact has disjunctions. (Prolog noob here, first time I've ever run a Prolog program.) Thus:
(barbara=Study, yolanda=Bathroom ; barbara=Bathroom, yolanda=Study),
I verified that the program still works with that change, and the performance seems equivalent. (Takes about 7 seconds to run on my 1.3Ghz fanless laptop.)
- deleted 8y ago[deleted]