A classic code-breaking game implemented as a full-stack web application using React and Java Spring Boot.
Mastermind is a two-player game where one player (the codemaker) selects a secret code, and the other player (the codebreaker) attempts to guess it within a certain number of turns. After each guess, the codemaker provides feedback in the form of black and white pegs to indicate correct color and position (black) and correct color but incorrect position (white).
In the presented implementation the players, yourself and an AI oppoenet, choose a 4-digit number, and then take turns guessing.
This project is a collaborative effort between me and a friend, developed as part of our learning journey in full-stack web development. The backend includes an AI opponent that uses the Minimax algorithm to make optimal guesses.
- Frontend: React.js
- Backend: Java Spring Boot (AI opponent uses Minimax algorithm)
- Database: PostgreSQL
- Styling: CSS
MastermindGame/
โโโ backend/ # Java Spring Boot backend
โ โโโ src/
โ โโโ resources/
โ โโโ ...
โโโ frontend/ # React.js frontend
โ โโโ src/
โ โโโ public/
โ โโโ ...
โโโ README.md # Project documentation- Java Development Kit (JDK)
- Node.js and npm
- PostgreSQL installed and running
- Clone the repository:
git clone https://github.com/ralu2004/MastermindGame.git
cd MastermindGame- Set up the backend:
- Navigate to the backend/ directory.
- Configure PostgreSQL connection in application.properties or application.yml.
- Build and run the Spring Boot application:
./mvnw spring-boot:run
- Set up the frontend:
- Navigate to the frontend/ directory.
- Install dependencies:
npm install
- Start the React development server:
npm start
- Open your browser and go to http://localhost:3000 to play the game.
- Codemaker: Selects a 4-digit number.
- Codebreaker: Makes guesses to deduce the number.
- AI Opponent: Uses the Minimax algorithm for optimal guessing.
- Feedback: After each guess, the codemaker provides feedback: the hits and misses are displayed.
- The game continues until the codebreaker guesses the code or runs out of turns.
This project is licensed under the MIT License.
Raluca Adam GitHub: @ralu2004
Eduard Cavasi GitHub: @EduardCavasi