A lot of people scoff at computer games, but from the programmer's point of view, a good game can be at least as challenging as more serious software. A game program typically includes a subroutine to:
Get user input.
Explore possible moves for enemy/ friendly shapes, checking for validity.
Update the screen, possibly scrolling the background as well.
Detect collisions between shapes, and possibly update the score, the highscore, move to the next round, or decrease the number of lives, remaining time, and maybe end the game.
Games of thought can only have an input, processing and output routine, and may sometimes lack the superb animation of arcade games, but they still serve their purpose.
Here is a game of mastermind: You are required to guess a 4- digit number. To make the game easier, you are assured that no two digits are the same, so the number is actually between 0123 and 9876. For each guess, you are given the number of correct digits, plus the number of digits which are in the proper place, as well. For example, if the hidden number is 2034, a guess of 6724 will yield two correct digits, one of them being in the right position, too. Out of range values will default to acceptable numbers. By partially modifying your previous answers, you can get at the right number much faster than you may think at first. The program will give you 12 tries, but when you get used to the game, you should only need about 8. Hint: Unless you are exceptionally fortunate, you may want your first two tries to be something like 1234 and 5678. Good luck! (Javascript required.)
If you are script- minded, here is the source code.