All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Burger Buddies (Posted on 2003-11-27)
Three people decide to go out for burgers. They are either Knights, which always tell the truth, Knaves, which tell truths and lies in an alternating pattern, or Liars, which always tell lies.

They each want a burger, and want to get 4 toppings from the list of 7 (ketchup, mustard, onions, relish, tomato, cheese, lettuce) and give their order as follows:

A: I want ketchup, mustard, onions, lettuce, relish.

B: A wants tomato too, and he doesn't want mustard. I want ketchup, tomato, cheese, lettuce.

C: B doesn't want ketchup, and he doesn't want mustard. A doesn't want relish. I want mustard, tomato, cheese, lettuce.

After giving the orders to the burger cooker, he figures out what they want.(as anyone who can cook well must be really intelligent)

If all three people didn't all want a certain topping, what do the three people actually want as their four toppings on their burger?

(Note: I placed commas and periods to remind that each item/statement separated by commas is a separate statement.)

 See The Solution Submitted by Gamer Rating: 4.2000 (10 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: A consistent set--confirmation -- 3 Solutions | Comment 7 of 18 |
(In reply to A consistent set by Charlie)

The following are the possibilities, each set listing, for each of the buddies, the initials of the four condiments he wanted, plus the number of true odd-numbered statements he made and the number of true even-numbered statements he made:

kort 3 0
ktcl 3 3
kmoc 0 3

kort 3 0
ktcl 3 3
kmrc 0 3

kort 3 0
ktcl 3 3
morc 0 3

In each instance A and C were knaves and B a knight. In each instance A had ketchup, onions, relish and tomato, while B had ketchup, tomato, cheese and lettuce. C does indeed have mustard and cheese in each instance, but could have any pair out of relish, ketchup and onions.

The program to find this is:
DECLARE FUNCTION present! (person!, condi\$)
DECLARE SUB vary (person!)
DIM SHARED list\$
list\$ = "kmortcl"
DIM SHARED st\$(3), p1(3), p2(3)

vary 1

FUNCTION present (person, condi\$)
IF INSTR(st\$(person), condi\$) > 0 THEN present = 1: ELSE present = 0
END FUNCTION

SUB vary (person)
st\$(person) = SPACE\$(4)
FOR i = 1 TO 4
MID\$(st\$(person), 1, 1) = MID\$(list\$, i, 1)
FOR j = i + 1 TO 5
MID\$(st\$(person), 2, 1) = MID\$(list\$, j, 1)
FOR k = j + 1 TO 6
MID\$(st\$(person), 3, 1) = MID\$(list\$, k, 1)
FOR l = k + 1 TO 7
MID\$(st\$(person), 4, 1) = MID\$(list\$, l, 1)
IF person = 1 THEN
p1 = present(person, "k") + present(person, "o") + present(person, "r")
p2 = present(person, "m") + present(person, "l")
IF p1 <> 0 AND p1 <> 3 OR p2 <> 0 AND p2 <> 2 THEN GOTO notThis
p1(1) = p1: p2(1) = p2
END IF
IF person = 2 THEN
p1 = present(1, "t") + present(person, "k") + present(person, "c")
p2 = 1 - present(1, "m") + present(person, "t") + present(person, "l")
IF p1 <> 0 AND p1 <> 3 OR p2 <> 0 AND p2 <> 3 THEN GOTO notThis
p1(2) = p1: p2(2) = p2
END IF
IF person = 3 THEN
p1 = 1 - present(2, "k") + 1 - present(1, "r") + present(person, "t") + present(person, "l")
p2 = 1 - present(2, "m") + present(person, "m") + present(person, "c")
IF p1 <> 0 AND p1 <> 4 OR p2 <> 0 AND p2 <> 3 THEN GOTO notThis
p1(3) = p1: p2(3) = p2
END IF
IF person < 3 THEN
vary person + 1
ELSE
FOR p = 1 TO 3
PRINT st\$(p), p1(p), p2(p)
NEXT
PRINT
END IF

notThis:
NEXT
NEXT
NEXT
NEXT
END SUB

 Posted by Charlie on 2003-11-28 01:39:27

 Search: Search body:
Forums (0)