From The Sunday Times, 10th August 1975 [link]
A farmer grows apples in an orchard divided into plots —three to the East and three to the West of a central path. The apples are of two types — for eating (Cox, Laxton, Pearmain) and for cider making (Tremlitt, Coppin, Kingston).
Adjacent plots contain apples of different basic type. The apples are of six colours (red, green, russet, golden, orange, yellow) and of six tastes (sweet, sour, acid, tart, pleasant, bitter).
They ripen at different times, either early or late in July, August and September. Those ripening in early or late September are in plots directly opposite. Those South of Pearmain do not ripen in August. Tart are directly West of the acid variety, which ripens in early August. Yellow apples and those maturing in late September are adjacent. Yellow and orange are of the same type. Orange are North of pleasant and also North of Pearmain. Kingstons are adjacent to golden. Green is South of bitter.
Cox ripen in early July, and Laxtons ripen early in a different month. Tremlitts are red, and Kingstons mature after Coppins, which are not sour.
If cider apples taste unpleasant, what are the characteristics of the apples in North East plot? (Name, colour, taste, ripens).
This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981).
I think the puzzle as published in The Sunday Times and in the book is open to interpretation, and my first attempt using a reasonable interpretation gave two solutions (neither of which are the published solution). After examining the given solution in the book I think the following wording is clearer:
A farmer grows apples in an orchard divided into plots — three to the East and three to the West of a central track. Adjacent plots are separated by a shared fence. The apples are of two basic types — for eating (Cox, Laxton, Pearmain) and for cider making (Tremlitt, Coppin, Kingston).
Neighbouring plots contain apples of different basic type. The apples are of six colours (red, green, russet, golden, orange, yellow) and of six tastes (sweet, sour, acid, tart, pleasant, bitter).
They ripen at different times, either early or late in July, August and September. Those ripening in early or late September are in plots directly opposite each other. Those directly South of Pearmain do not ripen in August. Tart are directly West of the acid variety, which ripens in early August. Yellow apples and those maturing in late September are in adjacent plots. Yellow and orange are of the same basic type. Orange are directly North of Permain, which are pleasant. Kingstons and golden are in adjacent plots. Green is directly South of bitter.
Cox ripen in early July, and Laxtons ripen early in a different month. Tremlitts are red, and Kingstons mature after Coppins, which are not sour.
If cider apples are neither pleasant nor sweet, what are the characteristics of the apples in North-East plot?
[teaser734]
Jim Randell 9:20 am on 27 September 2024 Permalink |
I used the [[
SubstitutedExpression]] solver from the enigma.py library to assign positions 1-5 in the queue to the forenames and surnames, such that the required conditions are met.We can then use the [[
filter_unique()]] function to select solutions from the viable assignments, such that knowing Alan’s surname gives a single solution for all names.The following Python program runs in 89ms. (Internal runtime is 5.8ms).
from enigma import (SubstitutedExpression, trim, filter_unique, update, peek, join, printf) # generate possible queues def queues(): # allocate positions 1-5 in the queue to: # # Alan = A; Brian = B; Colin = C; Dave = D; Ed = E # Smith = S; Jones = J; Rogers = R; Mason = M; Hall = H # p = SubstitutedExpression( [ # the surnames are not given in the correct order "A != S or B != J or C != R or D != M or E != H", # B is ahead of S, who is ahead of E "B < S", "S < E", # J is ahead of C, who is ahead of D, who is ahead of H "J < C", "C < D", "D < H", # M's neighbours (on different sides) are A and R "abs(A - R) = 2", "abs(A - M) = 1", "abs(R - M) = 1", ], base=6, digits=[1, 2, 3, 4, 5], distinct=["ABCDE", "SJRMH"], ) # solve the puzzle for s in p.solve(verbose=0): # assemble the queue q = ["??"] * 6 for k in "ABCDE": q[s[k]] = update(q[s[k]], [0], k) for k in "SJRMH": q[s[k]] = update(q[s[k]], [1], k) # return the queue yield trim(q, head=1) # knowing A's surname gives a unique solution f = (lambda q: peek(x for x in q if x[0] == 'A')) for q in filter_unique(queues(), f).unique: printf("{q}", q=join(q, sep=" "))Solution: Alan Smith is second in the queue.
The queue is as follows:
There are 5 candidate solutions:
The first of these is unique for AS. The next two both have AH, and the final two have AJ.
LikeLike
ruudvanderham 5:39 pm on 27 September 2024 Permalink |
import itertools for firstnames, lastnames in zip(itertools.repeat("Alan Brian Colin Dave Ed".split()), itertools.permutations("Smith Jones Rogers Mason Hall".split(), r=5)): for positions in itertools.permutations(range(1, 6)): position = {firstname: position for firstname, position in zip(firstnames, positions)} position.update({lastname: position for lastname, position in zip(lastnames, positions)}) if position["Brian"] < position["Smith"] < position["Ed"]: if position["Jones"] < position["Colin"] < position["Dave"] < position["Hall"]: if {position["Mason"] - position["Alan"], position["Mason"] - position["Rogers"]} == {-1, 1}: if list(lastnames) != "Smith Jones Rogers Mason Hall".split(): for firstname, lastname in zip(firstnames, lastnames): print(f"{firstname+ " "+lastname:12} {position[firstname]} ", end="") print()This prints:
So, it has to be Alan Smith (the others are not unique) and he is in second position.
LikeLike