This machine that plays the "odds and evens" game with some external agent is inspired by game theory and American Romantic literature has had a wide reception in psychoanalysis and media theory by way of Jacques Lacan.1
Excerpt from the original memorandum
Here follows an excerpt quoted from: Claude E. Shannon: A Mind-Reading (?) Machine, Bell Laboratories Memorandum; March 18, 1953.
"This machine is a somewhat simplified model of a machine designed by D. W. Hagelbarger. It plays what is essentially the old game of matching pennies or "odds and evens." This game has been discussed from the game theoretic angle by von Neumann and Morgenstern, and from the psychological point of view by Edgar Allen Poe in the "The Purloined Letter." Oddly enough, the machine is aimed more nearly at Poe's method of play than von Neumann's.
To play against the machine, the player should guess out loud either "right" or "left." The center button of the machine is then pressed and the machine will light up either the right or left light. If the machine matches the player, the machine wins, otherwise the player wins. The player should then move the key switch in the direction corresponding to the choice he made. The machine will then register a win for the machine or the player, as the case may be, by shooting a ball into the proper glass tube. The overall score against all players since the machine was started is shown on the two counters visible through the front panel.
The Strategy of Operation
Basically, the machine looks for certain types of patterns in the behavior of its human opponent. If it can find these patterns it remembers them and assumes that the player will follow the patterns the next time the same situation arises. The machine also contains a random element. Until patterns have been found, or if an assumed pattern is not repeated at least twice by the player, the machine chooses its move at random. The types of patterns remembered involve the outcome of two successive plays (that is, whether or not the player won on those plays) and whether he changed his choice between them and after them. There are eight possible situations and, for each of these, two things the player can do. The eight situations are:
The SuperCollider Implementation
In SuperCollider, a mind reading (?) machine is a Stream. It takes the player's value as an argument (zero or one) and returns the machine's corresponding guess. If the two are the same, the machine guessed correctly and has thus won, otherwise it has lost.
The current implementation generalizes the Shannon/Hagelbarger schema and supports longer patterns, as well as alternative games with different tokens (the latter requires the implementation of a strategyClass).
Its musical application allows to reinterpret a zero sum game as a non zero sum call and response pattern.
Return a new instance.
patternSize |
The size of the behavioral pattern which the machine looks for. A typical pattern is "The player loses, plays differently, and loses", which is size 3: |
strategyClass |
By default a ShannonMindReadingStrategy, which can be subclassed to support other games. It implements two messages: differentValue (which returns the "opposite" value), and the comparison sameOrDifferent (which takes two guesses). |
In exchange for an external input the machine returns a guess of that input. You have to trust that it generated this in advance and doesn't just look at the input directly. Alternatively, you can look at the prediction (but that would be cheating) or at the source code.
call |
The call value for which the machine gives a response. This is either |
Reset the internal memory.
The machine always generates a prediction of the next input value, which is kept in this instance variable. You can have a look at it, but that is cheating.
Prints the strategies the machine has accumulated in Shannons's prose form.
The size of the behavioral pattern which the machine looks for. See: *new.
The type of strategy to look for. See: *new.
The previous move of the player.
The past few steps of the player (maximally -patternSize).
The stored and ordered types of behavior.
If set to true, extra information is printed to the post window.