Coder Social home page Coder Social logo

pypokertools's Introduction

pypokertools

The project

This is a sample of Python code from a larger No-Limit Texas Hold'em (NLHE) poker analysis project. It may be of interest to someone building their own poker library.

You can find many other examples of poker programs online, most of which deal with random dealing, ranking hands, keeping track of betting etc. This project has a different focus. It is designed to solve more unusual analysis problems that I encountered as a professional poker player such as finding isomorphic/canonical representations of the flop, and finding nuanced hand properties (e.g. having 'three-to-a-straight' and 'two overcards') rather than 'which hand ranks higher'.

In this repository

  • pokertools.py: providing the basic building block: a Card type
  • properties: many predicates of tuples of cards, e.g. is_twopair, is_rainbow
  • examples/bluffing.py: finding nuanced flop hand properties for bluffing
  • examples/translation.py: parsing PokerStove-style card notation using a tokeniser
  • examples/isomorph.py: working with suit isomorphisms on the flop

A Note on Terminology

The word 'hand' in poker is ambiguous. It could mean: the two hole cards I have been dealt; the best 5-card poker hand I can make with any combination of my hole cards and the board; the unit of a poker game starting with dealing hole cards and ending with the winner collecting the pot.

In this library, the first two meanings are important to distinguish. I reserve holecards for the former and hand for the latter.

TODO

Some of the techniques in the above have been used to create an approximate Nash Equilibrium strategy solver for a simplified version of NLHE. One day I might release more code from that project, such as:

  • a tool to construct simplified NLHE game trees recursively
  • an iterative constraint-satisfaction algorithm using NumPy to split ranges of holecards into e.g. betting and checking actions according to given criteria such as equity and polarity
  • a tool using the 'sklearn' machine learning framework to analyse hand history data

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.