Problem 43562. Mastermind

We are playing the boardgame mastermind The game master has created a 4-character code for you to guess, with characters ranging from "1" to "6" (e.g. code = [2 1 3 4]).

The first guess (this will be [1 1 2 2]) is already done and the game master has given you following feedback:

  1. The number of correct characters in your guess, in this case 1 because character "1" at index 2 is correct.
  2. The number of correct characters, but in a wrong place. In this case 1 because you guessed character "2", but it is in the wrong place.

Now, your function has to do the next guesses. Each time your function is called, the input will contain the code and feedback of all your previous guesses, the output is a copy of the input with your new code added (refer to the example code).

It is shown you could solve the code in only 4 additional guesses (refer to the wiki page), you will however get 11 according to the rules of Mastermind.

Good luck!

Solution Stats

52.38% Correct | 47.62% Incorrect
Last Solution submitted on Mar 08, 2020