PokerFace is a Python package for various poker tools.

Overview

PokerFace

PokerFace is a Python package for various poker tools.

The following features are present in PokerFace...

  • Types for cards and their components and related helper functions
    • Rank
    • Suit
    • Ranks
    • Card
    • Hole Card
  • Various types of poker decks
    • Standard Deck
    • Short Deck
  • Poker hand evaluations
    • Standard Evaluator
    • Greek Evaluator
    • Omaha Evaluator
    • Short-Deck Evaluator
    • Deuce-to-Seven Lowball Evaluator
    • Ace-to-Five Lowball Evaluator
    • Badugi Evaluator
  • Poker game variants
    • Texas Hold'em
      • Fixed-Limit Texas Hold'em
      • No-Limit Texas Hold'em
    • Omaha Hold'em
      • Pot-Limit Omaha Hold'em
    • 5-Card Omaha Hold'em
      • Fixed-Limit 5-Card Omaha Hold'em
      • Pot-Limit 5-Card Omaha Hold'em
    • 6-Card Omaha Hold'em
      • Pot-Limit 6-Card Omaha Hold'em
    • Greek Hold'em
      • Fixed-Limit Greek Hold'em
      • Pot-Limit Greek Hold'em
      • No-Limit Greek Hold'em
    • Short-Deck Hold'em
      • No-Limit Short-Deck Hold'em
    • 5-Card Draw
      • Fixed-Limit 5-Card Draw
      • Pot-Limit 5-Card Draw
      • No-Limit 5-Card Draw
    • Badugi
      • Fixed-Limit Badugi
    • 2-to-7 Single Draw Lowball
      • No-Limit 2-to-7 Single Draw Lowball
    • 2-to-7 Triple Draw Lowball
      • Fixed-Limit 2-to-7 Triple Draw Lowball
      • Pot-Limit 2-to-7 Triple Draw Lowball
    • Kuhn Poker
      • Fixed-Limit Kuhn Poker

The full documentation is available at Read the Docs.

License

GNU GPLv3

You might also like...
[DEPRECATED] YUM package manager

⛔ This project is deprecated. Please use DNF, the successor of YUM. YUM Yum is an automatic updater and installer for rpm-based systems. Included prog

A Poetry plugin for dynamically extracting the package version.

Poetry Version Plugin A Poetry plugin for dynamically extracting the package version. It can read the version from a file __init__.py with: # __init__

Easy to use, fast, git sourced based, C/C++ package manager.

Yet Another C/C++ Package Manager Easy to use, fast, git sourced based, C/C++ package manager. Features No need to install a program, just include the

The delightful package manager for AppImages

⚡️ Zap The delightful package manager for AppImages Report bug · Request feature Looking for the older Zap v1 (Python) implementation? Head over to v1

Dotpkg - Package manager for your dotfiles

Dotpkg A package manager for your dotfiles. Usage First make sure to have Python

Python dependency management and packaging made easy.
Python dependency management and packaging made easy.

Poetry: Dependency Management for Python Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right sta

A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/

This is a PyPI mirror client according to PEP 381 + PEP 503 http://www.python.org/dev/peps/pep-0381/. bandersnatch =4.0 supports Linux, MacOSX + Wind

Python PyPi staging server and packaging, testing, release tool

devpi: PyPI server and packaging/testing/release tool This repository contains three packages comprising the core devpi system on the server and clien

Python dependency management and packaging made easy.
Python dependency management and packaging made easy.

Poetry: Dependency Management for Python Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right sta

