StarBlind Game

In this assignment you will create the StarBlind game which is based on the Mastermind board game.

In your game, the computer will, at random, select colors for four stars. The user will guess the colors of the stars and receive feedback on the accuracy of their guess. Here is an example of the game play for the program:

Rules

  1. The user guesses by entering four letters representing the star colors (R - red, G - green, B - blue, Y - yellow, M - magenta, and C - cyan).
  2. The order of the letters matters
  3. Colors can be expressed with either uppercase or lowercase letters.
  4. If the user enters an invalid guess (not exactly four characters or containing letters other than R, G, B, Y, M, or C), a useful message must be displayed and the user will be given another opportunity to guess. This continues until a valid guess is entered.
  5. Green and yellow bars are used to provide feedback to the user on their guess. All green bars should appear prior to any yellow bars.
  6. Stars and Bars should be displayed in bold text. You can produce bold characters by prefixing the characters with \u001B[1m.
  7. The game continues until the user guesses all four colors correctly.
  8. Once the user wins, the user can choose to play again or end the program.

Software Design

You will make use of the Color enumeration from homework 10 with the addition of three class methods:

There are three additional classes for you to implement.

Stars

The Stars class represents a guess made by the player (the four colored stars). This class is required to have three public constructors and two methods:

Please note that calling equals() to compare two Star objects, will only return true if the two references point to exactly the same object. If the two references point to different objects that contain the same sequence of colored stars, equals() will return false. You learn why in the next couple weeks.

StarBlind

The StarBlind class represents the game. An object from this class must retain all of the guesses the user makes in an ArrayList<Stars>. This class has one constructor and four public methods:

Driver

The Driver class contains the main program and three private class methods:

For Motivated Students

Once you have completed all of the requirements for the assignment, motivated students may wish to add additional features. Some ideas:

Acknowledgement

This laboratory assignment was developed by Dr. Chris Taylor.

See your professor's instructions for details on submission guidelines and due dates.