Enigmatic Code

Programming Enigma Puzzles

Enigma 240: The missing *

From New Scientist #1386, 1st December 1983 [link]

In an * to economise * the wording * my Enigmas * am this * experimenting with * new system * writing. In * system I * every third * with a *. It should * be possible * work out * is being * while saving * 33 per cent of * words in * process. This * puzzle is * five men, * names are (* conveniently) Arnold, *, Cedric, Derek * Eric. All * play for * local football *. One of * is goalkeeper * the other * play at * forward, outside *, outside right * centre half. * a quite * coincidence, the * also live * a row * five terraced * next to * other. Cedric * next door * the goalkeeper. * centre forward’s * are Derek * the outside *. The centre * lives at * end of * row, next * a player * has scored * more goal * Basil (who * not live * to the {*} right). Eric * at outside *. And finally, * lives fewer * away from * than Derek * from the *.

What are * positions of * five men? (* will appreciate * in cases * the word * in doubt, * most appropriate * be used, * known!)

Note: There appears to be a misprint in the original puzzle statement. I have inserted the * in braces into this puzzle so that every third word is replaced by a *. In this form the puzzle has a unique solution, without it I could not find a satisfactory solution.

[enigma240]

5 responses to “Enigma 240: The missing *

  1. Jim Randell 25 November 2014 at 8:17 am

    I started by filling out the missing words with what seemed to be the most sensible candidates, and got this:

    In an [attempt] to economise [on] the wording [in] my Enigmas [I] am this [week] experimenting with [a] new system [of] writing. In [this] system I [replace] every third [word] with a [star]. It should [still] be possible [to] work out [what] is being [asked] while saving [around] 33 per cent of [the] words in [the] process.

    This [particular] puzzle is [about] five men, [their] names are ([quite] conveniently) Arnold, [Basil], Cedric, Derek [and] Eric. All [five] play for [the] local football [team]. One of [them] is goalkeeper [and] the other [four] play at [centre] forward, outside [left], outside right [and] centre half. [By] a quite [astounding] coincidence, the [men] also live [in] a row [of] five terraced [houses] next to [each] other. Cedric [lives] next door [to] the goalkeeper. [The] centre forward’s [neighbours] are Derek [and] the outside [left/right][1]. The centre [half][2] lives at [one] end of [the] row, next [to] a player [who] has scored [one] more goal [than] Basil (who [does] not live [furthest?][3] to the right). Eric [plays] at outside [left/right][1]. And finally, [???][4] lives fewer [houses] away from [???][4] than Derek [lives] from the [goalkeeper][5].

    What are [the] positions of [the] five men?

    ([You] will appreciate [that] in cases [where] the word [is] in doubt, [the] most appropriate [should] be used, [if] known!)

    [1] There is nothing else to distinguish “outside left” and “outside right”.

    [2] The previous sentence implies that the centre forward has two distinct neighbours, and so cannot live at one end of the row. So this sentence must refer to the centre half.

    [3] I’m not sure about this one, but it’s the best fit I could think of.

    [4] I’m assuming the missing words here are names, but we don’t know which ones. So I take the final sentence to mean that Derek is not the goalkeeper, and does not live next door to the goalkeeper. (So there is a pair of people who live closer together than Derek lives to the goalkeeper).

    [5] “goalkeeper” is the only single word position.

    Which gives me the following statements:

    1. C lives next door to GK.

    2. CF’s neighbours are D and [OL/OR].

    3. CH lives at house 1 or house 5. B is not his neighbour.

    4. B does not live in house 5.

    5. E plays at [OL/OR].

    6. There is at least one house between D and GK.

    This program examines the possibilities.

    from itertools import permutations
    from collections import Counter
    from enigma import printf
    
    # people
    people = tuple('ABCDE')
    
    # positions
    positions = ('GK', 'CF', 'OL', 'OR', 'CH')
    
    # suppose the houses are 0, 1, 2, 3, 4 (left to right)
    
    # count the solutions
    r = Counter()
    
    # assign the people to the houses
    for n in permutations(people):
    
      # 4. B does not live in house 4
      if n[4] == 'B': continue
    
      # assign the positions to the houses
      for p in permutations(positions):
    
        # 1. C lives next to GK
        if abs(n.index('C') - p.index('GK')) != 1: continue
    
        # 2. CF lives next to D and OL/OR
        CF = p.index('CF')
        if CF in (0, 4): continue
        d = CF - n.index('D')
        if abs(d) != 1: continue
        if p[CF + d] not in ('OL', 'OR'): continue
    
        # 3. CH lives at 0 or 4, and his neighbour is not B
        CH = p.index('CH')
        if not((CH == 0 and n[1] != 'B') or (CH == 4 and n[3] != 'B')): continue
    
        # 5. E is OL/OR.
        E = n.index('E')
        if p[E] not in ('OL', 'OR'): continue
    
        # 6. D does not live next to GK
        if abs(n.index('D') - p.index('GK')) < 2: continue
    
        t = tuple(sorted(zip(n, p)))
        r[t] += 1
    
        printf("[{t}]", t=', '.join(x + '=' + y for (x, y) in zip(n, p)))
    
    
    for (k, v) in r.items():
      printf("{k}: {v} solutions", k=', '.join(x + '=' + y for (x, y) in k))
    

    It finds several solutions, which do not uniquely identify the positions of the men.

    And even if we were to know the names in [4] that still does not lead us to a unique solution as OL and OR can be swapped around in [1].

    The published solution is:

    Solution: Derek plays Centre Half; Arnold plays Centre Forward; Eric plays Outside Right; Cedric plays Outside Left; Basil plays Goalkeeper.

    These are in a strange order, so if we assume they are listed in the order of the houses we see that B does actually live in house 5, so my statement 4 is false, which means that my guess for [3] must be wrong.

    So I need to find a word that fits in: “Basil does not live [something] to the right”, which doesn’t preclude Basil living in the house furthest to the right. I still can’t think of one; “further” sort of fits, but would still preclude B living in house 5; “immediately” sort of fits too, (presumably meaning Basil does not live immediately to the right of the player who lives next to the centre half), but this doesn’t lead to a unique solution either.

    Even if we do change statement 4 to be “B lives in house 5”, there are still two solutions where OL/OR are interchanged:

    1=D,CH; 2=A,CF; 3=E,OL; 4=C,OR; 5=B,GK.
    1=D,CH; 2=A,CF; 3=E,OR; 4=C,OL; 5=B,GK. (The published solution).

    So, I am going to mark this puzzle as “flawed” unless someone can persuade me otherwise.

  2. Jim 25 November 2014 at 10:04 pm

    What if “right” was short for “outside right” and the asterisks just prior to “right” translated to “next” then wouldn’t the published solution be unique?

    • Jim Randell 25 November 2014 at 10:42 pm

      Yes, I think that does work. If we take the sentence as:

      The centre [half] lives at [one] end of [the] row, next [to] a player [who] has scored [one] more goal [than] Basil (who [does] not live [next] to the {outside} right).

      where “outside right” is implied by word “right”.

      Then I think there are two possible arrangements (one is the reverse of the other):

      1=B,GK; 2=C,OL; 3=E,OR; 4=A,CF; 5=D,CH.
      1=D,CH; 2=A,CF; 3=E,OR; 4=C,OL; 5=B,GK.

      The second of these matches the published solution in order given. But we are just asked for the positions the men play in, and these are the same for both arrangements.

      So this is an interpretation that gives rise to a unique answer, and furthermore it is the published answer.

      When I thought about ending the sentence “…(who does not live next to the right)”, I was thinking of it meaning that Basil does not live in the next house to the right of the player who has scored one more goal than Basil (who lives next to the centre half) – rather than meaning that Basil does not live next to the person who plays at outside right. I’m not sure if it is usual to refer to “outside right”, simply as “right”. But I am no expert on football, so it could be.

      To be honest I got a bit fed up with the problem as it seems to be saying: “make up your own problem and solve it, but it should match the solution I’m thinking of”.

      • Jim 25 November 2014 at 11:03 pm

        Yes I think your observations are correct. I did not care for this particular enigma.

      • Jim Randell 26 November 2014 at 8:22 am

        While trying to re-word the puzzle to give a better formulation I noticed that there is a misprint in the text of this puzzle. There is a * missing in that sentence, because there should be a * every third word. Maybe this is the missing * referred to by the title of the puzzle.

        So it should read:

        The centre * lives at * end of * row, next * a player * has scored * more goal * Basil (who * not live * to the * right).

        Which we would then fill out (using the most likely candidate words) as:

        The centre [half] lives at [one] end of [the] row, next [to] a player [who] has scored [one] more goal [than] Basil (who [does] not live [next] to the [outside] right).

        as you suggest.

        This changes statement 4 to be:

        4. B does not live next to OR.

        So here’s the modified program that checks that instead of the original 4. It runs in 46ms.

        from itertools import permutations
        from collections import Counter
        from enigma import printf
        
        # people
        people = tuple('ABCDE')
        
        # positions
        positions = ('GK', 'CF', 'OL', 'OR', 'CH')
        
        # suppose the houses are 0, 1, 2, 3, 4 (left to right)
        
        # count the solutions
        r = Counter()
        
        # assign the people to the houses
        for n in permutations(people):
        
          # assign the positions to the houses
          for p in permutations(positions):
        
            # 1. C lives next to GK
            if abs(n.index('C') - p.index('GK')) != 1: continue
        
            # 2. CF lives next to D and OL/OR
            CF = p.index('CF')
            if CF in (0, 4): continue
            d = CF - n.index('D')
            if abs(d) != 1: continue
            if p[CF + d] not in ('OL', 'OR'): continue
        
            # 3. CH lives at 0 or 4, and his neighbour is not B
            CH = p.index('CH')
            if not((CH == 0 and n[1] != 'B') or (CH == 4 and n[3] != 'B')): continue
        
            # 4. B does not live next to OR
            if abs(n.index('B') - p.index('OR')) == 1: continue
        
            # 5. E is OL/OR.
            E = n.index('E')
            if p[E] not in ('OL', 'OR'): continue
        
            # 6. D does not live next to GK
            if abs(n.index('D') - p.index('GK')) < 2: continue
        
            t = tuple(sorted(zip(n, p)))
            r[t] += 1
        
            printf("[{t}]", t=', '.join(x + '=' + y for (x, y) in zip(n, p)))
        
        
        for (k, v) in r.items():
          printf("{k}: {v} solutions", k=', '.join(x + '=' + y for (x, y) in k))
        

        Solution: Arnold plays Centre Forward; Basil plays Goalkeeper; Cedric plays Outside Left; Derek plays Centre Half; Eric plays Outside Right.

        There are two arrangements that give the solution (one is the reverse of the other):

        1=B,GK; 2=C,OL; 3=E,OR; 4=A,CF; 5=D,CH.
        1=D,CH; 2=A,CF; 3=E,OR; 4=C,OL; 5=B,GK.

        I will update the problem statement to reflect this.

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: