Giter Site home page Giter Site logo

catseye / flip Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 148 KB

An implementation in Erlang of the venerable and ancient coin-tossing game of Flip

Home Page: http://catseye.tc/node/Flip

License: The Unlicense

Shell 6.48% Erlang 93.52%
retrogaming computer-game machine-learning classic-game

flip's Introduction

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.

flip's People

Contributors

cpressey avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.