Hades logo    Hades applet banner

TAMS / Java / Hades / applets (print version): contents | previous | next

"Mastermind" game solver


This PIC16F84-based gadget implements a solver for the 'mastermind' game with four places and seven colors. (I don't know how the game is called outside of Germany). It demonstrates the Hades simulation model(s) for the PIC16F84, including power-down mode, and the use of the 'smart' multiplexed seven-segment displays.

How to play:

  1. Think of any four digit number, where each digit runs from 1 to 7. We will try the number 6714 in this example.
  2. After the design has been loaded, click the 'Start/Count' switch once to close the switch whichs wakes the microcontroller up from its power-down mode. Click the switch again to open the switch.
  3. Wait until the microcontroller has calculated its first guess (6773) for your numbers. Depending on the speed of your computer, this can take a while - less than a second on my Athlon.
  4. Check whether and how many digits in the computers guess are correct.
  5. Press the 'Start/Count' button twice to increment the number of correct digits at the right position. As the count starts at zero, we have to press the 'Start/Count' switch six times (0-on, 0-off, 1-on, 1-off, 2-on, 2-off).
  6. Activate and release the 'Enter' switch to tell the computer about the correct digits.
  7. Now activate/release the 'Start/Count' switch for any digits that are in your number, but at a differnent position. In our example, there are none, so we skip over this step.
  8. Activate and release the 'Enter' switch. The microcontroller will now check your input and calculates its next guess.
  9. Repeat the process with step 4 until the computer has got the right result. It might also complain about illegal and inconsistent input (display
  10. Once the computer is sure that it has the right result, it will display a walking pattern on the display decimal point LEDs.

Both the design idea and the original software are by Wolfgang Strobl of GMD. The original homepage for the documentation (as 2005.08.09) is http://www.mystrobl.de/ws/pic/mm47. Please visit the above page for the original documentation and program source code. The file also include an user guide and the full hardware component listing, in case you want to build the device.

Note that you should use a fast computer and Java virtual machine to get acceptable interactive response times for the seven-segment displays. If available, you should load the "smart-mastermind-mux.hds" design, which uses the cycle-based simulation variant of the Hades PIC core and provides the best simulation performance.

Run the applet | Run the editor (via Webstart)

Impressum | 24.11.06