Do not program a GUI - your application should be text-based.
Basic Game I: Computer chooses, Player guesses
The computer starts by randomly choosing a 4-letter word over the 4-letter alphabet {A, B, C, D}, e.g. ACBD. The player then starts to guess the computer’s choice, e.g. the player could guess AACA. The computer compares the user’s guess with its choice and outputs a word over the alphabet {<, =,="">} that contains:
for each correctly guessed letter an equals symbol =
for each letter that is too small a less-than symbol
for each letter that is too big a bigger-than symbol >
Note that the order of the letters in the output word does not matter! In the given example a possible output could be <=> because two guessed letters are too small, one is correct and one is too big (the third guessed letter is C compared with letter B in the computer’s choice).
If the player guessed correctly, the game ends by congratulating the player. Otherwise a new round of the game begins, i.e., the user is asked to enter another guess. If the player does not guess the right letter combination after 6 rounds the player loses and the game terminates.
Basic Game II: Player chooses, Computer guesses
This game is the same game as the previous one but with switched roles. First, the player is asked to choose a combination of a 4-letter word over the 4-letter alphabet {A, B, C, D} (that she/he can write e.g. on a piece of paper.) The computer then starts guessing a combination and the player has to enter a word over the alphabet {<,=,>} that correctly evaluates the computer’s guess. For example, if the player chose the word AAAA and the computer guessed CCAC the player has to enter the word >>>=. The order of the symbols in the player’s word should not matter, so he could have also entered the word >=>> or =>>>.
Again the game proceeds in rounds as described previously - if the computer manages to guess the right combination, it wins. If this does not happen after 6 rounds, it loses. In order to minimise the likelihood that the player cheats by changing his original choice during the game, the program should maintain a list of possible combinations that is updated after each guess. For example if the computer guessed AAAA and received the reply
In case the list of possible combinations becomes empty during a game, the game should terminate and inform the player that the computer suspects that the player was either cheating or evaluating one of the computer’s guesses wrongly.
The computer should follow a “reasonable” strategy when trying to guess the combination. The most basic requirement for such a strategy is to choose only from those combinations that are still possible (given the history of the game). For the purpose of this exercise it is sufficient to implement this basic strategy, but you could try to improve the strategy of the computer if you wish to.
In both game options the computer should display at the beginning of each round the number of rounds played and the remaining number of possible combinations.
,=,>=>,>