CSE 131 Module 9: Game
Before beginning any work, do a Team...Pull in your repository.
This lab is the beginning of the game we are doing this semester.
The part you do in lab is meant to be fairly straightforward. You then
add features to the lab for your project.
Mastermind is a logic-based board game for two players.
Given a puzzle p and a guess g, the codemaker
provides the following feedback:
- establishes a hidden list of colored pegs, here called the puzzle
- tries to discover the puzzle by supplying a sequence of guesses
A sample board showing game play appears below:
- How many pegs in g correspond in location and color
to those in p?
- How many pegs in g are a color found in p but
are in the wrong position in g?
Your work for this lab
We will implement a simple form of this game, leaving embellishments
for project ideas. The basic game is played with no repeated colors in
the code, but we do require that you accommodate a specified number of
peg colors and a specified number of holes per row in the game.
Here's all you have to do:
- Team…Pull to get the source code
- Locate the source code in the lab9 package of your
labs source folder
- Run the Main class. The output isn't right yet, because
you haven't implemented the two classes for this lab yet.
- Watch these videos to get an overview of the game, tracking the
information from the videos in the code for this lab. (uploading soon)
- The test files are in the lab9.testing package
- Complete Guess so that TestGuess passes
As mentioned in the video, Arrays.toString(int array) produces
a nice String of an array's contents.
- Complete HonestFeedback in the lab9.implementations
package so that TestHonestFeedback passes.
As mentioned in the video, you should use sets to determine the number of
colors that are in common between the code and the guess.
Stackoverflow can be your friend here. Search for java set intersection and take a look at their use of retainAll for sets.
You can use this code, but should cite Stackoverflow as your
source in a comment.
You are not required to use sets for this, but there will be an exam question
related to this on Exam III.
- Demo and this part is done
You must choose from the following something to do for project
credit. We will add to this list as suggestions come in, but for
now here are the ideas and options. The professors will create instances
of these kinds of things and shoot videos to give you an idea of how
they might work.
We also expect that you will want some help thinking about how to accomplish
what you set out to do. Count on us and the TAs to give you advice
Here are some extra videos that may be helpful in organizing your
You need choose only one of the following to receive full credit.
- A visualization of the game in progress.
An example is shown near the end of
- A smart guess provider that can solve the puzzle in the allotted
A not very smart guesser is shown in
- A smarter guess provider that you will enter into a contest
to compete for the fewest moves to solve prize for the course.
Submitting your work (read carefully)
- You must commit and push all of your work to your repository. It's best to do this
from the top-most level of your repository, which bears your name and student ID.
- You must demo the commited work to a TA. Make sure the TA knows that
your demo is for credit at this point.
- Follow the directions below to have your demo for this work recorded.
Last modified 21:38:55 CST 05 February 2018
When you are done with this lab, you must be cleared by the TA to receive credit.
- Do a Team…Pull to update your repository. You must do this or the commit/push below may fail.
- Commit and push all your work to your repository.
certain this has worked by logging into
bitbucket. There you
will see the commit(s) in your news feed if it was successful. You can also
check the Source page to locate and ensure your code was received.
It is your responsibility to make certain the code has been pushed.
Some of your work receives credit through testing of your pushed code. You
will receive no credit for such work if you failed to push. We generally
reserve the right to revoke credit for any of your work that has not been
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in the TA's name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately,
but should be posted in the next day or so
This demo box is for lab 9