← Open Source
ishikota

PyPokerEngine

Poker engine for poker AI development in Python.

Model DevelopmentEnvironmentsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
724
Stars
203
Forks
+0
This week
1
Contributors
Created 2016-06-05 · Updated 2026-10-02 · #14522 today
Top developers

ishikota/PyPokerEngine is ranked 14,522 with 724 stars.

Same-category comparison

ishikota/PyPokerEngine is ranked 14,522 among these 8 peers; jayroxis/PINNs is ranked 14,523.

Same-category comparison
NameRankMetrics
lucidrains/x-clip14,511
Language:
Python
Stars:
725
Forks:
48
Description:
A concise but complete implementation of CLIP with various experimental improvements from recent papers.
mit-acl/cadrl_ros14,512
Language:
Python
Stars:
725
Forks:
158
Description:
ROS package for dynamic obstacle avoidance for ground robots trained with deep RL.
ThibaultGROUEIX/AtlasNet14,516
Language:
Python
Stars:
724
Forks:
121
Description:
This repository contains the source codes for the paper "AtlasNet: A Papier-Mâché Approach to Learning 3D Surface Generation ". The network is able to synthesize a mesh (point cloud + connectivity) from a low-resolution point cloud, or from an image.
flymin/MagicDrive-V214,519
Language:
Python
Stars:
724
Forks:
28
Description:
[ICCV 2025] Official implementation of the paper “MagicDrive-V2: High-Resolution Long Video Generation for Autonomous Driving with Adaptive Control”.
jayroxis/PINNs14,523
Language:
Jupyter Notebook
Stars:
724
Forks:
179
Description:
PyTorch Implementation of Physics-informed Neural Networks.
AGI-Arena/MARS14,527
Language:
Python
Stars:
723
Forks:
49
Description:
The official implementation of MARS: Unleashing the Power of Variance Reduction for Training Large Models.
LikeLy-Journey/SegmenTron14,529
Language:
Python
Stars:
723
Forks:
157
Description:
Support PointRend, Fast_SCNN, HRNet, Deeplabv3_plus(xception, resnet, mobilenet), ContextNet, FPENet, DABNet, EdaNet, ENet, Espnetv2, RefineNet, UNet, DANet, HRNet, DFANet, HardNet, LedNet, OCNet, EncNet, DuNet, CGNet, CCNet, BiSeNet, PSPNet, ICNet, FCN, deeplab).
creafz/pytorch-cnn-finetune14,532
Language:
Python
Stars:
723
Forks:
121
Description:
Fine-tune pretrained Convolutional Neural Networks with PyTorch.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryEnvironments
KeywordsGaming, RL
Stars724
Forks203
Contributors1
Created date2016-06-05
Updated date2026-10-02
Stars in 1 day0
Stars in 7 days0
Rank14,522
Previous rank14,368
Rank change-154
7-day stars rank14,520
Previous 7-day stars rank14,534
7-day stars rank change14
Total stars rank14,482
Previous total stars rank14,458
Total stars rank change-24
CountryJapan
README summary

PyPokerEngine Poker engine for AI development in Python Tutorial This tutorial leads you to start point of poker AI development! Create simple AI which always returns same action. Play AI vs AI poker game and see its result. Installation Before start AI development, we need to install *PyPokerEngine*. Create first AI In this section, we create simple AI which always declares *CALL* action. To create poker AI, what we do is following 1. Create PokerPlayer class which is subclass of

. Implement abstract methods which inherit from class. (We assume you saved this file at ) If you are interested in what each callback method receives, See AI_CALLBACK_FORMAT. Play AI vs AI poker game Ok, let's play the poker game by using our created . To start the game, what we need to do is following 1. start stack, blind amount, ante, blind_structures) 2. Start the game and get game result Here is the code to play poker for 10

round with our created . We set , so simple game logs are output after call. GUI support We also provide GUI application. You can play poker with your AI on browser. for Reinforcement Learning users is developed for Reinforcement Learning usecase. So we also provide class which has convinient methods for Reinforcement Learning. Documentation For mode detail, please checkout doc site

Frequently asked questions

How many stars and forks are recorded?

ishikota/PyPokerEngine has 724 stars and 203 forks.

What is the repository rank?

ishikota/PyPokerEngine is ranked 14,522.

What language and category are recorded?

ishikota/PyPokerEngine has 724 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

ishikota/PyPokerEngine is compared with jayroxis/PINNs, ranked 14,523 with 724 stars.

README

PyPokerEngine

Poker engine for AI development in Python

Tutorial

This tutorial leads you to start point of poker AI development!!

Outline of Tutorial

  1. Create simple AI which always returns same action.
  2. Play AI vs AI poker game and see its result.

Installation

Before start AI development, we need to install PyPokerEngine.
You can use pip like this.

pip install PyPokerEngine

This library supports Python 2 (2.7) and Python3 (3.5).

Create first AI

In this section, we create simple AI which always declares CALL action.
To create poker AI, what we do is following

  1. Create PokerPlayer class which is subclass of PypokerEngine.players.BasePokerPlayer.
  2. Implement abstract methods which inherit from BasePokerPlayer class.

