Source

Flip /

Filename Size Date modified Message
bin
ebin
src
7 B
21 B
59 B
2.1 KB
1.2 KB
102 B

Flip

This is Cat's Eye Technologies' distribution of the game of Flip.

Flip is a very simple computer game by John S. James which first appeared in the March/April 1977 edition of Creative Computing.

In the game, the computer flips a virtual coin 50 times, and the object is for you to guess whether the coin will come up heads or tails each time.

What makes it interesting is that the coin is not fair. The computer tries to find patterns in your guesses, and exploit them by biasing the coin toss away from what it thinks you are likely to guess next.

This is interesting because humans are actually not all that good at moving randomly; we tend to and fall into patterns. So a pigeon, not thinking about the game and pecking haphazardly at "heads" and "tails" buttons, might actually be a better Flip player than you or me.

You can think of the program as creating a Markov chain to model your guesses, and updating it each time you make a guess, based on your last few guesses. Although, it's not quite that straightforward -- there is some randomness thrown in, too.

This version of the game is written in Erlang, based largely on the version written in BASIC by Steve North appearing in More BASIC Computer Games, Ed. David H. Ahl (ISBN 0-89480-137-6). Note that in this implementation, heads and tails are called Y and N.

Running

To build the flip module, run the script make.sh from the root directory of the distribution.

After the module has been built, the game can be played by running the script flip in the bin directory. This script can be run from anywhere; it knows to locate the module in the distribution directory.

Playing the Game

Each time the computer prompts you with a question mark, type 'Y' to guess that the flip was heads, or 'N' to guess that the flip was tails. A correct guess will be signalled by an asterisk printed before the next question mark. At the end of the run (by default 50 flips,) your score will be printed.

License

This work is in the public domain. See the file UNLICENSE for more information.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.