Index
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
A
- addActionListener(Consumer<List<Integer>>) - Method in class mastermind.gui.panels.CodeInput
-
Listener is invoked after every modification to the code.
- addSink(OutputStream) - Static method in class mastermind.utils.Log
-
Adds sink to which log messages will be written.
- ANSIColor - Enum Class in mastermind.utils
-
Represents an ANSI color code for console output.
B
- Blue - Enum constant in enum class mastermind.core.Code.Color
-
The blue code in the Mastermind game.
C
- CANVAS_DIMENSION - Static variable in class mastermind.Mastermind
-
Dimension of the canvas (screen) where the game is drawn.
- Code - Class in mastermind.core
-
Represents a code sequence in the Mastermind game.
- Code(List<Code.Color>) - Constructor for class mastermind.core.Code
-
Initializes a new
Code
object with the specified code sequence. - CODE_COLOR_TO_AWT_COLOR - Static variable in class mastermind.gui.panels.GameBoard
-
A mapping of
Code.Color
values to their correspondingColor
instances. - CODE_LENGTH - Static variable in class mastermind.Mastermind
-
Length of the code to guess.
- Code.Color - Enum Class in mastermind.core
-
Represents a color in the Mastermind game.
- CodeBreaker - Class in mastermind.gui.scenes
-
The Code Breaker gameplay.
- CodeBreaker(JFrame, MastermindAlgorithm) - Constructor for class mastermind.gui.scenes.CodeBreaker
-
Represents the CodeBreaker scene in the application, inheriting from the parent `Scene` class.
- CodeBreakerResult - Class in mastermind.gui.scenes
-
Scene that displays the result of the code breaker game mode.
- CodeBreakerResult(JFrame, Status, Code, List<Code>, List<Response>) - Constructor for class mastermind.gui.scenes.CodeBreakerResult
-
Creates a new CodeBreakerResult scene.
- CodeBreakerSelector - Class in mastermind.gui.scenes
-
Prompts the user to select a code-breaking algorithm.
- CodeBreakerSelector(JFrame) - Constructor for class mastermind.gui.scenes.CodeBreakerSelector
-
Constructs a CodeBreakerSelector, which provides a user interface to select a code-breaking algorithm and proceed to the next scene.
- CodeCircle - Class in mastermind.gui.panels
-
A class that represents a colored circle that is one of the four colors in a code sequence.
- CodeCircle(Color) - Constructor for class mastermind.gui.panels.CodeCircle
-
Draws a new CodeCircle with the given color.
- CodeFactory - Class in mastermind.core
-
Factory class for creating
Code
objects. - CodeInput - Class in mastermind.gui.panels
-
Panel for the user to input the code.
- CodeInput() - Constructor for class mastermind.gui.panels.CodeInput
-
Constructs the CodeInput panel.
- CodeMaker - Class in mastermind.gui.scenes
-
The Code Maker gameplay.
- CodeMaker(JFrame, Code) - Constructor for class mastermind.gui.scenes.CodeMaker
-
Constructs the CodeMaker scene with the secret code.
- CODEMAKER_PREDEFINED_CODES - Static variable in class mastermind.Mastermind
-
File containing predefined codes for the code maker.
- CodeMakerResult - Class in mastermind.gui.scenes
-
Represents the scene displayed to the user after the Mastermind game has concluded in the Code Maker mode.
- CodeMakerResult(JFrame, Status, Code) - Constructor for class mastermind.gui.scenes.CodeMakerResult
-
Constructs a new Result scene to display the outcome of the Mastermind game.
- CodeMakerSelector - Class in mastermind.gui.scenes
-
The Code Maker selection screen.
- CodeMakerSelector(JFrame) - Constructor for class mastermind.gui.scenes.CodeMakerSelector
-
Constructs the CodeMakerSelector scene.
- colorize(ANSIColor, String) - Static method in enum class mastermind.utils.ANSIColor
-
Returns the provided string wrapped with the specified ANSI color code.
- Continue - Enum constant in enum class mastermind.core.solvers.Status
-
The solver has made a guess, but the game is not over yet.
- createDefaultScene() - Static method in class mastermind.gui.scenes.Scene
-
Creates and returns a default configured JFrame instance.
- CYAN - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI cyan color code.
D
- debug(String) - Static method in class mastermind.utils.Log
-
Logs a message with the DEBUG severity level.
- DEBUG - Enum constant in enum class mastermind.utils.Log.Severity
-
The DEBUG severity level.
- digitsFromBase(int, int, int) - Static method in class mastermind.utils.MathUtil
-
Extracts the digits of a given number in a specified base and returns them in a list, padded with leading zeros to ensure the resulting list has the specified length.
- DonaldKnuthAlgorithm - Class in mastermind.core.solvers
-
An implementation of the Donald Knuth algorithm for solving the Mastermind game.
- DonaldKnuthAlgorithm() - Constructor for class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Constructs a new instance of the `DonaldKnuthAlgorithm` class.
- drawButtons() - Method in class mastermind.gui.panels.CodeInput
-
Draws the buttons for the user to input the code.
- drawGuess(JPanel, List<Color>) - Static method in class mastermind.gui.panels.GameBoard
-
Renders a visual representation of a guess on the given panel.
- drawHelpButton(JFrame) - Static method in class mastermind.gui.panels.Help
-
Draws the help button on the frame.
- drawHints(JPanel, Response) - Static method in class mastermind.gui.panels.GameBoard
-
Updates the specified parent JPanel to display feedback hints in a grid format, based on the given response.
- drawHomeButton(JFrame) - Static method in class mastermind.gui.panels.HomeButton
-
Draw the home button on the frame.
E
- EasyAlgorithm - Class in mastermind.core.solvers
-
An implementation of the MastermindAlgorithm class that provides a simple algorithm for solving the Mastermind game, by randomly choosing codes that have not guessed before.
- EasyAlgorithm() - Constructor for class mastermind.core.solvers.EasyAlgorithm
-
Constructs a new instance of the `EasyAlgorithm` class.
- equals(Object) - Method in class mastermind.core.Response
-
Compares this Response object to the specified object for equality.
- equals(Object) - Method in record class mastermind.utils.Tuple2
-
Compares this Tuple2 object with the specified object for equality.
- error(String) - Static method in class mastermind.utils.Log
-
Logs a message with the ERROR severity level.
- ERROR - Enum constant in enum class mastermind.utils.Log.Severity
-
The ERROR severity level.
F
- fatal(String) - Static method in class mastermind.utils.Log
-
Logs a message with the FATAL severity level and exits the program.
- FATAL - Enum constant in enum class mastermind.utils.Log.Severity
-
The FATAL severity level.
- first() - Method in record class mastermind.utils.Tuple2
-
Returns the value of the
first
record component. - frame - Variable in class mastermind.gui.scenes.Scene
-
The JFrame associated with this scene.
- fromColorIndices(List<Integer>) - Static method in class mastermind.core.CodeFactory
-
Creates a
Code
object from a list of color indices. - fromIndex(int) - Static method in enum class mastermind.core.Code.Color
-
Retrieves the
Color
constant at the specified index.
G
- GameBoard - Class in mastermind.gui.panels
-
Represents the game board in the Mastermind GUI.
- GameBoard() - Constructor for class mastermind.gui.panels.GameBoard
-
Constructs a new GameBoard instance and initializes the game board layout.
- GameModeSelector - Class in mastermind.gui.scenes
-
Prompts the user to select a game mode: Code Breaker or Code Maker.
- GameModeSelector(JFrame) - Constructor for class mastermind.gui.scenes.GameModeSelector
-
Creates a new GameModeSelector object that represents a scene for selecting the game mode.
- getAttempts() - Method in class mastermind.core.solvers.MastermindSolver
-
Retrieves the number of attempts made by the solver.
- getBlackPegs() - Method in class mastermind.gui.panels.KeyPegsPrompt
-
Returns the number of black pegs.
- getBoardPanel() - Method in class mastermind.gui.panels.GameBoard
-
Retrieves the main game board panel.
- getColor(int) - Method in class mastermind.core.Code
-
Retrieves the
Color
at the specified position in the code sequence. - getColors() - Method in class mastermind.core.Code
-
Retrieves the list of
Color
objects contained in this code sequence. - getOccurrences() - Method in class mastermind.core.Code
-
Computes the occurrence count of each
Code.Color
in the code sequence. - getRandom() - Static method in class mastermind.core.CodeFactory
-
Creates a random
Code
object. - getRandomFromFile(File) - Static method in class mastermind.core.CodeFactory
-
Creates a random
Code
object from a file. - getResponse() - Method in class mastermind.core.Response
-
Returns the Tuple2 object containing the counts of correct and misplaced elements.
- getWhitePegs() - Method in class mastermind.gui.panels.KeyPegsPrompt
-
Returns the number of white pegs.
- GRAY - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI gray color code.
- Green - Enum constant in enum class mastermind.core.Code.Color
-
The green code in the Mastermind game.
- GREEN - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI green color code.
- guess() - Method in class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Determines the initial guess for the Mastermind game.
- guess() - Method in class mastermind.core.solvers.EasyAlgorithm
-
This simple guess algorithm generates a random guess that has not been made before.
- guess() - Method in class mastermind.core.solvers.MastermindAlgorithm
-
This is the first guess an algorithm will make.
- guess() - Method in class mastermind.core.solvers.MediumAlgorithm
-
Determines the initial guess for the Mastermind game.
- guess(Code) - Method in class mastermind.core.solvers.HumanSolver
-
Evaluates a guess against the secret code and determines the game status.
- guess(Response) - Method in class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Produces the next guess in the Mastermind game based on the feedback from the previous guess.
- guess(Response) - Method in class mastermind.core.solvers.EasyAlgorithm
-
Determines the next guess for the Mastermind game.
- guess(Response) - Method in class mastermind.core.solvers.MastermindAlgorithm
-
Produces a new guess based on the provided response from the previous guess.
- guess(Response) - Method in class mastermind.core.solvers.MediumAlgorithm
-
Determines the subsequent guesses for the Mastermind game.
H
- hasExceededMaxGuesses() - Method in class mastermind.core.solvers.MastermindSolver
-
Whether the solver guesses the code within
Mastermind.MAX_GUESSES
. - hashCode() - Method in class mastermind.core.Response
-
Returns the hash code value for this Response object.
- hashCode() - Method in record class mastermind.utils.Tuple2
-
Returns a hash code value for this object.
- Help - Class in mastermind.gui.panels
-
Help class that displays the help button and the help popup.
- HomeButton - Class in mastermind.gui.panels
-
A class to create a home button that will take the user back to GameModeSelector.
- HumanSolver - Class in mastermind.core.solvers
-
A solver that allows a human player to guess the secret code.
- HumanSolver(Code) - Constructor for class mastermind.core.solvers.HumanSolver
-
Constructs a HumanSolver instance with the given secret code.
I
- info(String) - Static method in class mastermind.utils.Log
-
Logs a message with the INFO severity level.
- INFO - Enum constant in enum class mastermind.utils.Log.Severity
-
The INFO severity level.
- InvalidHintsException - Exception Class in mastermind.core.solvers
-
Exception thrown when the hints provided to a solver are invalid.
- InvalidHintsException(String) - Constructor for exception class mastermind.core.solvers.InvalidHintsException
-
Constructs a new InvalidHintsException with the specified detail message.
- isInitialGuess() - Method in class mastermind.core.solvers.MastermindSolver
-
Whether the guess the solver will make is its first ever guess
K
- KeyPegsPrompt - Class in mastermind.gui.panels
-
A panel that allows the user to set the number of black and white key pegs.
- KeyPegsPrompt() - Constructor for class mastermind.gui.panels.KeyPegsPrompt
-
Creates a new key pegs counter panel.
L
- Log - Class in mastermind.utils
-
Represents a singleton logger for recording messages with different severity levels.
- Log.Severity - Enum Class in mastermind.utils
-
Represents the severity levels of log messages.
- Lose - Enum constant in enum class mastermind.core.solvers.Status
-
The solver failed to guess the code.
M
- main(String[]) - Static method in class mastermind.Mastermind
-
Main method of the game.
- mastermind - package mastermind
-
Everything required to bring Mastermind to life.
- Mastermind - Class in mastermind
-
Main class of the Mastermind game.
- mastermind.core - package mastermind.core
-
Components responsible for game logic.
- mastermind.core.solvers - package mastermind.core.solvers
-
Human and algorithm solvers to solve the Mastermind game.
- mastermind.gui.panels - package mastermind.gui.panels
-
Common GUI components that can be shared across multiple
mastermind.gui.scenes
. - mastermind.gui.scenes - package mastermind.gui.scenes
-
Stages of the game.
- mastermind.utils - package mastermind.utils
- MastermindAlgorithm - Class in mastermind.core.solvers
-
The standard interface for all algorithmic solvers.
- MastermindAlgorithm() - Constructor for class mastermind.core.solvers.MastermindAlgorithm
-
Default constructor.
- MastermindSolver - Class in mastermind.core.solvers
-
The ultimate base class, all solvers are derived from this class.
- MastermindSolver() - Constructor for class mastermind.core.solvers.MastermindSolver
-
Default constructor.
- MathUtil - Class in mastermind.utils
-
Provides utility methods for mathematical operations.
- MAX_GUESSES - Static variable in class mastermind.Mastermind
-
Maximum number of guesses allowed.
- MediumAlgorithm - Class in mastermind.core.solvers
-
An implementation of the medium algorithm, which is a modified and less-optimal version of the Donald-Knuth algorithm, for solving the Mastermind game.
- MediumAlgorithm() - Constructor for class mastermind.core.solvers.MediumAlgorithm
-
Constructs a new instance of the `MediumAlgorithm` class.
O
- Orange - Enum constant in enum class mastermind.core.Code.Color
-
The orange code in the Mastermind game.
P
- paintComponent(Graphics) - Method in class mastermind.gui.panels.CodeCircle
-
Paints the circle with the given color.
- Purple - Enum constant in enum class mastermind.core.Code.Color
-
The purple code in the Mastermind game.
R
- Red - Enum constant in enum class mastermind.core.Code.Color
-
The red code in the Mastermind game.
- RED - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI red color code.
- RED_BACKGROUND - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI red background color code.
- registerHelpHandlers() - Static method in class mastermind.gui.panels.Help
-
Registers the help button action listeners.
- registerHomeHandlers(JFrame) - Static method in class mastermind.gui.panels.HomeButton
-
Register the home button handler.
- RESET - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI reset color code.
- Response - Class in mastermind.core
-
Represents the response to a guess in the Mastermind game.
- Response(Code, Code) - Constructor for class mastermind.core.Response
-
Constructs a Response object by calculating the number of correctly matched and misplaced elements between the provided code and guess.
- Response(Tuple2<Integer, Integer>) - Constructor for class mastermind.core.Response
-
Constructs a Response object using the given Tuple2 containing the counts of correct and misplaced elements.
S
- Scene - Class in mastermind.gui.scenes
-
The ultimate base class of all
mastermind.gui.scenes
. - second() - Method in record class mastermind.utils.Tuple2
-
Returns the value of the
second
record component. - SecretCodePrompt - Class in mastermind.gui.scenes
-
Represents a scene where the user is prompted to enter the correct code.
- SecretCodePrompt(JFrame, Status, List<Code>, List<Response>) - Constructor for class mastermind.gui.scenes.SecretCodePrompt
-
Initializes a new SecretCodePrompt scene with the specified JFrame, game status, guesses, and responses.
- setLevel(Log.Severity) - Static method in class mastermind.utils.Log
-
Sets the severity level of the logger.
- setLogToStdout(boolean) - Static method in class mastermind.utils.Log
-
Sets whether log messages should be written to stdout.
- Status - Enum Class in mastermind.core.solvers
-
The status of the solver after guessing the code.
T
- toString() - Method in class mastermind.core.Code
- toString() - Method in class mastermind.core.Response
-
Returns a string representation of the Response object.
- toString() - Method in record class mastermind.utils.Tuple2
-
Returns a string representation of this record class.
- TOTAL_COLORS - Static variable in class mastermind.Mastermind
-
Total number of colors available to choose from.
- trace(String) - Static method in class mastermind.utils.Log
-
Logs a message with the TRACE severity level.
- TRACE - Enum constant in enum class mastermind.utils.Log.Severity
-
The TRACE severity level.
- Tuple2<T,
U> - Record Class in mastermind.utils -
Represents a tuple of two elements.
- Tuple2(T, U) - Constructor for record class mastermind.utils.Tuple2
-
Creates an instance of a
Tuple2
record class.
U
- updateGuess(int, List<Code.Color>) - Method in class mastermind.gui.panels.GameBoard
-
Updates the guessed colors for a specified row on the game board.
- updateGuessFromColorIndices(int, List<Integer>) - Method in class mastermind.gui.panels.GameBoard
-
Updates the guessed colors for a specific row on the game board based on the provided color indices.
- updateHints(int, Response) - Method in class mastermind.gui.panels.GameBoard
-
Updates the hint panel for a specified row on the game board based on the provided feedback.
V
- valueOf(String) - Static method in enum class mastermind.core.Code.Color
-
Returns the enum constant of this class with the specified name.
- valueOf(String) - Static method in enum class mastermind.core.solvers.Status
-
Returns the enum constant of this class with the specified name.
- valueOf(String) - Static method in enum class mastermind.utils.ANSIColor
-
Returns the enum constant of this class with the specified name.
- valueOf(String) - Static method in enum class mastermind.utils.Log.Severity
-
Returns the enum constant of this class with the specified name.
- values() - Static method in enum class mastermind.core.Code.Color
-
Returns an array containing the constants of this enum class, in the order they are declared.
- values() - Static method in enum class mastermind.core.solvers.Status
-
Returns an array containing the constants of this enum class, in the order they are declared.
- values() - Static method in enum class mastermind.utils.ANSIColor
-
Returns an array containing the constants of this enum class, in the order they are declared.
- values() - Static method in enum class mastermind.utils.Log.Severity
-
Returns an array containing the constants of this enum class, in the order they are declared.
W
- warning(String) - Static method in class mastermind.utils.Log
-
Logs a message with the WARNING severity level.
- WARNING - Enum constant in enum class mastermind.utils.Log.Severity
-
The WARNING severity level.
- Win - Enum constant in enum class mastermind.core.solvers.Status
-
The solver has guessed the code correctly.
Y
- Yellow - Enum constant in enum class mastermind.core.Code.Color
-
The yellow code in the Mastermind game.
- YELLOW - Enum constant in enum class mastermind.utils.ANSIColor
-
The ANSI yellow color code.
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form