Skip to content

Mastermind game implemented in Java with an AI solver based on graph traversal , greedy heuristics, and extensible architecture for Dynamic Programming and Backtracking optimizations, inspired by ideas from Simon Tatham.

Notifications You must be signed in to change notification settings

AishiniGrandhi/Mastermind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mastermind

Mastermind game implemented in Java with an AI solver based on graph traversal , greedy heuristics, and extensible architecture for Dynamic Programming and Backtracking optimizations, inspired by ideas from Simon Tatham.

image

Overview

This project is an advanced Java-based implementation of the Mastermind game featuring an AI solver using Graph-based Breadth First Search (BFS) combined with a Greedy strategy.
The game includes a fully interactive Java Swing GUI allowing both human and AI turns.


Core Concepts Used

  • Graph Modeling of Game States
  • Breadth First Search (BFS)
  • Greedy Decision Making
  • Constraint Pruning
  • Object-Oriented Programming (OOP)

Technologies

  • Java
  • Java Swing (GUI)
  • BFS Graph Traversal
  • Greedy Algorithms
  • Event Handling

Features

  • Interactive drag-and-drop color selection
  • BFS-based AI solver with pruning
  • Greedy move selection for deterministic AI behavior
  • Visual feedback with black & white pegs
  • Restartable gameplay
  • Human vs AI turn system

Architecture

  • MastermindEngine
    Handles secret generation, guess evaluation, and graph vertex generation.

  • GraphBFSNavigator
    Implements BFS traversal, pruning of invalid states, and greedy selection.

  • MastermindBoardGUI
    Java Swing-based graphical interface integrating human and AI gameplay.


How to Run

  1. Clone the repository
git clone https://github.com/yourusername/Mastermind

2. Compile all files

javac *.java

  1. Run the game
java MastermindBoardGUI

About

Mastermind game implemented in Java with an AI solver based on graph traversal , greedy heuristics, and extensible architecture for Dynamic Programming and Backtracking optimizations, inspired by ideas from Simon Tatham.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages