Created
March 5, 2024 22:36
Revisions
-
lakshayg created this gist
Mar 5, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ person(knight). person(knave). persons(List) :- maplist(person, List). claim(knight, Stmt) :- Stmt. claim(knave, Stmt) :- \+Stmt. % A puzzle taken from https://dmackinnon1.github.io/knaves/ % You have met a group of 6 islanders. Their names are Justin, Samuel, Ira, Frank, Beatrix, and Pamela. % % Samuel says: Ira is a knight. % Samuel says: Justin lies. % Beatrix says: Frank never lies. % Beatrix says: Pamela tells the truth. % Ira says: Frank is a knight or I am a knave. puzzle(J, S, I, F, B, P) :- persons([J, S, I, F, B, P]), claim(S, I = knight), claim(S, J = knave), claim(B, F = knight), claim(B, P = knight), claim(I, (F = knight; I = knave)).