Enigmatic Code

Programming Enigma Puzzles

Enigma 196: Think of a letter

From New Scientist #1342, 27th January 1983 [link]

Plink: “Let’s play ‘Think of a letter’.”
Plonk: “How do you play that?”
Plink: “Well, think of a letter.”
Plonk: “Right, I’ve done that.”
Plink: “Now I’m going to ask you seven questions about it.”
Plonk: “Shoot.”
Plink: “How many of the seven questions are you going to answer truthfully?”
Plonk: “Three.”
Plink: “Is your letter in CARTHORSE?”
Plonk: “Yes.”
Plink: “Is it in SENATORIAL?”
Plonk: “No.”
Plink: “Is it in INDETERMINABLES?”
Plonk: “No.”
Plink: “Is it in REALISATION?”
Plonk: “Yes.”
Plink: “Is it in ORCHESTRA?”
Plonk: “No.”
Plink: “Is it in ANTIDISESTABLISHMENTARIANISM?”
Plonk: “Yes.”
Plink: “Then I deduce your letter to be …”

What?

[enigma196]

Advertisements

2 responses to “Enigma 196: Think of a letter

  1. Jim Randell 3 June 2014 at 8:12 am

    The candidate words and Plonk’s answers have been chosen to allow the answer to be deduced by analysis. But programatically a brute force approach does just as good a job in 39ms.

    from enigma import printf
    
    # the words chosen
    words = (
      'CARTHORSE',
      'SENATORIAL',
      'INDETERMINABLES',
      'REALISATION',
      'ORCHESTRA',
      'ANTIDISESTABLISHMENTARIANISM'
    )
    
    # the answers for the words
    answers = (True, False, False, True, False, True)
    
    # choose a letter
    for x in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
    
      # evaluate the statements
      ss = list(x in w for w in words)
    
      # how many are answered correctly
      n = sum(1 for (a, b) in zip(ss, answers) if a == b)
    
      # if Plonk answered the first (meta) question truthfully he
      # would then have to answer two further questions correctly
      if n == 2:
        printf("letter = {x} [q1 = true] {ss} {n}", n=n + 1)
    
      # but if he answered the first question untruthfully then he
      # must answer any number but three of the remaining questions correctly
      if n != 3:
        printf("letter = {x} [q1 = false] {ss} {n}")
    

    Solution: The letter Plonk chose is ‘H’.

    • Jim Randell 3 June 2014 at 8:19 am

      Analytically we can consider the problem like this:

      If we consider the six candidate words in pairs, and equate them by their letter content we see:

      CARTHORSE = ORCHESTRA
      SENATORIAL = REALISATION
      INDETERMINABLES + H = ANTIDISESTABLISHMENTARIANISM

      And for each pair Plonk gave both a “Yes” and a “No” answer.

      Which means if his letter was any letter other than H he has answered exactly three of these six questions correctly. However this situation is precluded by the first question, where he states he will answer exactly three questions correctly. This statement cannot be either true or false.

      Hence the letter chosen is H, and Plonk answers four of the last six questions correctly, and the the answer to the first question is incorrect.

Leave a Comment

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

%d bloggers like this: