# Enigmatic Code

Programming Enigma Puzzles

## Enigma 870: Cabinet reshuffle

From New Scientist #2025, 13th April 1996 [link]

The Prime Minister is showing his cabinet reshuffle to his private secretary.

PM: So it’s basically “all change” for these five posts.

PS: You’re moving John Cooper from Agriculture?

PM: Well, he has worked with Nora before, so he can take over from her when she moves [to] Education.

PS: And Mr Etcher leaves the Home Office to take over from Mr Archer?

PM: And his post is filled by the former Education Secretary.

PS: I knew Mrs Draper was unhappy at Health, but why move him (taps paper) to Agriculture?

PM: It was difficult, but Defence had to go to either John or Ken.

(Knock on door)

PM: Ah, come in Laura, I was just discussing your new post.

What is Laura’s new post? What is the full name of the new Defence Secretary? To which post does the old Defence Secretary move?

Enigma 87 was also about cabinet reshuffling.

A correction (made in the text above) was published with Enigma 871, stating that Nora should be moving to Education (not from Education, as originally published).

[enigma870]

### One response to “Enigma 870: Cabinet reshuffle”

1. Jim Randell 25 October 2021 at 10:37 am

The last names given are: C, E, A, D, ?. So we will use B for the missing last name to give: A, B, C, D, E.

The first names given are: J, N, K, L, ?. So we will use M for the missing first name to give: J, K, L, M, N.

There appear to be three men (JC, Mr E, Mr A, K?) and two women (N?, Mrs D, L?).

And the jobs are: Ag, Ed, Ho, He, De.

We can use the [[ `SubstitutedExpression` ]] solver from the enigma.py library to solve this puzzle.

The following run file executes in 70ms.

Run: [ @replit ]

```#!/usr/bin/env python3 -m enigma -r

# after positions are:
#
#  Ag = 0; Ed = 1; Ho = 2; He = 3; De = 4
#
# we assign first (ABCDE), last (JKLMN), before (PQRST) values from 0
# to 4 to indicate the post held after the reshuffle

SubstitutedExpression

--base=5 # for values 0-4
--distinct="ABCDE,JKLMN,PQRST"

# no post is the same before, after
--invalid="0,P"
--invalid="1,Q"
--invalid="2,R"
--invalid="3,S"
--invalid="4,T"

# A and E are male (J, K, M)
"A in {J, K, M}"
"E in {J, K, M}"

# D is female (L, N)
"D in {L, N}"

# JC was Ag (= 0)
"C = J"
"(P, Q, R, S, T)[C] = 0"

# JC takes over from N, when N moves to Ed (= 1)
"1 = N"
"C = Q"

# E leaves Ho (= 2) to take over from A
"(P, Q, R, S, T)[E] = 2"
"(P, Q, R, S, T)[A] = E"

# E's former post (= Ho = 2) is filled by former Ed (= 1)
"(P, Q, R, S, T).index(1) = 2"

# D was at He (= 3)
"(P, Q, R, S, T)[D] = 3"
# male (J, K, M) moves to Ag (= 0)
"(P, Q, R, S, T).index(0) in {J, K, M}"

# De (= 4) goes to J or K
"4 in {J, K}"

# make sure B is filled out
"B >= 0"

--template=""
```

Which tells is the situation is:

Agriculture: M… Archer (formerly: Defence)
Education: Nora Draper (formerly: Health)
Home Sec: Laura B… (formerly: Education)
Health: John Cooper (formerly: Agriculture)
Defence: Ken Etcher (formerly: Home Sec)

Solution: Laura becomes Home Secretary. The new Defence Secretary is Ken Etcher. The old Defence Secretary moves to Agriculture.

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