Mastermind

The Code-breaking classic
What is Mastermind?

Mastermind is a Java Swing GUI (Graphical User Interface) application. Like the classic board game, the player tries to crack a randomly generated code, within 10 rounds. It is considered "the challenging game of logic and deduction" as it takes a bit of thought to crack the code at times! Cryptic clues are given to help the player along the way to try to solve the code based on position and color.

Main Features

Mastermind consists of the following features:

  • Full-featured user interface, complete with instructions on how to play the game, as well as strategy tips
  • Single Player mode for ease of use
  • Challenging, classic Mastermind gameplay, including feedback of how well you did with your guess

Why Mastermind?

Mastermind was made for the Computer Science and Information Systems course 2410 (Advanced Programming) at Salt Lake Community College. It was made for the assignment titled "A01 Mastermind", where the purpose was to show we could write a fully-featured Java application using mathematic algorthims, separation of functionality and display (output), and clear GUI design. It features feedback, repeating game logic, and an in-place user interface (no scrolling in the Window).

Although the project requirements were not specifically designed for it, we chose to work on this as a team assignment, which allowed us the ability to work on collaboration and communication skills, responsiveness, and time management to complete the project on time.

While this game does not offer much more than the classic board game experience, it's definitely worth playing simply for the enjoyment of challenging yourself to crack the code!

Demonstration Video

Coming Soon...

Starting the Game

Mastermind is an application that uses a Graphical User Interface, or GUI. This means that you (the player) will interact with the program by "pointing and clicking" with your mouse cursor.

When you first launch the application, you will immediately start a new game and the computer will randomly generate a code that you will have to guess. You may place any combination of four colored marbles, out of six possible choices, on the first line containing four slots. To do so, use the six colored icons at the bottom of the screen. You have the chance to change your code prior to selecting the check button with the “delete last” button. This is useful if a mistake has been made in the current row.

Once you're comfortable with their guess, press the "check" button to receive feedback from the computer that will display either black or white "pegs" to the right of your guess.

The White pegs indicate each marble that is a correct color but in the wrong position, and the Black pegs indicate each marble that is in a correct position and a right color. If neither are true, then no peg will be placed. The positions of the pegs have no correlation to the positions of the marbles! In other words, a black peg in the first slot does not necessarily mean that the first marble was correct, it just means that one of the marbles was correct.

The marbles and pegs will stay in their same positions as you progress through the game. Once a row is complete, it is impossible to change any of the marbles in that row.

Play continues until the code is discovered or there are no remaining guesses.

Strategy

Mastermind is a challenging game, that often requires a bit of strategy. This is because you have only a limited number of moves you can make before the game is over, and if you make too many mistakes, you will not be able to win. There are a combination of 1296 different possible patterns so making a guess with no correct marbles can ultimately affect the outcome of the game. For example, if you are halfway through the game but don't have at least part of the answer figured out, it will be next to impossible to guess all 4 remaining spots with the limited feedback given.

You might consider trying to narrow down the search by trying a combination of similar guesses. If you can get the right combination of marbles, you can then figure out which order they go in, which is harder than figuring out the colors.

Helpful Tips
  • As mentioned, try finding out which colors the code contains before you try to figure out the order of the colors. You may find that it is easier to get the colors right, then you just have to arrange them properly.

  • Remember that having multiple of the same color in a guess is possible. If you are stuck trying to figure out the color combinations, consider trying a combination with multiple of the same color.

Download

Before downloading, it is recommended you review the How To Play tab, which explains how to play Mastermind. System Requirements and Installation Instructions can be found below.

This is the latest and recommended version of Mastermind.

Version File Size Date Published Changelog
1.0.0 100 KB February 2, 2019

Mastermind currently has no previous versions available for download.
System Requirements

In order to play Mastermind, you will need the following system specifications.

  • Computer: Anything not a dinosaur
  • Operating System: Windows 7 or newer, macOS 10.8 (Mountain Lion) or newer, or Linux
  • Storage Space: At least 1 MB of free space (seriously, this is a small game)
  • Other: Java 8 Runtime Environment or greater

Installation Instructions

Take the following steps to install Mastermind on your computer:

  1. Download and install the Java 8 Runtime Environment (or greater) if you don't already have it.
  2. Download the Mastermind JAR file to the directory of your choice.
  3. That's it. Now double click the "Mastermind.jar" file to run Mastermind!