Comments
  • game.actor.showdown() throws IndexError for 2nd player at the end of a hand

    game.actor.showdown() throws IndexError for 2nd player at the end of a hand

    from pokerface import *
    from random import random
    
    evaluator = StandardEvaluator()
    deck = StandardDeck()
    stakes = (0,(1,2))
    stacks = [100,100]
    
    def random_action(p):
        if p.can_fold() and p.check_call_amount > 0 and random()<0.25:
            p.fold()
            return
        r = random()
        if r < 0.33:
            p.check_call()
        elif r<0.6:
            if p.can_bet_raise():
                p.bet_raise(max(p.bet_raise_min_amount, p.stack/5))
        elif r<0.75:
            if p.can_bet_raise():
                p.bet_raise(max(p.bet_raise_min_amount, p.stack/3))
        elif r<0.9:
            if p.can_bet_raise():
                p.bet_raise(max(p.bet_raise_min_amount, p.stack/5))
        elif r<0.9:
            if p.can_bet_raise():
                p.bet_raise(p.stack)
    
    def hand():
        deck = StandardDeck()
        game = NoLimitTexasHoldEm(Stakes(0, (1, 2)), stacks)
        game.nature.deal_hole()
        game.nature.deal_hole()
        while game.is_terminal() == False and game.actor != game.nature:
            random_action(game.actor)
    
        if game.is_terminal() == False:
            game.nature.deal_board()
            if game.actor != game.nature:
                game.actor.check_call()
                game.actor.check_call()
            game.nature.deal_board()
            if game.actor != game.nature:
                game.actor.check_call()
                game.actor.check_call()
            game.nature.deal_board()
            if game.actor != game.nature and game.is_terminal() == False:
                game.actor.check_call()
                game.actor.check_call()
            print(game.players, '____')
            for p in game.players:
                 if game.is_terminal() == False:
                    print(game.players)
                    print(game.actor)
                    print(game.actor.can_showdown(), game.actor.is_showdown_necessary())
                    game.actor.showdown()
        # print(dir(game))
        # print(dir(game.nature))
        print(game.players, 'end')
        stacks.clear()
        stacks.append(game.players[1].stack)
        stacks.append(game.players[0].stack)
        return 
    
    
    while 0 not in stacks:
        hand()
    

    results in

    SequenceView([PokerPlayer(0, 101, ????), PokerPlayer(0, 99)]) end
    SequenceView([PokerPlayer(0, 79.0, ????), PokerPlayer(0, 81.0, ????)]) ____
    SequenceView([PokerPlayer(0, 79.0, ????), PokerPlayer(0, 81.0, ????)])
    PokerPlayer(0, 79.0, ????)
    True True
    SequenceView([PokerPlayer(0, 79.0, 2cJs), PokerPlayer(0, 81.0, ????)])
    PokerPlayer(0, 81.0, ????)
    True True
    SequenceView([PokerPlayer(0, 79.0, 2cJs), PokerPlayer(0, 121.0, QhAd)]) end
    Traceback (most recent call last):
      File "/home/tenoke/.local/lib/python3.8/site-packages/pokerface/game.py", line 270, in _update
        while self.stages[index]._is_done():
    IndexError: tuple index out of range
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "create_data.py", line 67, in <module>
        hand()
      File "create_data.py", line 35, in hand
        random_action(game.actor)
      File "create_data.py", line 11, in random_action
        p.fold()
      File "/home/tenoke/.local/lib/python3.8/site-packages/pokerface/game.py", line 708, in fold
        self._get_fold_action().act()
      File "/home/tenoke/.local/lib/python3.8/site-packages/pokerface/_actions.py", line 16, in act
        self.game._update()
      File "/home/tenoke/.local/lib/python3.8/site-packages/pokerface/game.py", line 275, in _update
        self._distribute()
      File "/home/tenoke/.local/lib/python3.8/site-packages/pokerface/game.py", line 283, in _distribute
        for side_pot in self._side_pots:
      File "/home/tenoke/.local/lib/python3.8/site-packages/pokerface/game.py", line 187, in _side_pots
        cur = players[-1]._put
    IndexError: list index out of range
    

    despite needing to showdown to finish the hand

    opened by Tenoke 2
Releases(v1.0.1)
Owner
Juho Kim
University of Toronto Engineering Science
Juho Kim
A set of tools to keep your pinned Python dependencies fresh.

pip-tools = pip-compile + pip-sync A set of command line tools to help you keep your pip-based packages fresh, even when you've pinned them. You do pi

Jazzband 6.5k Dec 29, 2022
The Python Package Index

Warehouse Warehouse is the software that powers PyPI. See our development roadmap, documentation, and architectural overview. Getting Started You can

Python Packaging Authority 3.1k Jan 1, 2023
The Python package installer

pip - The Python Package Installer pip is the package installer for Python. You can use pip to install packages from the Python Package Index and othe

Python Packaging Authority 8.4k Dec 30, 2022
Example for how to package a Python library based on Cython.

Cython sample module This project is an example of a module that can be built using Cython. It is an upgrade from a similar model developed by Arin Kh

Juan José García Ripoll 4 Aug 28, 2022
OS-agnostic, system-level binary package manager and ecosystem

Conda is a cross-platform, language-agnostic binary package manager. It is the package manager used by Anaconda installations, but it may be used for

Conda 5.1k Dec 30, 2022
OS-agnostic, system-level binary package manager and ecosystem

Conda is a cross-platform, language-agnostic binary package manager. It is the package manager used by Anaconda installations, but it may be used for

Conda 5.1k Jan 7, 2023
The Fast Cross-Platform Package Manager

The Fast Cross-Platform Package Manager part of mamba-org Package Manager mamba Package Server quetz Package Builder boa mamba Mamba is a reimplementa

Mamba 4k Dec 30, 2022
Conan - The open-source C/C++ package manager

Conan Decentralized, open-source (MIT), C/C++ package manager. Homepage: https://conan.io/ Github: https://github.com/conan-io/conan Docs: https://doc

Conan.io 6.5k Jan 5, 2023
Package manager based on libdnf and libsolv. Replaces YUM.

Dandified YUM Dandified YUM (DNF) is the next upcoming major version of YUM. It does package management using RPM, libsolv and hawkey libraries. For m

null 1.1k Dec 26, 2022
A flexible package manager that supports multiple versions, configurations, platforms, and compilers.

Spack Spack is a multi-platform package manager that builds and installs multiple versions and configurations of software. It works on Linux, macOS, a

Spack 3.1k Jan 9, 2023