Teaser 3350: Action station
From The Sunday Times, 6th December 2026 [link] [link]
The last 2km into the Penzance Railway Terminus is single track (ST) with a level crossing (LC) halfway and a 30km/hr speed limit. At 0900, the station’s four platforms had one train just in and one ready to leave; the minimum turnaround time is ten minutes. The LC opens for vehicles for exactly one minute; it stays closed while a train approaches from either direction on the ST but may open the instant it passes. Vehicles’ wait times at the crossing are no more than seven minutes. Trains simultaneously on the ST must stay at least 1km apart. The number of trains that departed Penzance in the following hour, including any that departed at precisely 0900 or 1000, was the highest possible, given the above conditions.
How many trains was that?
[teaser3350]






Jim Randell 12:00 pm on 6 December 2026 Permalink |
Another train puzzle!
It seems like the rules are open to some interpretation.
I am assuming that trains leaving (or arriving at) the station can instantly accelerate from 0 to 30 km/h (or decelerate from 30 km/h to 0). And although trains travelling in the same direction on the single track have to ensure they are at least 1km apart, it seems like at either end of the single track we are to allow “near misses” (i.e. a train going one way can occupy a section of track immediately a train going the other way leaves it).
From the text it seems like a train arriving at the station cannot occupy the same platform as a train departing at the same time.
I also assumed trains themselves are indivisible units, and a train that arrives at the station leaves it without splitting or joining with other trains.
It does however seem that the maximum possible number of departures is the same under various reasonable interpretations of the rules.
Here is a Python program that examines possible situations.
You can pass
0or1on the command-line to enable danger mode (when near misses will be allowed). It is off by default.It does not output the constructed timetable (list of departures, arrivals, and level-crossing times), but I can augment the program to provide an example scenario.
It runs in 1.89s.
from enigma import (Accumulator, inf, update, cache, arg, printf) danger = arg(0, 0, int) # 1 to allow "near miss" if danger: printf("[danger enabled! near misses allowed]") # state is: # st = trains in the station (remaining minutes before available) N = 4 # number of platforms W = 10 # wait time before available to depart # tr = track sections (-1 = train approaching; +1 train leaving) (A, D, X) = (-1, +1, 0) # lc = time after open T = 7 # max wait time # generate states for the crossing def crossing(st, tr, lc, close): if lc < T: # close the crossing yield (st, tr, lc + 1) if not close: # open the crossing yield (st, tr, 0) # generate possible next states def next_state(state): (st0, tr0, lc) = state # tick down any trains in the station st = tuple((x - 1 if x > 0 else 0) for x in st0) # move any trains on the track tr = [X] * 4 for (i, v) in enumerate(tr0): if v == X: continue if v == A and i > 0: tr[i - 1] = A if v == D and i < 3: tr[i + 1] = D tr = tuple(tr) # does the level crossing need to be closed? close = ((lc == 0) or (tr[0] == D or tr[1] == D or tr[2] == A or tr[3] == A)) # deal with a train arriving at the station if tr0[0] == A: # is there an empty platform? if len(st) == N: return st += (W,) # we could do nothing else yield from crossing(st, tr, lc, close) # can we add another arriving train? if D not in tr and tr[2] == tr[3] == X and (danger or tr0[3] == X): yield from crossing(st, update(tr, [3], [A]), lc, 1) # is there a train ready to depart? if st and st[0] == 0 and A not in tr and tr[0] == tr[1] == X and (danger or tr0[0] == X): yield from crossing(st[1:], update(tr, [0], [D]), lc, 1) # find max departures with <t> remaining ticks from <state> @cache def solve(t, f, state): # are we done? if t >= f: # make sure the level crossing can be opened (_, _, lc) = state if lc == 0: return 0 # otherwise, find the next state that maximises the number of departures r = Accumulator(fn=max, value=-inf) for (st, tr, lc) in next_state(state): # look for a new departure d = (t < f and tr[0] == D) r.accumulate(d + solve(t + 1, f, (st, tr, lc))) return r.value # possible start states starts = [ ((1,), (A, X, X, X), 0), # 1 incoming train ((1,), (A, X, A, X), 4), # 2 incoming trains ((1,), (A, X, X, A), 1), # 2 incoming trains ] # solve for each start state for state in starts: # run the puzzle for 61 ticks (= 0900 -> 1000 inclusive) n = solve(0, 61, state) printf("{n} deps [start = {state}]")Solution: [To Be Revealed]
LikeLike