The Game of Master Mind is performed in the following way: Each of the computer's four slots will hold a ball that is either red (R), yellow (Y), green (G), or blue (B). The computer may have the following configuration: RGGB (Slot #1 is red, Slots #2 and #3 are green, and Slot #4 is blue). The user is making an educated guess at the answer. For instance, you may assume YRGB. You receive a bonus when you predict the right colour for the right slot "hit:' You receive an if you choose a colour that is real but is in the incorrect slot "pseudo-hit:' Keep in mind that a hit slot can never also qualify as a pseudo-hit. For example, if the actual solution is RGBY and you guess GGRR, you have one hit and one pseudohit Write a method that, given a guess and a solution, returns the number of hits and pseudo-hits

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 12RP
icon
Related questions
icon
Concept explainers
Question

The Game of Master Mind is performed in the following way:
Each of the computer's four slots will hold a ball that is either red (R), yellow (Y), green (G), or blue (B). The computer may have the following configuration: RGGB (Slot #1 is red, Slots #2 and #3 are green, and Slot #4 is blue).
The user is making an educated guess at the answer. For instance, you may assume YRGB.
You receive a bonus when you predict the right colour for the right slot "hit:' You receive an if you choose a colour that is real but is in the incorrect slot "pseudo-hit:' Keep in mind that a hit slot can never also qualify as a pseudo-hit.
For example, if the actual solution is RGBY and you guess GGRR, you have one hit and one pseudohit
Write a method that, given a guess and a solution, returns the number of hits and pseudo-hits

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT