Mastermind is a game where the code maker selects a series of P pegs from C 
colors, and the code breaker tries to guess the code, with the help of 
hints after each guess.
 
After a guess, the code maker gives a response made up of some number of 
black pegs and some number of white pegs. A black peg is awarded for every 
peg in the guess which is the right color in the right position. A white 
peg is awarded for every peg in the guess which is the right color in the 
wrong position. Only one response peg can be awarded for any peg in the 
code or guess, which black responses taking precedence over white responses.
 
For example, if the code is
AABBC
 
And the guess is
ABCDC
 
The code maker would give a black peg for the match of A in the first 
position, and a second black peg for the match of C in the last position.
He would give one white peg for the B in the wrong position. The C in the 
third position would not get a peg because the C in the code was already 
given a black peg.
 
So the response would be 2 black pegs and one white peg.
 
The order of the black and white pegs in the response has no significance.
 
Define an algorithm with O(P) runtime complexity to determine the correct 
response to a guess. The algorithm should require a feasible amount of 
memory for P<1000 and C<1000 (meaning you can't have a table of size C^P).
 
Don

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.

Reply via email to