Very simple mastermind game for the iPhone. Originally made as a homework.
Tap the buttons below to change their color, you have to guess what colors and in what order they were randomly chosen at the beginning of the game. All four colors must be different. When you guess, you will get clues on top of the screen, a grey square means you guessed a color but in the wrong position, while a red square means you guessed a color and in its correct position. Once you guess all four colors correctly you get an alert that will let you know how many guesses it took you to find the answer.
For testing I also added a UISegmentedControl at the bottom so that you can mess around with the code and when you choose the "debug" section you'll be able to see the correct answer at the top, just below the hints.