Analytics Strategist

September 17, 2015

Cheryl’s Birthday Riddle – the Sequel

Filed under: Puzzles — Tags: , , , , — Huayin Wang @ 6:49 pm

Rumor has it that Cheryl was not happy about the way Albert and Bernard sharing information through their seemingly innocuous comments in the Cheryl’s Birthday Riddle (CBR) game.

“That was cheating!” said Cheryl.  “I would’ve been really impressed if you’d done it without all the trick.”  Upon hearing this, Albert and Bernard fell into deep thought.  A long silence later, Bernard said, “Cheryl, pick any date from that list, I’ll be able to find it out”; “with your help of course”, Bernard winked.  And thus began the sequel to CBR:

Cheryl determined to make sure no information is leaked; she put each date on a piece of paper, month written on one side and day written on the other side; and all ten pieces in a hat.

Cheryl picked a date from the hat, showed Albert the month and Bernard the day, without looking at the date herself.

Cheryl asked Bernard, “So, do you know the date?”  “No, not yet,” replied Bernard.

Cheryl turned to Albert:  “Do you know it?”  “Neither do I,” Albert replied.

Cheryl smiled, “I guess nobody in this room knows the date”.

Bernard piped up:  “Actually, I think I know it now.”

Albert: “I am still in the dark.”

Cheryl: “Good, I am not the only one.”

Bernard: “Now, I am certain I have it right”

Albert: “Ok, I know it too.”

“Me three”, said Cheryl, wearing a big smile on her face.

All three of them had the same date.  What is it?

Advertisements

3 Comments »

  1. The first clue for solving this is to ask the following: when Bernard has in mind in when he said that he will be able to figure out the date for ANY date Cheryl pick. He is essentially claiming a strategy allowing him to find out the date, for every single date on that list. How?

    Recall that list of date again, it seems that Bernard should not be able to do that all by himself, so he has to use some clue, which will be a “yes/no” answer from Albert. With that understanding, you need to figure out if there exist any scheme at all that allows Bernard to do it.

    Comment by Huayin Wang — September 22, 2015 @ 10:03 pm

  2. The answer is Aug 14. You probably can tell that I am quite pessimistic that anyone would be interested enough to work on it and figure it out, which is quite OK for me.

    Comment by Huayin Wang — September 23, 2015 @ 1:56 am

  3. I wrote a python script to check my thought .and logic, it turns out this particular Sequel was ill-specified. Sorry.

    The python code with comments is below:

    def gen_month_rules(dates, d_rule):
        r = {}
        cnt = 0
        for m,d in dates:
            rr = r.setdefault(d in d_rule, {})
            rr.setdefault(m, set()).add(d)
        for y_n, v in r.items():
            r[y_n] = set( [m for m, ds in v.items() if len(ds) == 1] )
        return r
    
    def validate_rule(dates, day_rule_0):
        month_rules = gen_month_rules(dates, day_rule_0)
        D2M = {}
        M2D = {}
        for m,d in dates:
            b = d in day_rule_0
            a = m in month_rules[b]
            D2M.setdefault((d,a), set()).add((m,d))
            M2D.setdefault((m,b), set()).add((m,d))
        r1 = max( [len(x) for x in D2M.values()] ) == 1
        r2 = max( [len(x) for x in M2D.values()] ) == 1
        return (r1,r2)
    
    def find_valid_rules(dates):
        all_rules = [[]]
        for x in (14,15,16,17,18,19):
            all_rules = all_rules + [y + [x] for y in all_rules]
        for rule in all_rules:
            r1,r2 = validate_rule(dates, rule)
            if r1 and r2: print rule, r1, r2
    
    dates = [ (5,15), (5,16), (5,19), (6,17), (6,18), (7,14), (7,16), (8,14), (8,15), (8,17) ]
    print find_valid_rules(dates)
    

    Comment by Huayin Wang — October 23, 2015 @ 9:10 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: