You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: