Skip to content

ralu2004/MastermindGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Mastermind Game

A classic code-breaking game implemented as a full-stack web application using React and Java Spring Boot.


๐Ÿ“Œ Overview

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.


๐Ÿ›  Technologies Used

  • Frontend: React.js
  • Backend: Java Spring Boot (AI opponent uses Minimax algorithm)
  • Database: PostgreSQL
  • Styling: CSS

๐Ÿ“‚ Project Structure

MastermindGame/
โ”œโ”€โ”€ backend/ # Java Spring Boot backend
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ resources/
โ”‚ โ””โ”€โ”€ ...
โ”œโ”€โ”€ frontend/ # React.js frontend
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ public/
โ”‚ โ””โ”€โ”€ ...
โ””โ”€โ”€ README.md # Project documentation


๐Ÿš€ How to Run

Prerequisites

Steps

  1. Clone the repository:
   git clone https://github.com/ralu2004/MastermindGame.git
   cd MastermindGame
  1. 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
  1. 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.

๐ŸŽฎ Gameplay

  • 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.

๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ“ฌ Contact

Raluca Adam GitHub: @ralu2004


Co-author

Eduard Cavasi GitHub: @EduardCavasi

About

React + Spring Boot Mastermind game; AI uses Minimax, data stored in PostgreSQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published