CIT 591 Assignment 7: Mastermind
Fall 2013, David Matuszek

Purpose of this assignment

General idea of the assignment

Play a game of Mastermind. The computer creates a random pattern, and the human user tries to discover it. Use six colors for the "marbles," and allow colors to be repeated in the pattern. Give the user ten chances to discover the pattern

You can play this game online at More detailed instructions are at

I've posted a Concise Guide to Scala GUIs that should provide all the programming information you need.

Special instructions

Because I want everyone to have a "taste" of GUI programming, you and your partner should each write a GUI for this assignment. Your GUI should be on a file named MastermindGuiYourName and the file should define an object with the same name. That object should contain a main method. This way, we can start the program from either GUI.

The GUI should be basically your own work, but you can get help from your partner or from other class members. (And you should be willing to help others.) Make a "no-frills" GUI--one that works, but isn't necessarily pretty. You won't get a better grade for making an attractive GUI, that will just waste your time.

The game at the above web site uses drag-and-drop to place marbles. Don't try to do that. Your program should do everything with mouse clicks.

The game logic should be contained in a separate class, named Mastermind, on which you and your partner collaborate. Game logic consists of things like choosing a pattern, evaluating a user's guess, and determining when the game has been won or lost. It should provide methods for the GUI to use, but it should not use any methods defined in the GUI. Methods in this class should be tested, using Scalatest.

To repeat: Communication is one-way; the GUI can use the game logic, but the game logic cannot use anything in the GUI.

Users should be able to play multiple games without restarting the program.

Getting started

The first thing you should do is to discuss with your partner what methods should be provided by the Mastermind class, and exactly what each method should do. Until this is done, you won't know what methods can be called from your GUI class.

Due date

Submit your team's program, as a single .zip file, to Canvas by 6am Friday, October 25. Decide which of you is going to turn in the assignment, and make only one submission for the two of you. Make sure your names are in comments in the appropriate files.

Grading will be 50% on the GUI, 50% on the logic, so you and your partner might get different grades for this assignment.