Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a MasterMind guessing game #1278

Open
winsonrich opened this issue Oct 25, 2018 · 0 comments
Open

Create a MasterMind guessing game #1278

winsonrich opened this issue Oct 25, 2018 · 0 comments

Comments

@winsonrich
Copy link

We will write a version of MasterMind, which has two hints for a code breaker to break a secret code:
• the number of position (and digit) matches; and
• the number of remaining digit matches. The positions of these digits do not match.

In the process of determining the hints, each digit can be used once only. We need to ignore (or
remove) matched digits from the secret code and the guessed code before further checking. For
example, if the secret code is 0022 and the guessed code is 0241. The hint is "1 position match and 1
digit match". The digit with matched position is the first "0" (secret code becomes -022 and guessed
code becomes -241, where "-" represents an ignored digit) and the remaining digit match is "2" (secret
code now becomes -0-2 and guessed code becomes --41). If the guessed code is 2021 instead, the hint
is "2 position matches and 1 digit match" with the middle "02" as the matched positions and the digit
"2" as the matched digit.

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

No branches or pull requests

1 participant