Skip to main content

Penney's game

Project description

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

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

0.4 - 2021-05-19

Added

  • requirements-splitter.py
  • print_seq function

Changed

  • Test system modified
  • game function modified
  • Menu optimized

0.3 - 2020-04-16

Changed

  • README.md modified
  • Minor issues fixed
  • print_result function tie condition bug fixed

0.2 - 2020-04-08

Added

  • det function
  • prob_calc function
  • print_prob function
  • C_calc function
  • Notebook.ipynb file
  • build_unix.sh file
  • Github action

Changed

  • README.md modified
  • version_check.py updated

0.1 - 2020-03-21

Added

  • Player mode
  • Computer mode
  • Exe version
  • Test system

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

penney-0.4.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

penney-0.4-py2.py3-none-any.whl (11.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file penney-0.4.tar.gz.

File metadata

  • Download URL: penney-0.4.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for penney-0.4.tar.gz
Algorithm Hash digest
SHA256 cc93b795b7942d0e9ff17851aca429d40d427457004a3f3033683959d57b5c4a
MD5 84fafc736bd48ff9041a77ef19a501b2
BLAKE2b-256 f10cd8244130fb164c68000b2674dde3dd6119116cb1f32eaff4ad1eadf6c191

See more details on using hashes here.

File details

Details for the file penney-0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: penney-0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for penney-0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d9d3979f3f56496a8628803c398532d43327de9df3877ef3441a789b9e8128c1
MD5 c79c5a88551760a44365f1aee7efc961
BLAKE2b-256 b7cd625d8f4a3c848226a38ec159feddbfcc7040b88977b772eee584bd5ec3c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page