Skip to content

FlysonBot/Mastermind

Mastermind Logo

Version: GitHub tag GitHub Release Python Version PyPI - Version
Meta: GitHub License PyPI Status Repo Size pre-commit.ci status

Links:

Mastermind

A terminal Mastermind game with 4 modes and a built-in magic solver. Install with pip and play in seconds — no configuration needed.

What is Mastermind?

Mastermind is a classic code-breaking game: one player hides a secret code, the other tries to crack it. After each guess, you get feedback on how close you are — and you have to use that to narrow it down before you run out of attempts. Simple to learn, surprisingly deep to master.

Features

  • Play — Guess the secret code yourself
  • Watch — Let the AI solve it optimally
  • Assist — Get AI suggestions while playing a real game
  • Rules — Learn how to play

Getting Started

Prerequisites

Just install Python 3.12+ and pip — the Java runtime is bundled for Linux, Windows, and macOS.

For Android, install Termux and run pkg install openjdk-21 first.

Technical Details for Developers
  • JPype: bridges Python and Java at runtime, allowing the Python UI to call into the high-performance Java solver directly without a subprocess.

Installation

  1. Install Python 3.12+ if you haven't already.

  2. Install the latest release:

    pip install mastermind-ai
  3. Run the program:

    mastermind

Tip

If the above does not work, see the Troubleshooting Guide.

You can also try it in your browser with Google Colab.

Contributing

Contributions are welcome! See the Contributing Guidelines.

License

Licensed under MIT License by @FlysonBot.

Questions?

Feel free to leave questions in the Discussions or open an Issue.

About

A Python package that simulates the Mastermind game with an AI solver.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors