Psim can guess what you're thinking ... sometimes!
Using his incredibly tiny brain, combined with the unparalleled psychic power of genuine Lego string, Psim receives your thoughts and commands the NXT brick to invite you to choose a color.
(Psim is not psychic enough to know you are there, so if he hasn't asked you to choose a color, press the orange button one or more times, until he does so.)
In front of Psim (see him hanging from the string?) are two sets of colored flags. The flags on the left are for you to use to keep track of the color you choose. Those on the right are Psim's, and he uses his remarkable psychic power, and a motor connected to the NXT brick, to make them spin.
When Psim asks you to choose a color, turn your flags so that your choice is pointing up, then press the orange button on the NXT brick so that he will know you have made a choice. Psim will try to read your mind, spinning his flags until he has made his guess, which will also be pointing up when they stop moving. Note that, amazingly, Psim does not move his lips while he is reading your mind! He will, however, ask you if his guess was correct. If it was, press the > button to the right of the orange one, and Psim will rise. If his guess was wrong, press the < button on the left, and Psim will descend.
He might not guess your choice at first, but if you're patient, and especially if your choices follow any sort of pattern, after a few tries Psim will probably guess correctly most of the time; soon he'll reach the top and enjoy his reward, which involves sitting under the palm tree, enjoying a banana and a glass of Chardonnay. (It's a little-known fact that Lego bananas grow from Lego palm trees. What did you expect -- palms?)
So, what's the trick? you ask. There is no trick. There are no cameras, hidden wires, or sensors -- what you see is all there is. The mind-reading is performed by a simple yet powerful forecasting algorithm written in NXC and running on the NXT brick. The algorithm keeps track of your last several choices and uses a predictor array to make a guess about your latest choice.
The idea underlying predictor arrays is that there are often many different, but plausible, ways to make a forecast. In Psim's color-guessing game, a simple prediction is that the next color will be the same as the previous color. (This prediction would work pretty well for someone who doesn't turn the flags every time.) Another simple prediction is that two colors might alternate (for example: red, blue, red, blue ...). This is equivalent to guessing that the next color will match the second previous color. Yet another is that the human player will choose the next color on each turn (red, blue, yellow, red, blue, yellow, ...). It's not difficult to imagine many more ways to predict a color. Any one of these predictions might be good, or none of them. By keeping track of how accurately each method predicts, we can identify which of the simple predictors (if any) works best on average. Psim's algorithm does just that, and its prediction is taken from whichever simple predictor is currently most reliable.
Since people aren't robots, their patterns of choice may change from time to time, so Psim's algorithm needs to recognize when this has happened. The easiest way to do this is to give greater importance to recent observations than to older ones. A standard method for doing this is to calculate so-called autoregressive moving averages (ARMA) of the accuracies of the various predictors; Psim uses computationally simpler incremental averages (related to median filters) for this purpose.
Predictor arrays have been used in applications ranging from games to detection of abnormal heart rhythms. For additional information, including the NXC source for Psim's program, see http://ecg.mit.edu/george/predictor-arrays/.
Psim visited Brickworld 2008, where many visitors enjoyed him. Each turn takes a few seconds, however, and that limited Psim's appeal to some visitors, especially since there was an amazing variety of other things to see. Psim's training would be quicker if there were only two choices.
Some visitors chose to spin their flags rather than making a deliberate (hence relatively predictable) choice; that doesn't yield a random result, however, because of mechanical imperfections in the spinner, and any non-randomness is exploitable. It can take a long time to see this effect, however.
It's interesting to see how people approach something that claims to predict their behavior: some take it as an opponent to outwit (some of the flag-spinners were in this group), while others try to help it do a better job. There's a psychology experiment in there somewhere!
George Moody <firstname.lastname@example.org>