Enigmatic Code

Programming Enigma Puzzles

Enigma 537: The three sisters

From New Scientist #1689, 4th November 1989 [link] [link]

Sarah, Tora and Ursula are three sisters. One of them is honest, one always lies, and the third is simply unreliable.

Tora told me that the youngest of the three is fatter than the liar, and the oldest of the three told me that the fattest is older than the honest one. But Ursula and the thinnest sister both agreed that the oldest sister always lies.

The fattest sister and the oldest sister both agreed that Sarah always lies. Then the youngest sister whispered to Sarah who then claimed that the youngest had said that Ursula was the fattest.

Who is the honest sister?
Who is the fattest sister?
Who is the youngest sister?

[enigma537]

One response to “Enigma 537: The three sisters

  1. Jim Randell 17 February 2020 at 8:03 am

    A similar puzzle to Enigma 1079.

    The following Python program runs in 85ms.

    Run: [ @repl.it ]

    from itertools import product, permutations
    from enigma import printf
    
    # Honest = always tells the truth
    def H(ss):
      return all(ss)
    
    # Dishonest = never tells the truth
    def D(ss):
      return not any(ss)
    
    # Unreliable = may say anything
    def X(ss):
      return True
    
    # check statement <s> would be made by _different_ behaviour <fns>
    def check(fn, *ss):
      return fn(ss)
    
    # indices for the girls
    girls = (S, T, U) = (0, 1, 2)
    
    # choose characteristics for the three girls
    # age: (youngest, middle, oldest) -> index
    # size: (thinnest, middle, fattest) -> index
    # behaviour: index -> (H, D, X)
    for (age, size, b) in product(permutations(girls), repeat=3):
      behaviour = tuple((H, D, X)[x] for x in b)
    
      # T: "the youngest is fatter than the liar"
      s = (size.index(age[0]) > size.index(behaviour.index(D)))
      if not check(behaviour[T], s): continue
    
      # oldest: "fattest is older than the honest one"
      s = (age.index(size[-1]) > age.index(behaviour.index(H)))
      if not check(behaviour[age[-1]], s): continue
    
      # U and thinnest (so U is not the thinnest): "oldest sister always lies"
      if size[0] == U: continue
      s = (behaviour[age[-1]] == D)
      if not(check(behaviour[U], s) and check(behaviour[size[0]], s)): continue
    
      # fattest and oldest (so fattest is not oldest): "S always lies"
      if size[-1] == age[-1]: continue
      s = (behaviour[S] == D)
      if not(check(behaviour[size[-1]], s) and check(behaviour[age[-1]], s)): continue
    
      # S (so S is not youngest): "youngest said U is fattest"
      if age[0] == S: continue
      s = (check(behaviour[age[0]], size[-1] == U))
      if not check(behaviour[S], s): continue
    
      # output solution
      for (n, i) in zip("STU", girls):
        printf("{n}: age = {a}, size = {h}, behaviour = {t}",
          a=("youngest", "middle", "eldest")[age.index(i)],
          h=("thinnest", "middle", "fattest")[size.index(i)],
          t=("honest", "dishonest", "unreliable")[b[i]],
        )
      printf()
    

    Solution: Tora is honest, fattest and youngest.

    The characteristics of each sister are:

    Sarah: age = middle, size = thinnest, behaviour = dishonest
    Tora: age = youngest, size = fattest, behaviour = honest
    Ursula: age = eldest, size = middle, behaviour = unreliable

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: