Question: 2 . ( 1 0 points ) [ Solve using a DLV program ] Game II: Orange and Purple ( Source: Alice in Puzzle Land:

2.(10 points)[Solve using a DLV program]
Game II: Orange and Purple (Source: Alice in Puzzle Land: A Carrollian Tale for Children
Under Eighty by Raymond Smullyan)
"Now," Tweedledum continued, "one or both of us will come out of the
house, each carrying either an orange or purple card, and he (we) will make statements. Then
you are to figure out who is who.
"Just a minute," said Alice, "you have not told me the significance
of the colors orange and purple. Does one of them signify lying and
the other truth-telling? And if so, which color means which?
"Ah, that's the most interesting part of the game!" said
Tweedledum. "You see, when I carry an orange card, it means
that I am telling the truth, and when I carry a purple card, it means
I am lying!
"Contrariwise," said Tweedledee, "when I carry an orange card, it
means I am lying, and when I carry a purple card, it means I am
telling the truth!
On the next round, both brothers came out
and made the following statements:
FIRST ONE: Our cards are of the same color.
SECOND ONE: Our cards are not of the same color.
Did the first or second person tell the truth?
[Hint: we need to know if first or second person told the truth. We did not ask what color are
the cards, or WHO the first speaker is. Each speaker is different. Each carries only one card.
Note that compared to Knight/Knave problems we (a) dont know the speaker name (b) both
could either be liars or truth tellers, depending on the card color.
So you need to consider 4 cases for each speaker (either Dum or Dee, and either purple or
orange). There may be more than one model of these sentences, but only one answer to the
question.
Use the dlv format used ie an example below
% There are three students, Dan, Henry, and John.
% Let d = "Dan got an A and not a B" and ~d = "Dan got a B and not an A".
% Let h = "Henry got an B and not a C" and ~h = "Henry got a C and not an B".
% Let j = "John got an B and not a C" and ~j = "John got a C and not an B".
% Dan could get A or B, and Henry and John could get B or C as their final grade.
d v ~d.
h v ~h.
j v ~j.
% If Dan gets an A then either Henry has a C or John has a B.
~h v j :- d.
% If John doesnt get a B then either Dan wont get an A or Henry wont get a C.
~d v h :- ~j.
% If John gets a B and Henry doesnt get a C then Dan wont get an A.
~d :- j, h.
% The output is {-d,-h,-j},{-d, h,-j},{-d,-h, j},{d,-h, j},{-d, h, j}.
% The only outputs where Henry and John receive the same grade are {-d,-h,-j} and {-d, h, j}.
% In both {-d,-h,-j} and {-d, h, j}, Dan did not get an A.
% So the answer is if John and Henry received the same final grade, Dan will not get an A.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!