penney

Penney's game


Keywords
penney, probability, game, python, windows, macos, linux, cli, fun, python3, console-game, console-application, cli-game, cli-games, penneygame, penney-game
License
MIT
Install
pip install penney==0.4

Documentation

Penney's Game

built with Python3 PyPI version

Overview

Penney's game, named after its inventor Walter Penney, is a binary (head/tail) sequence generating game between two or more players. Player A selects a sequence of heads and tails (of length 3 or larger), and shows this sequence to player B. Player B then selects another sequence of heads and tails of the same length. Subsequently, a fair coin is tossed until either player A's or player B's sequence appears as a consecutive subsequence of the coin toss outcomes. The player whose sequence appears first wins [Wikipedia].

Here we have a friendly clone of this game that I wrote during coronavirus quarantine days.

PyPI Counter
Github Stars
Branch master dev
CI
Code Quality CodeFactor codebeat badge

Installation

Source Code

  • Download and install Python3.x (>=3.5)
    • Select Add to PATH option
    • Select Install pip option
  • Download Version 0.4 or Latest Source
  • Run pip install -r requirements.txt or pip3 install -r requirements.txt (Need root access)
  • Run python3 setup.py install or python setup.py install (Need root access)

PyPI

Easy Install

  • Run easy_install --upgrade penney (Need root access)

Exe Version (Windows)

How to Play

  • Open CMD (Windows) or Terminal (UNIX)
  • Run python -m penney or python3 -m penney (or run executable version)

GIF

Try Penney in Your Browser!

You can play Penney's game online in interactive Jupyter Notebooks via the Binder service! Try it out now! :

Binder

  • Open Notebook.ipynb

Contribution

Changes and improvements are more than welcome! ❤️ Feel free to fork and open a pull request.

Please consider the following :

  1. Fork it!
  2. Create your feature branch (under dev branch)
  3. Add your functions/methods to proper files
  4. Pass all CI tests
  5. Update CHANGELOG.md
    • Describe changes under [Unreleased] section
  6. Submit a pull request into dev (please complete the pull request template)

Issues & Bug Reports

Just fill an issue and describe it. I'll check it ASAP! or send an email to sepand@pycm.ir.

  • Please complete the issue template

Dependencies

master dev
Requirements Status Requirements Status

References

1- Penney, Walter. "Problem 95: penney-ante." Journal of Recreational Mathematics 7 (1974): 321.
2- Zajkowski, Krzysztof. "Penney's game between many players." arXiv preprint arXiv:1212.3973 (2012).
3- Guy, R. K., and John Horton Conway. Winning Ways for your Mathematical Plays. Academic Press, London, 1982.
4- Humble, Steve, and Yutaka Nishiyama. "Humble-Nishiyama Randomness Game-A New Variation on Penney's Coin Game." (2010).

Show Your Support

Star This Repo

Give a ⭐️ if this project helped you!

Donate to Our Project

Bitcoin

1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy

Ethereum

0xcD4Db18B6664A9662123D4307B074aE968535388

Litecoin

Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ

Doge

DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh

Tron

TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7

Ripple

rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq

Binance Coin

bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef

Tether

0xcD4Db18B6664A9662123D4307B074aE968535388

Dash

Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s

Stellar

GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL