Skip to content

Mastermind#101

Open
stellaappiok wants to merge 12 commits into
Grow-with-Open-Source:mainfrom
stellaappiok:mastermind
Open

Mastermind#101
stellaappiok wants to merge 12 commits into
Grow-with-Open-Source:mainfrom
stellaappiok:mastermind

Conversation

@stellaappiok

Copy link
Copy Markdown
Contributor

This adds a terminal-based implementation of the classic Mastermind code-breaking game.
What it does

  • Generates a random secret 4-color code from a set of 6 colors
  • Lets the player guess the code (space-separated colors) over up to 10 tries
  • Scores each guess with correct-position and incorrect-position counts, correctly handling duplicate colors so a color isn't double-counted across both checks
  • Ends when the player guesses correctly or runs out of tries (revealing the code)

Why
A simple, dependency-free logic game that's a good example of input validation and a non-trivial scoring algorithm (handling repeated colors properly is the classic Mastermind gotcha).
How to test

  1. Run python mastermind.py
  2. Try a few guesses with invalid input (wrong length, invalid color letters) to confirm validation messages appear
  3. Play a full round to confirm scoring feedback and win/lose conditions behave as expected, including guesses with repeated colors (e.g. code has one R but your guess has two)

@github-actions

Copy link
Copy Markdown

👋 @stellaappiok
Thank you for raising your pull request.
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant