J. Weldon Wolfingham, Jr. will marry one of these women: Adrianna, Bianca, and Claire.
Some clues are furnished hereunder as follows:
1. Of Adrianna and Bianca:
• (a) Either they are both have blue eyes, or neither has blue eyes.
• (b) One has red hair and the other does not.
2. Of Adrianna and Claire:
• (a) Either they both have red hair, or neither has red hair.
• (b) One is 5'11" and the other is not.
3. Of Bianca and Claire:
• (a) One has blue eyes and the other does not.
• (b) One is 5'11" and the other is not.
4. Of the three characteristics - blue eyes, red hair and 5'11":
• (a) If any of the three women has exactly two of the three characteristics, Mr. Wolfingham will marry the one with the least number of characteristics.
• (b) If any of the three women has exactly one of the three characteristics, Mr. Wolfingham will marry the one with the greatest number of characteristics.
Who will Mr. Wolfingham marry?
traitList= logical.empty(0,3);
for blue=[true false]
for red=[true false]
for five11=[true false]
traits=[blue red five11];
traitList(end+1,:)=traits;
end
end
end
for a=1:8
traitSet=traitList(a,:);
for b=1:8
traitSet(2,:)=traitList(b,:);
for c=1:8
traitSet(3,:)=traitList(c,:);
good=true;
if traitSet(1,1)~=traitSet(2,1) good=false; continue
end
if xor(traitSet(1,2),traitSet(2,2))==0 good=false; continue
end
if traitSet(1,2)~=traitSet(3,2) good=false; continue
end
if xor(traitSet(1,3),traitSet(3,3))==0 good=false; continue
end
if xor(traitSet(2,1),traitSet(3,1))==0 good=false; continue
end
if xor(traitSet(2,3),traitSet(3,3))==0 good=false; continue
end
disp(traitSet)
disp(' ')
end
end
end
finds (annotated output -- 1 represents having the feature)
blue red 5'11"
eyes hair
A 1 1 1
B 1 0 1 Makes 4 inconsistent
C 0 1 0
A 1 1 0
B 1 0 0 Makes 4 inconsistent
C 0 1 1
A 1 0 1
B 1 1 1 Claire is the fiancee
C 0 0 0
A 1 0 0
B 1 1 0 Makes 4 inconsistent
C 0 0 1
A 0 1 1
B 0 0 1 Makes 4 inconsistent
C 1 1 0
A 0 1 0
B 0 0 0 Claire is the fiancee
C 1 1 1
A 0 0 1
B 0 1 1 Makes 4 inconsistent
C 1 0 0
A 0 0 0
B 0 1 0 Makes 4 inconsistent
C 1 0 1
So Claire is the fiancee.
Edited on March 1, 2023, 9:30 am
|
Posted by Charlie
on 2023-03-01 09:29:43 |