Enigmatic Code

Programming Enigma Puzzles

Enigma 274: College angles

From New Scientist #1421, 13th September 1984 [link]

The heads of eight colleges are four married couples. The colleges are so sited that the chapel towers of all are visible from the towers of all the others. To ensure that the bedrock on which all are built is not shifting, each head daily at noon ascends his tower and checks the range and bearing of each of the others. It is interesting, is it not, that in doing so he or she never has to traverse his sextant by less than a quarter of a right-angle — nor of course by more than two right angles.

Each male head is a different distance from his wife. Mrs B is due east of Mr B, while Mrs A is due southwest of Mr A. Mr D is closer to Mrs D than Mr C to Mrs C.

Through what angle must Mr D turn his sextant in traversing from Mr C to Mrs C?



One response to “Enigma 274: College angles

  1. Jim Randell 19 April 2015 at 8:03 am

    This Python program runs in 43ms

    # if we place the towers equidistantly around a circle then for each
    # point when we measure the angles to the remaining points (assuming
    # none have moved) then the angle subtended by two adjacent points is
    # always 22.5 degrees = a quarter of a right angle, so this
    # arrangement fits the problem statement
    from itertools import permutations, combinations
    from enigma import irange, is_distinct, printf
    # consider the positions around the circle as 0 to 7, then the angle
    # from X to Y is (in quarters of a right angle)
    def angle(X, Y):
      if X == Y: return 0
      return 2 * X + (Y - X) % 8
    # and the distances fall into 4 categories
    def distance(X, Y):
      d = abs(X - Y)
      return (d if d < 5 else 8 - d)
    # let's assign Mr B to point 0
    MrB = 0
    # and consider the remaining points
    points = set(irange(1, 7))
    # and choose a point for Mrs B
    for MrsB in points:
      # Mrs B is due E from Mr B
      E = angle(MrB, MrsB)
      # and note the distance between the B's
      dB = distance(MrB, MrsB)
      # now we choose points for Mrs A and Mr A
      pts1 = points.difference([MrsB])
      for (MrsA, MrA) in permutations(pts1, 2):
        # the distance must be different
        dA = distance(MrA, MrsA)
        if not is_distinct(dA, dB): continue
        # and the angle from Mr A to Mrs A must be SW (= E + 225 degrees)
        SW = angle(MrA, MrsA)
        if not(SW == E + 10): continue
        # choose points for Mr C and Mrs C
        pts2 = pts1.difference([MrA, MrsA])
        for Cs in combinations(pts2, 2):
          # the distance must be different
          dC = distance(*Cs)
          if not is_distinct(dC, dA, dB): continue
          # and the remaining points are Mr D and Mrs D
          Ds = tuple(pts2.difference(Cs))
          # the distance must be different and dD < dC
          dD = distance(*Ds)
          if not(is_distinct(dD, dA, dB) and dD < dC): continue
          # calculate the angles between the Cs as determined by the Ds
          angles = set(abs(angle(D, Cs[0]) - angle(D, Cs[1])) for D in Ds)
          printf("MrB={MrB} MrsB={MrsB} E={E} dB={dB} MrsA={MrsA} MrA={MrA} dA={dA} SW={SW} Cs={Cs} dC={dC} Ds={Ds} angles={angles}")

    Solution: Mr D must turn his sextant through 90° in traversing from Mr C to Mrs C.

    There are four different solutions, one pair where the B’s are located at adjacent points, and another pair where the B’s have two points between them. In all cases the C’s are located on opposite ends of a diameter, so from any of the other points (including either of the D’s) the angle they subtend is a right angle (as the triangle formed is inscribed within a semicircle – Thales’ Theorem).

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: