Riddle Thread

This is a discussion on Riddle Thread within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Oops, you are right. I didn't get it in the first place, so I wrote down this table: Code: BBB ...

  1. #91
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312

    Yet another riddle

    Oops, you are right. I didn't get it in the first place, so I wrote down this table:

    Code:
    BBB
    WBB   
    BBW   B
    BWB
    BWW   A
    WBW   B
    WWB
    The table lists all possible sticker combinations. If the 3-letter-combination is followed by another letter, then this letter denotes the dwarf that says the right answer. What I didn't see was the fact that every combination that is not answered by A or B ends with "black", so if A and B remain silent, C knows that his hat is black. Stupid me.

    Greets,
    Philip
    Last edited by CornedBee; 03-28-2009 at 11:58 AM.
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  2. #92
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312

    Bonus Riddle

    If the dwarves are allowed to move, I have another solution:

    The last dwarf (the one who can't see any other dwarf) moves forward one step. The next dwarf walks right next to him. Then comes the third, the fourth and so on. If a dwarf only sees hats of the same color, he goes to one side of the line. If a dwarf sees hats with different colors, then he goes to the spot right between the black and the white hat. All other dwarves then do the same. This way, the dwarves are separated into two groups, where each group has the same hat color. It's easily imaginable how every dwarf except the last one now knows his own hat color (without having seen the hats behind him), but it seems too messy to write it down.

    This solution respects all constraints (as my first solution), but it may be considered cheating as the walking part communicates further information.


    I'm pretty sure now that there is some sort of "cheating" involved here, because after the first dwarf did his guess (or hint), the next dwarf must stick to this proposal without being able to communicate further information just by saying "black" or "white" (if the optimal solution saves n-1 dwarfs).

    Greets,
    Philip
    Last edited by CornedBee; 03-28-2009 at 11:59 AM.
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  3. #93
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,714

    Bonus Riddle

    Maybe we could teach the dwarves morse code.
    Last edited by CornedBee; 03-28-2009 at 11:59 AM.

  4. #94
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312

    Bonus Riddle

    Maybe we could teach the dwarves morse code.
    It may even work without making pauses. Are the dwarves allowed to call out their presumed hat color more than once?

    Greets,
    Philip
    Last edited by CornedBee; 03-28-2009 at 11:59 AM.
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  5. #95
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893

    Bonus Riddle

    I think this is about parity. The dwarf who sees all hats (except his own) counts the black hats. If there's an even number, he says his own is black, otherwise he says it's white.
    The next dwarf counts the number of black hats. If the number is even, and the previous dwarf said white, he knows that he's wearing a white hat, etc.
    Every further dwarf now learns the color of all hats before him except the first, because all guesses except the first are right. So he can follow the same strategy as the second dwarf.

    As an extra bonus, within a few generations the small dwarves have been bred out by trollish selection, and the dwarves will be on average tall enough to kill the troll.
    Last edited by CornedBee; 03-28-2009 at 11:59 AM.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #96
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640

    Bonus Riddle

    Dwarves can only say their guess once and no "cheating" is allowed. You can't pass any extra information. Also, moving around is not allowed.

    The bit string idea is good. I'll give you a big hint: don't look if you don't want to see it.










    hint --->
    P a r i t y
    <---
    Last edited by CornedBee; 03-28-2009 at 11:59 AM.

  7. #97
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312

    Bonus Riddle

    Grmbl. I already dismissed the parity approach. Should have thought it through...

    Anyway, very nice riddle!

    Greets,
    Philip
    Last edited by CornedBee; 03-28-2009 at 12:00 PM.
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  8. #98
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640

    Bonus Riddle

    In case people haven't clicked in to how it works, I'll wait until later to post the details of the solution.
    Last edited by CornedBee; 03-28-2009 at 12:00 PM.

  9. #99
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893

    50 dwarves in a cave

    (or, Yet Another Redundant Riddle)

    This is another dwarf/troll riddle. 50 dwarves are in a cave. As they want to leave, a group of trolls block the way. They pose the following challenge:
    They'll let out a single dwarf at a time. The dwarf will be given the usual black or white hat, which he cannot see. Outside, the dwarf must take a position and then stay there.
    When all dwarves are outside, their taken positions must be such that they're sorted, i.e. a single straight line can divide the white-hats from the black-hats. Otherwise, they all get eaten.

    Communication of any sort is strictly forbidden. The trolls have brought a mind-reader and will know about any cheating attempt. There's also enough trolls to prevent any escape attempt by those outside the cave.
    Last edited by CornedBee; 03-28-2009 at 11:32 AM. Reason: Merging
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #100
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262

    Bonus Riddle

    Ahhhhhhh of course. Parity, indeed. Really nice indeed!
    Missed that one
    Last edited by CornedBee; 03-28-2009 at 12:00 PM.

  11. #101
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640

    50 dwarves in a cave

    Can the dwarves exist in 50 dimensional space and the line be a 49-dimensional hyperplane?





    ok, I'm still thinking...
    Last edited by CornedBee; 03-28-2009 at 11:31 AM. Reason: Merging

  12. #102
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893

    50 dwarves in a cave

    Two-dimensional plane. The dwarves cannot fly.

    They have plenty of space, though.
    Last edited by CornedBee; 03-28-2009 at 11:32 AM. Reason: Merging
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #103
    Complete Beginner
    Join Date
    Feb 2009
    Posts
    312

    Bonus Riddle

    In case people haven't clicked in to how it works, I'll wait until later to post the details of the solution.
    CornedBee already has.

    Greets,
    Philip
    Last edited by CornedBee; 03-28-2009 at 12:00 PM.
    All things begin as source code.
    Source code begins with an empty file.
    -- Tao Te Chip

  14. #104
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Ok, for those who may have been following but haven't quite figured out the one I've posted, here's a solution. It's a simple error correcting code.

    The dwarves agree that the last dwarf will count the number of white hats and yell out "white" if there is an even number, and "black" if there is an odd number. The next dwarf can then count the hats in front of him, and know his hat colour as it will balance out the number of white hats as being either even or odd. The next dwarf can count the hats in front of him, and has heard the colour of the previous dwarf, and can again determine his hat colour to balance partiy. It continues with each dwarf seeing the hats in front of him, and having heard the hat colours before him.


    I'm still thinking about Corned Bee's problem...

  15. #105
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    oh hey, I didn't even see Corned Bee's solution to the one I posted. nice one!


    I figured out Corned Bee's Riddle. I kept trying to think of it geometrically, but it's much simpler than that. You just always insert yourself in the "middle" of the black and white hats in a line. that way you'll be part of either group. If there's only one colour you can be at an arbitrary end of the line.

Page 7 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thread Synchronization in Win32
    By passionate_guy in forum C Programming
    Replies: 0
    Last Post: 02-06-2006, 04:34 AM
  2. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 03:55 PM
  3. Win32 Thread Object Model Revisted
    By Codeplug in forum Windows Programming
    Replies: 5
    Last Post: 12-15-2004, 07:50 AM
  4. Simple thread object model (my first post)
    By Codeplug in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2004, 10:34 PM
  5. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21