James Shaw IV

Master Mind Marker

A device for generating and marking colour codes for the classic game

drawing of grey box alongside the Master Mind game
The Master Mind Marker and the classic game

My brother was very fond of playing Master Mind, the game using coloured plastic pegs and marketed by Invicta in the UK. The idea was to guess the order and colour of four pegs hidden behind a little shield, (displaced in the above illustration), making them only visible to the other player who had the role of marker. Having set up a guess of four pegs on the main playing area the marker would use up to four pegs, black or white, to indicate how good the guess had been.

If a peg had been correctly guessed both in colour and position then a black marker peg was used, right colour but wrong position, a white marker peg and if the peg neither matched in colour or position, no peg. Using this information the player set up a new guess and that would be marked in turn. By the use of logic new guesses would be set up eventually arriving at the correct arrangement.

Unfortunately the main player could take some time to consider the next move. In the meantime the marker could get bored and lose attention with the result that they might well give the wrong mark, making it impossible to use logic to get the right answer.

As a result I designed a Master Mind Marker which would allow my brother to play on his own and I gave it to him for his 21st birthday. This was just before microprocessors became freely available so it was implemented using TTL chips. The whole lot, power supply included, was housed in a sloping fronted box 160mm x 100mm x 60mm. The power switch was mounted on the back panel. The front panel consisted of four decade thumbwheel switches, two push button switches and one toggle switch.

diagram mapping switch position to colours
Thumbwheel switch colours that replaced numbers

The thumbwheel switches, originally numbered 0-9, were painted in the six colours of the original Master Mind pegs. (Numbers 8 and 9 were painted the same as 0 and 1 and 6 and 7 were painted grey and bronze). The original game could be made a bit harder by playing ‘no peg’ as a seventh ‘colour’. The toggle switch allowed for the choice of a 6 colour or 7 colour game. One of the push buttons was pressed to generate a new ‘colour’ combination. The player would use the original Master Mind board to set up the first guess then set the four thumbwheel switches to match. Pressing the second pushbutton switch checked the guess with the generated setting and two small seven-segment displays showed the appropriate number of black or white pegs.

Simple Operating Description

Each colour is represented by a binary number. As there are only six real colours plus the imaginary 'blank' colour in the extended game, a total of seven, only four sets of three binary bits are required to describe a particular code combination. Thus a chain of four three-bit counters rapidly count through a normal sequence when the generate new code button is pressed. Because the clock speed is sufficiently high it is impossible to anticipate the number, or four colours, held in the counter when the button is released.

When the mark button is pressed each counter is compared with its matching thumbwheel. Every match produces a count of one on the 'black' mark display. The match then is 1 to 1, 2 to 2, 3 to 3 and 4 to 4. Once that process has been completed the matches are 'slipped', giving 1 to 2, 2 to 1, 3 to 4, 4 to 3, then 1 to 3, 2 to 4, 3 to 1, 4 to 2 and finally 1 to 4, 2 to 3, 3 to 2, 4 to 1. Any matches during this process produces a count of one on the 'white' mark display.

A Better Method?

When microprocessor kits started to become available computing magazines would print short machine code routines that had been produced by readers, sometimes as part of a competition, sometimes as a solution to a reader's own problem. Given that the amount of memory available to these early systems was very small, perhaps only a few hundred bytes, there was quite a premium on coming up with clever routines that were small in size. I remember reading some such routine for marking the Master Mind game and thinking how clever it was, it seemed to offer a shorter algorithm than that used in my 'hardware' machine. Unfortunately I haven't been able to find the article since.

Of course it is quite likely that such an algorithm might be quite hard to realise in hardware. My machine effectively carries out 16 comparisons, the 'method' is the same for each. I am pretty certain that the 'lost' software algorithm was more dynamic, changing what it did next based on what had gone before.

The computer scientist Donald E. Knuth proved that it was always possible for the codebreaker to succeed in five moves or less (Journal of Recreational Mathematics Vol. 9(1), 1976-77)