Skip to main content

Cribbage for your command line

Project description

Implementation of cribbage for two players. Text-based GUI for use on your command line (so you can appear to be working). Several kinds of opponents.


  • Random. This opponent plays a random legal move
  • Expert. This opponent uses an enumerative strategy to determine the move with the greatest possible reward (points), and takes that move. The author wrote the optimal policy
  • Student. This opponent is a deep neural network that has been trained via self-play using Google Keras and OpenAI Gym (see /train for details) to execute an optimal policy


Install using pip

pip install cribbage

Or install from the source

git clone
cd cribbage
python install

How to use

From the command line, specify the kinds of players you want in the game

cribbage human random

You can also name the players

cribbage human random --name1 Osha --name2 Otto

If you would like to try playing one of the AI opponents, you can run with the following

cribbage human expert --name1 Alne --name2 Arin

Both the Student and the Expert players achieve performance that is better than most humans.


Run cribbage -h for an explanation of the command line arguments

Project details

Download files

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

Files for cribbage, version 1.2.2
Filename, size File type Python version Upload date Hashes
Filename, size cribbage-1.2.2.tar.gz (10.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page