Author: Vincent Zhou
TO RUN CODE: Change current directory to root directory and run MainCodeBreaker.java so txt files can be read properly.
Description: A console-based Java implementation of Codebreaker AKA Mastermind, featuring an AI solver implemented with Donald Knuth's Minimax algorithm, guaranteeing a solution within 5 moves.
Features: High-Efficiency AI Solver: Implements Knuth's Minimax algorithm to analyze all 1,296 possible permutations, guaranteeing a solution in 5 moves or fewer. Intelligent Feedback Validation: Includes a logic integrity check when playing against the AI. If you provide incorrect clues (black/white pegs) that contradict previous turns, the AI detects the error and identifies exactly where the inconsistency occurred. Hint System: Stuck while guessing? Follow the on-screen console instructions to receive dynamic hints generated by the solver engine. Persistent Leaderboard: Automatically tracks and saves high scores to local files, preserving records across game sessions.
The rules of Code Breaker are as following: One player will set a secret code, and the other player will try to guess it. The code length is 4 colours long and the possible colours are red,green,purple,yellow,orange,blue. The guesser will have 10 turns to try and guess the secret code created by the other player. After each guess, the code creator will give clues based on the guess. A black peg clue represents a colour in the correct position and correct colour, while a white peg clue represents wrong position but correct colour. If the guesser is not able to guess the secret code within 10 guesses, the code creator wins but if the code creator gives a wrong clue, they are disqualified and the guesser wins. In this program, black pegs are represented with b, white pegs are represented with w, and e represents no peg. In this program, you guess codes based on the first letter of colour in lowercase.