Index
All Classes and Interfaces|All Packages|Constant Field Values
B
- BLUE - Enum constant in enum class mastermind.core.Code.Color
C
- calculateResponse(Code, Code) - Static method in class mastermind.Utils
-
Calculates the response for a given guess based on the correct code.
- Code - Class in mastermind.core
-
Represents a Mastermind code consisting of a sequence of colors.
- Code(String) - Constructor for class mastermind.core.Code
-
Constructs a Code instance from a string representation of the code.
- Code(List<Integer>) - Constructor for class mastermind.core.Code
-
Constructs a Code instance from a list of integers representing color indices.
- CODE_LENGTH - Static variable in class mastermind.Mastermind
-
The length of the secret code.
- Code.Color - Enum Class in mastermind.core
- COLORS - Static variable in class mastermind.core.solvers.MastermindAlgorithm
- countResponsePegs(GridPane, int) - Static method in class mastermind.Utils
-
Counts the number of black and white response pegs in the response grid for a given response row.
D
- deleteGameState(String) - Static method in class mastermind.Utils
-
Deletes a user's game state file.
- digitsFromBase(int, int, int) - Static method in class mastermind.Utils
-
Converts a number to an array of digits in a specified base.
- DIRECTORY_PATH - Static variable in class mastermind.Utils
- disableColorButtons() - Method in class mastermind.controllers.GameBoard
-
Disables all color buttons.
- DonaldKnuthAlgorithm - Class in mastermind.core.solvers
-
This algorithm follows Donald Knuth's Five-Guess Algorithm.
- DonaldKnuthAlgorithm() - Constructor for class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Constructor initializes the possible permutations, previous guesses, and responses.
E
- EasyAlgorithm - Class in mastermind.core.solvers
-
EasyAlgorithm is a solver for the Mastermind game.
- EasyAlgorithm() - Constructor for class mastermind.core.solvers.EasyAlgorithm
- EnterUsername - Class in mastermind.controllers
-
Controller class for handling username input and determines whether the user has an unfinished game and wants to resume or start a new game.
- EnterUsername() - Constructor for class mastermind.controllers.EnterUsername
- equals(Code) - Method in class mastermind.core.Code
-
Compares this code to another code to check if they are equal.
- evaluateGuess(Code, Code) - Method in class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Evaluates the response to a guess based on the actual code.
- evaluateGuess(Code, Code) - Method in class mastermind.core.solvers.MastermindAlgorithm
-
Evaluates the correctness of a guess by comparing it to the actual code.
F
- formatTime(long) - Static method in class mastermind.Utils
-
Formats a time value in milliseconds into a string of the format "minutes:seconds".
- fromIndex(int) - Static method in enum class mastermind.core.Code.Color
-
Converts an index to the corresponding Color enum.
G
- GameBoard - Class in mastermind.controllers
-
Controller for the Mastermind game board.
- GameBoard() - Constructor for class mastermind.controllers.GameBoard
-
Constructor
- GameOver - Class in mastermind.controllers
-
Controller class that is displayed after a game is finished.
- GameOver() - Constructor for class mastermind.controllers.GameOver
- GameOverview - Class in mastermind.controllers
-
Controller class for game overview information.
- GameOverview() - Constructor for class mastermind.controllers.GameOverview
- generateRandomCode() - Static method in class mastermind.core.Code
-
Generates a random code based on the game's difficulty level.
- getCodeInDigits() - Method in class mastermind.core.Code
-
Converts the code to a list of integers representing the color indices.
- getColor(int) - Method in class mastermind.core.Code
-
Retrieves the color at the specified index.
- getColorFromCode(List<Integer>) - Static method in class mastermind.core.Code
-
Converts a list of integer indices to a list of corresponding colors.
- getColors() - Method in class mastermind.core.Code
-
Retrieves the list of colors representing the code.
- getCreateDifficultyLevel() - Method in class mastermind.core.State
-
Gets the difficulty level for creating the game.
- getGameMode() - Method in class mastermind.core.State
-
Gets the current game mode.
- getGuessDifficultyLevel() - Method in class mastermind.core.State
-
Gets the difficulty level for guessing.
- getGUIColor(Code.Color) - Static method in class mastermind.Utils
-
Maps a game's color to a corresponding JavaFX color.
- getInstance() - Static method in class mastermind.core.State
-
Returns the single instance of the State class.
- getLastGuess() - Method in class mastermind.core.solvers.MastermindAlgorithm
-
Gets the last guess made by the algorithm.
- getOccurrences() - Method in class mastermind.core.Code
-
Calculates the occurrences of each color in the code.
- getPegColors() - Method in class mastermind.core.Response
-
Get the list of peg colors corresponding to the response (BLACK, WHITE, NONE).
- getResponse() - Method in class mastermind.core.Response
-
Get the response as a pair of correct and misplaced counts.
- getUsername() - Method in class mastermind.core.State
-
Gets the username of the current player.
- GREEN - Enum constant in enum class mastermind.core.Code.Color
- guess() - Method in class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Makes the first guess, which is the fixed code [0, 0, 1, 1].
- guess() - Method in class mastermind.core.solvers.EasyAlgorithm
-
Makes the first guess, which is the color represented by the first value in COLORS repeated for the length of the code.
- guess() - Method in class mastermind.core.solvers.MastermindAlgorithm
-
Makes an initial guess for the Mastermind code.
- guess() - Method in class mastermind.core.solvers.MediumAlgorithm
-
Makes the first guess, which is a simple code with all pegs of color 0.
- guess(Pair<Integer, Integer>) - Method in class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Makes a guess based on the feedback received for the previous guess.
- guess(Pair<Integer, Integer>) - Method in class mastermind.core.solvers.EasyAlgorithm
-
Makes a guess based on the response to the previous guess.
- guess(Pair<Integer, Integer>) - Method in class mastermind.core.solvers.MastermindAlgorithm
-
Makes a subsequent guess based on the feedback response received from the previous guess.
- guess(Pair<Integer, Integer>) - Method in class mastermind.core.solvers.MediumAlgorithm
-
Makes a guess based on the response to the previous guess.
H
- hasUnfinishedGame(String) - Static method in class mastermind.Utils
-
Checks if the user has an unfinished game.
- HTP1 - Class in mastermind.controllers
-
Controller class for the game instructions (1/2)
- HTP1() - Constructor for class mastermind.controllers.HTP1
- HTP2 - Class in mastermind.controllers
-
Controller class for the game instructions (2/2)
- HTP2() - Constructor for class mastermind.controllers.HTP2
I
- ICON_PATH - Static variable in class mastermind.Mastermind
-
Path to the application icon image.
- initialize() - Method in class mastermind.controllers.GameBoard
-
Initializes the game board, setting up the initial state based on whether there's an unfinished game or a new game needs to be started.
- isGameFinished() - Method in class mastermind.core.State
-
Checks if the game is finished.
- isValidColorIndex(int) - Static method in class mastermind.core.Code
-
Validates whether a given index corresponds to a valid color in the Code enum.
L
- lastGuess - Variable in class mastermind.core.solvers.MastermindAlgorithm
- loadCreateGuessesAndResponses(String) - Static method in class mastermind.Utils
-
Loads a list of guesses and responses for a create game.
- loadGameState(String) - Static method in class mastermind.Utils
-
Loads a user's game state from the file.
- loadGuessGuessesAndResponses(String) - Static method in class mastermind.Utils
-
Loads the guesses and responses from a file for a given username.
- loadScene(ActionEvent, String) - Static method in class mastermind.Utils
-
Loads a new scene (FXML file) into the current window.
M
- main(String[]) - Static method in class mastermind.Mastermind
-
Launches the game.
- mastermind - package mastermind
-
Everything required to bring Mastermind to life.
- Mastermind - Class in mastermind
-
Main class for the Mastermind game.
- Mastermind() - Constructor for class mastermind.Mastermind
- mastermind.controllers - package mastermind.controllers
-
Controls the game stages and user interface.
- mastermind.core - package mastermind.core
-
Components responsible for game logic.
- mastermind.core.solvers - package mastermind.core.solvers
-
Algorithms for computer guessing.
- MastermindAlgorithm - Class in mastermind.core.solvers
-
Provides the structure for making guesses and evaluating responses in the Mastermind game.
- MastermindAlgorithm() - Constructor for class mastermind.core.solvers.MastermindAlgorithm
- MediumAlgorithm - Class in mastermind.core.solvers
-
Medium algorithm is an improved Mastermind solver that narrows down possible code guesses based on previous feedback.
- MediumAlgorithm() - Constructor for class mastermind.core.solvers.MediumAlgorithm
-
Constructor initializes the random number generator and generates all possible codes.
N
- NUM_COLORS - Static variable in class mastermind.Mastermind
-
The number of colors used in the game.
- NUM_GUESSES - Static variable in class mastermind.Mastermind
-
The maximum number of guesses allowed.
O
- ORANGE - Enum constant in enum class mastermind.core.Code.Color
P
- PopupWindow - Class in mastermind.controllers
-
Controller class for the popup window for returning players with unfinished games.
- PopupWindow() - Constructor for class mastermind.controllers.PopupWindow
- PURPLE - Enum constant in enum class mastermind.core.Code.Color
R
- RED - Enum constant in enum class mastermind.core.Code.Color
- Response - Class in mastermind.core
-
The Response class is responsible for handling the result of a guess compared to a given code in the Mastermind game.
- Response(String) - Constructor for class mastermind.core.Response
-
Constructor to initialize the response based on a string format.
- Response(Pair<Integer, Integer>) - Constructor for class mastermind.core.Response
-
Constructor to initialize the response directly with a pair of correct and misplaced counts.
- Response(Code, Code) - Constructor for class mastermind.core.Response
-
Constructor to generate the response and peg colors based on the comparison of the guess and the code.
- restoreState(Code, List<Pair<Integer, Integer>>) - Method in class mastermind.core.solvers.DonaldKnuthAlgorithm
-
Restores the state of the algorithm with the last guess and previous responses.
- restoreState(Code, List<Pair<Integer, Integer>>) - Method in class mastermind.core.solvers.MediumAlgorithm
-
Restores the state of the algorithm, including the last guess and previously received responses.
S
- saveCreateGameState(String, int, List<String>, List<String>) - Static method in class mastermind.Utils
-
Saves the state of a create game (guesses and responses) for a given user.
- saveGuessGameState(String, int, List<String>, List<String>) - Static method in class mastermind.Utils
-
Saves the state of the game (guesses and responses) for a given user.
- saveInitialGuess(String, String) - Static method in class mastermind.Utils
-
Saves the initial guess to a user's game state.
- saveNextGuess(String, String) - Static method in class mastermind.Utils
-
Saves the next guess to a user's game state.
- saveToFile(String, String, String) - Static method in class mastermind.Utils
-
Saves the mode and level of a game to a file for a given user.
- saveToFile(String, String, String, Code) - Static method in class mastermind.Utils
-
Saves the initial game state (mode, level, and code) to a file for a given user.
- SelectCreateDifficultyLevel - Class in mastermind.controllers
-
Controller class for the select create difficulty level screen.
- SelectCreateDifficultyLevel() - Constructor for class mastermind.controllers.SelectCreateDifficultyLevel
- SelectGameMode - Class in mastermind.controllers
-
Controller class for selecting the game modes: guess or create.
- SelectGameMode() - Constructor for class mastermind.controllers.SelectGameMode
- SelectGuessDifficultyLevel - Class in mastermind.controllers
-
Controller class for the select guess difficulty level screen.
- SelectGuessDifficultyLevel() - Constructor for class mastermind.controllers.SelectGuessDifficultyLevel
- setCreateDifficultyLevel(String) - Method in class mastermind.core.State
-
Sets the difficulty level for creating the game.
- setGameFinished(boolean) - Method in class mastermind.core.State
-
Sets whether the game is finished or not.
- setGameMode(String) - Method in class mastermind.core.State
-
Sets the current game mode.
- setGuessDifficultyLevel(String) - Method in class mastermind.core.State
-
Sets the difficulty level for guessing.
- setUsername(String) - Method in class mastermind.core.State
-
Sets the username of the current player.
- start(Stage) - Method in class mastermind.Mastermind
-
Sets up the Mastermind game by loading the start menu and initializing the main window.
- StartMenu - Class in mastermind.controllers
-
Controller class for the start menu.
- StartMenu() - Constructor for class mastermind.controllers.StartMenu
- State - Class in mastermind.core
-
Singleton class representing the state of the Mastermind game.
T
- toSaveString() - Method in enum class mastermind.core.Code.Color
-
Converts the color to a string for saving purposes.
- toString() - Method in class mastermind.core.Code
-
Converts the code to a string representation, where the colors are separated by spaces.
- toString() - Method in class mastermind.core.Response
-
Get the string representation of the response.
- toString(int) - Static method in enum class mastermind.core.Code.Color
-
Converts an index to the corresponding Color name as a string.
U
- updateLeaderBoard(String, String, int, long) - Static method in class mastermind.Utils
-
Updates the leaderboard file with the latest game result.
- Utils - Class in mastermind
-
Utility class for game-related functionalities such as scene loading, color mapping, leaderboard updates, and game state management.
- Utils() - Constructor for class mastermind.Utils
V
- valueOf(String) - Static method in enum class mastermind.core.Code.Color
-
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.
- verifyUserResponses(Code, List<Code>, List<Pair<Integer, Integer>>) - Static method in class mastermind.Utils
-
Verifies the responses provided by the user against the expected responses from the computer's guesses.
Y
- YELLOW - Enum constant in enum class mastermind.core.Code.Color
All Classes and Interfaces|All Packages|Constant Field Values