After recent events, Question Mark is annoyed with his brother, Skid Mark. Skid thought it would be funny to hide Question's wallet. He told Question that he would get it back if he finds it.
So, first off, Skid laid five colored keys in a row. One of them is a key to a room where Skid is hiding Question's wallet. Using the clues, can you determine the order of the keys and which is the right key?
Red: This key is somewhere to the left of the key to the door.
Blue: This key is not at one of the ends.
Green: This key is three spaces away from the key to the door (2 between).
Yellow: This key is next to the key to the door.
Orange: This key is in the middle.
colorCodes=perms('rbgyo');
for key=1:5
for i=1:length(colorCodes)
colors=colorCodes(i,:);
red=strfind(colors,'r');
blue=strfind(colors,'b');
green=strfind(colors,'g');
yellow=strfind(colors,'y');
orange=strfind(colors,'o');
if red<key
if blue>1 && blue < 5
if abs(green-key)==3
if abs(yellow-key)==1
if orange==3
disp(key)
disp(colors)
end
end
end
end
end
end
end
finds
>> theRightKey
4
groby
>>
meaning the blue key, in the 4th position, is the right key.
The order of the colors is green, red, orange, blue, yellow.
|
Posted by Charlie
on 2024-02-01 08:59:37 |