Skip to content

Create a MasterMind guessing game #1278

Description

@winsonrich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions