Function Syntax Mastermind
Current Version 1.0
Download Mastermind.lsp
View HTML Version Mastermind.html

We all need a break sometimes, so I present my AutoCAD game of Mastermind

Program Description

Just like the original 1970 code-breaking classic board game, the user has 8 attempts to determine a 4-element colour code based on coded feedback received upon each unsuccessful attempt.

For those unfamiliar with the game, below are the instructions.


A code is decided by either another user or by selecting a random code. The code consists of 4-colours, chosen from a selection of 6 available colours. Duplicate colours are allowed (Hence the number of possible codes is 6^4= 1296).

The code may be set by pressing the Change button at the top of the program, then either entering a 4-element code by pressing the buttons beneath each colour, or by pressing the Lucky Dip! button to select a random code.

When the code is set, the user begins his attempts to determine the sequence of colours. Attempts are made by pressing the buttons beneath the colours in the Controls panel. If a mistake is made part-way through an attempt, the user may press the Clear Row button to start the attempt again.

To submit an attempt the user should press Check. The game automatically moves the user onto the next attempt when an attempt is submitted.


Marker Meaning
Black A Correct Colour in the Correct Position
White A Correct Colour in the Wrong Position
No Marker An Incorrect Colour

NB: The positions of the Feedback Markers bears no relation to the positions of the colours in a code attempt

After either all attempts are made, or the correct sequence is determined, the solution is revealed at the top of the program, and the user has a choice of either Exiting, Resetting the game to play again, or changing the code for another game.



Instructions for Running

Please refer to How to Run an AutoLISP Program.


increase · reset · decrease

Designed & Created by Lee Mac © 2010