Here is the code of our first AI. (We assume you saved this file at ~/dev/fish_player.py)

from pypokerengine.players import BasePokerPlayer

class FishPlayer(BasePokerPlayer):  # Do not forget to make parent class as "BasePokerPlayer"

    #  we define the logic to make an action through this method. (so this method would be the core of your AI)
    def declare_action(self, valid_actions, hole_card, round_state):
        # valid_actions format => [raise_action_info, call_action_info, fold_action_info]
        call_action_info = valid_actions[1]
        action, amount = call_action_info["action"], call_action_info["amount"]
        return action, amount   # action returned here is sent to the poker engine

    def receive_game_start_message(self, game_info):
        pass

    def receive_round_start_message(self, round_count, hole_card, seats):
        pass

    def receive_street_start_message(self, street, round_state):
        pass

    def receive_game_update_message(self, action, round_state):
        pass

    def receive_round_result_message(self, winners, hand_info, round_state):
        pass


If you are interested in what each callback method receives, See AI_CALLBACK_FORMAT.md.

Play AI vs AI poker game

Ok, let's play the poker game by using our created FishPlayer.
To start the game, what we need to do is following

  1. Define game rule through Config object (ex. start stack, blind amount, ante, blind_structures)
  2. Register your AI with Config object.
  3. Start the game and get game result

Here is the code to play poker for 10 round with our created FishPlayer.

from pypokerengine.api.game import setup_config, start_poker

config = setup_config(max_round=10, initial_stack=100, small_blind_amount=5)
config.register_player(name="p1", algorithm=FishPlayer())
config.register_player(name="p2", algorithm=FishPlayer())
config.register_player(name="p3", algorithm=FishPlayer())
game_result = start_poker(config, verbose=1)

We set verbose=1, so simple game logs are output after start_poker call.

Started the round 1
Street "preflop" started. (community card = [])
"p1" declared "call:10"
"p2" declared "call:10"
"p3" declared "call:10"
Street "flop" started. (community card = ['C4', 'C6', 'CA'])
"p2" declared "call:0"
"p3" declared "call:0"
"p1" declared "call:0"
Street "turn" started. (community card = ['C4', 'C6', 'CA', 'D4'])
"p2" declared "call:0"
"p3" declared "call:0"
"p1" declared "call:0"
Street "river" started. (community card = ['C4', 'C6', 'CA', 'D4', 'H2'])
"p2" declared "call:0"
"p3" declared "call:0"
"p1" declared "call:0"
"['p3']" won the round 1 (stack = {'p2': 90, 'p3': 120, 'p1': 90})
Started the round 2
...
"['p1']" won the round 10 (stack = {'p2': 30, 'p3': 120, 'p1': 150})

Finally, let's check the game result !!

>>> print game_result
{
  'rule': {'ante': 0, 'blind_structure': {}, 'max_round': 10, 'initial_stack': 100, 'small_blind_amount': 5},
  'players': [
    {'stack': 150, 'state': 'participating', 'name': 'p1', 'uuid': 'ijaukuognlkplasfspehcp'},
    {'stack': 30, 'state': 'participating', 'name': 'p2', 'uuid': 'uadjzyetdwsaxzflrdsysj'},
    {'stack': 120, 'state': 'participating', 'name': 'p3', 'uuid': 'tmnkoazoqitkzcreihrhao'}
  ]
}

GUI support

We also provide GUI application. You can play poker with your AI on browser.
Please check PyPokerGUI.

for Reinforcement Learning users

PyPokerEngine is developed for Reinforcement Learning usecase.
So we also provide Emulator class which has convinient methods for Reinforcement Learning.
Common usage of Emulator would be like below.

from pypokerengine.players import BasePokerPlayer
from pypokerengine.api.emulator import Emulator
from pypokerengine.utils.game_state_utils import restore_game_state

from mymodule.poker_ai.player_model import SomePlayerModel

class RLPLayer(BasePokerPlayer):

    # Setup Emulator object by registering game information
    def receive_game_start_message(self, game_info):
        player_num = game_info["player_num"]
        max_round = game_info["rule"]["max_round"]
        small_blind_amount = game_info["rule"]["small_blind_amount"]
        ante_amount = game_info["rule"]["ante"]
        blind_structure = game_info["rule"]["blind_structure"]
        
        self.emulator = Emulator()
        self.emulator.set_game_rule(player_num, max_round, small_blind_amount, ante_amount)
        self.emulator.set_blind_structure(blind_structure)
        
        # Register algorithm of each player which used in the simulation.
        for player_info in game_info["seats"]["players"]:
            self.emulator.register_player(player_info["uuid"], SomePlayerModel())

    def declare_action(self, valid_actions, hole_card, round_state):
        game_state = restore_game_state(round_state)
        # decide action by using some simulation result
        # updated_state, events = self.emulator.apply_action(game_state, "fold")
        # updated_state, events = self.emulator.run_until_round_finish(game_state)
        # updated_state, events = self.emulator.run_until_game_finish(game_state)
        if self.is_good_simulation_result(updated_state):
            return # you would declare CALL or RAISE action
        else:
            return "fold", 0
    

Documentation

For mode detail, please checkout doc site

Nearby in the ranking
Similar items