Games of logical deduction are an obvious choice for programming. The prime example is the code breaking game of mastermind.
It is fairly easy to program the computer to act as a code maker, with a user trying to find the computer's code. More difficult is to program the computer to find the user's code.
This question is split into two. The first is to write a mastermind game where the computer has the sequence and the user guesses, the second is where the computer attempts to work out the sequence. I feel the first is the more interesting solution, so I've started with that one.