Consider the following two player word game, which slightly resembles Mastermind:
The first player secretly picks a word and tells its length to the second player.
The second player then guesses a word, and the first player responds by telling whether
the number of correct letters in correct positions is even or odd. This is repeated
until the second player can figure out what the first player's picked word is (see the examples
for clarifications).
Create a class WordGuessingGame containing the method possibleWords which takes
a String[] even containing all the guessed words so far where
the correct number of letters in the correct position were even, and a String[]
odd containing all the guessed words so far where the correct
number of letters in the correct position were odd. The method should return a
String[] containing all possible words that the first player
could have picked. The String[] should be sorted in alphabetical order.
|