Here are a number of my favorite games, coded in S. Fancy graphic interfaces are left as an exercise for the reader. A screen shot of the Pyramid Rubik Cube simulator is shown at right.
Another example...computer sets a random target string, you guess it...
SMASTERMIND
Length_of_Target (5) =?
Number_of_Symbols (5) =?
Target String is length=5 composed of symbols 1>5
Guess 1 =? 11133
..............................Matches= 1.....diagonal matches = 7
Guess 2 =? 44222
..............................Matches= 2.....diagonal matches = 3
Guess 3 =? 41555
..............................Matches= 1.....diagonal matches = 2
Guess 4 =? 43112
Correct! 4 Guesses!
The first guess got 8 total matches. This means 2  1s (for 6) and a 3 (2 more). It could also mean 4  3s, but this is unlikely, and is ruled out by the second guess. That only one of these three digits is in the correct position is important, and will be used later to narrow down the possibilities.
The second guess has a total of 5 matches, indicating one 2 and one 4, with the 4 in one of the first two positions and the 2 in one of the last three positions to get the 2 exact matches. This nails all of the digits, but we still need some info on the exact locations.
The third guess uses the 5's as dummies, since we know that there aren't any. 2 matches would indicate 413..., the one match means 431... (from the positions of guess 1).
The fourth guess was lucky. There were two possibilities, ending in 12 or 21.
