Projektdaten
Projekt: Mastermind
Autor: Achim Hänsch
Organisation: private
Beschreibung:
This is the Mastermind version "Mini - Superhirn" Game As Applet.
Goal is to find the correct combination of 4 colors out of 6 within maximum 6
guesses.
The computer will evaluate the combinations by displaying result indicators for
correct colors and correct colors at the right place.
Features
- 3 classes: Mastermind (implements ActionListener), GuessRow, and TitleTicker
(implements Runnable). All classes use only AWT elements to allow processing in current browsers.
- Mastermind creates 6 instances (player's tries) of GuessRow, and one instance of TitleTicker
- TitleTicker starts as independent Thread to support quicker user inputs on other components
Outline Algorithm:
- 4 (of 6) colors are chosen randomly, if's ensure that every
color exists only once.
- The player's chosen colors are evaluated against the computer's colors:
First colors at the right place, and then correct colors, but on the wrong place.
Positive Evaluation causes black or white indicators.
- If all colors are guessed correctly, the game ends. If not, the next row will be
set visible for the next combination try.
Lessons Learned:
- JBuilders Graphic UI Editor does not support arrays of UI elements,
therefore they cannot be seen here.
- All Elements must be added in the init() or jBinit() - Method. All
attempts to dynamically add such elements later as required fail, they will not
be visible.