Posted  by 

Texas Holdem Python

Latest version

Released:

The hand object can be given more than five cards (as in Texas Hold’em or similar variants) and the evaluation will pick the best hand. Evaluated pokercards.cards.PokerHand objects are compared and sorted by the rank of the hand. Cards¶ List of pokercards.cards.Card objects to make the hand from. I tried google but I cant find anything. I'd like to get my hands on some simple holdem code to give me some idea how it is written. I am pretty new to Python and wouldn't know how to structure this game to begin with but it is something I can mess in to figure out.

OpenAI Gym No-Limit Texas Holdem Environment.

Project description

# holdem
:warning: **This is an experimental API, it will most definitely contain bugs, but that's why you are here!**
```sh
pip install holdem
```
Afaik, this is the first [OpenAI Gym](https://github.com/openai/gym) _No-Limit Texas Hold'em_* (NLTH)
environment written in Python. It's an experiment to build a Gym environment that is synchronous and
can support any number of players but also appeal to the general public that wants to learn how to
'solve' NLTH.
*Python 3 supports arbitrary length integers :money_with_wings:
Right now, this is a work in progress, but I believe the API is mature enough for some preliminary
experiments. Join me in making some interesting progress on multi-agent Gym environments.
# Usage
There is limited documentation at the moment. I'll try to make this less painful to understand.
## `env = holdem.TexasHoldemEnv(n_seats, max_limit=1e9, debug=False)`
Creates a gym environment representation a NLTH Table from the parameters:
+ `n_seats` - number of available players for the current table. No players are initially allocated
to the table. You must call `env.add_player(seat_id, ..)` to populate the table.
+ `max_limit` - max_limit is used to define the `gym.spaces` API for the class. It does not actually
determine any NLTH limits; in support of `gym.spaces.Discrete`.
+ `debug` - add debug statements to play, will probably be removed in the future.
### `env.add_player(seat_id, stack=2000)`
Adds a player to the table according to the specified seat (`seat_id`) and the initial amount of
chips allocated to the player's `stack`. If the table does not have enough seats according to the
`n_seats` used by the constructor, a `gym.error.Error` will be raised.
### `(player_states, community_states) = env.reset()`
Calling `env.reset` resets the NLTH table to a new hand state. It does not reset any of the players
stacks, or, reset any of the blinds. New behavior is reserved for a special, future portion of the
API that is yet another feature that is not standard in Gym environments and is a work in progress.
The observation returned is a `tuple` of the following by index:
0. `player_states` - a `tuple` where each entry is `tuple(player_info, player_hand)`, this feature
can be used to gather all states and hands by `(player_infos, player_hands) = zip(*player_states)`.
+ `player_infos` - is a `list` of `int` features describing the individual player. It contains
the following by index:
0. `[0, 1]` - `0` - seat is empty, `1` - seat is not empty.
1. `[0, n_seats - 1]` - player's id, where they are sitting.
2. `[0, inf]` - player's current stack.
3. `[0, 1]` - player is playing the current hand.
4. `[0, inf]` the player's current handrank according to `treys.Evaluator.evaluate(hand, community)`.
5. `[0, 1]` - `0` - player has not played this round, `1` - player has played this round.
6. `[0, 1]` - `0` - player is currently not betting, `1` - player is betting.
7. `[0, 1]` - `0` - player is currently not all-in, `1` - player is all-in.
8. `[0, inf]` - player's last sidepot.
+ `player_hands` - is a `list` of `int` features describing the cards in the player's pocket.
The values are encoded based on the `treys.Card` integer representation.
1. `community_states` - a `tuple(community_infos, community_cards)` where:
+ `community_infos` - a `list` by index:
0. `[0, n_seats - 1]` - location of the dealer button, where big blind is posted.
1. `[0, inf]` - the current small blind amount.
2. `[0, inf]` - the current big blind amount.
3. `[0, inf]` - the current total amount in the community pot.
4. `[0, inf]` - the last posted raise amount.
5. `[0, inf]` - minimum required raise amount, if above 0.
6. `[0, inf]` - the amount required to call.
7. `[0, n_seats - 1]` - the current player required to take an action.
+ `community_cards` - is a `list` of `int` features describing the cards in the community.
The values are encoded based on the `treys.Card` integer representation. There are 5 `int` in
the list, where `-1` represents that there is no card present.
# Example
```python
import gym
import holdem
def play_out_hand(env, n_seats):
# reset environment, gather relevant observations
(player_states, (community_infos, community_cards)) = env.reset()
(player_infos, player_hands) = zip(*player_states)
# display the table, cards and all
env.render(mode='human')
terminal = False
while not terminal:
# play safe actions, check when noone else has raised, call when raised.
actions = holdem.safe_actions(community_infos, n_seats=n_seats)
(player_states, (community_infos, community_cards)), rews, terminal, info = env.step(actions)
env.render(mode='human')
env = gym.make('TexasHoldem-v1') # holdem.TexasHoldemEnv(2)
# start with 2 players
env.add_player(0, stack=2000) # add a player to seat 0 with 2000 'chips'
env.add_player(1, stack=2000) # add another player to seat 1 with 2000 'chips'
# play out a hand
play_out_hand(env, env.n_seats)
# add one more player
env.add_player(2, stack=2000) # add another player to seat 1 with 2000 'chips'
# play out another hand
play_out_hand(env, env.n_seats)
```

Release historyRelease notifications RSS feed

Download files

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

Files for holdem, version 1.0.0
Filename, sizeFile typePython versionUpload dateHashes
Filename, size holdem-1.0.0-py3.6.egg (32.3 kB) File type Egg Python version 3.6 Upload dateHashes
Close

Hashes for holdem-1.0.0-py3.6.egg

Hashes for holdem-1.0.0-py3.6.egg
AlgorithmHash digest
SHA256f01ff881aa2aae83f3ae55db93aaf77662d3ce278c8299806a6bf8fd8ea0df09
MD5b191798bee5d06ec8ea66a14d0473de7
BLAKE2-256008307fc57676e1e398cf436b3bb0da70509515cde9b334ff5f3868df8844a10
Latest version

Released:

Holdem Calculator library

Project description

The Holdem Calculator library calculates the probability that a certain Texas Hold'em hand will win. This probability is approximated by running a Monte Carlo method or calculated exactly by simulating the set of all possible hands. The Holdem Calculator also shows how likely each set of hole cards is to make a certain poker hand. The default Monte Carlo simulations are generally accurate to the nearest percent. Accuracy can be improved by increasing the number of simulations that are run, but this will result in a longer running time.

Command Line Options

Usage

I've listed a few examples showing how to use the Holdem Calculator. Note that you can mix and match command line options to suit your needs. See the bottom example in this section to see how to use the multiprocess Holdem Calculator for faster computations.

Default use case:

Multiplayer use case:

Exact calculation:

Board supplied:

Input file supplied:

In order to calculate multiple hands in a single run, the user has the choice to allow Holdem Calculator to read from an input file. Each line of the input file should represent a single calculation. Hole cards and boards should be separated using a ' ' divider.

Unknown Hole Cards:

Compute how likely a hand is to win against a random pair of hole cards. You can only specify one set of hole cards as unknown.Note: Performing calculations with unknown hole cards takes an excessively long time if community cards are not specified.

Texas holdem poker books pdf

Multiprocess Holdem Calculator:

Takes the same command line options but utilizes multicore processors to increase the speed of computation.Windows users: Due to the process forking mechanism in Windows, parallel_holdem_calc might be slower than expected.

Texas

Library Calls:

Free Slots Vegas World

If you want to use Holdem Calculator as a library, you can import holdem_calc or parallel_holdem_calc and call calculate(). The order of arguments to calculate() are as follows:

  1. Board: These are the community cards supplied to the calculation. This is in the form of a list of strings, with each string representing a card. If you do not want to specify community cards, you can set board to be None. Example: ['As', 'Ks', 'Jd']
  2. Exact: This is a boolean which is True if you want an exact calculation, and False if you want a Monte Carlo simulation.
  3. Number of Simulations: This is the number of iterations run in the Monte Carlo simulation. Note that this parameter is ignored if Exact is set to True. This number must be positive, even if Exact is set to true.
  4. Input File: The name of the input file you want Holdem Calculator to read from. Mark as None, if you do not wish to read from a file. If Input File is set, library calls will not return anything.
  5. Hole Cards: These are the hole cards for each of the players. This is in the form of a list of strings, with each string representing a card. Example: ['As', 'Ks', 'Jd', 'Td']
  6. Verbose: This is a boolean which is True if you want Holdem Calculator to print the results.

Calls to calculate() return a list of floats. The first element in the list corresponds to the probability that a tie takes place. Each element after that corresponds to the probability one of the hole cards the user provides wins the hand. These probabilities occur in the order in which you list them.

Copyright

Copyright (c) 2013 Kevin Tseng. See LICENSE for details.

Python texas holdem game

Release historyRelease notifications RSS feed

Download files

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

Files for holdem-calc, version 1.0.0
Filename, sizeFile typePython versionUpload dateHashes
Filename, size holdem_calc-1.0.0-py3-none-any.whl (14.4 kB) File type Wheel Python version py3 Upload dateHashes
Filename, size holdem_calc-1.0.0.tar.gz (15.3 kB) File type Source Python version None Upload dateHashes
Close

Texas Hold'em Rules

Hashes for holdem_calc-1.0.0-py3-none-any.whl

Texas Holdem Ai Python

Hashes for holdem_calc-1.0.0-py3-none-any.whl
AlgorithmHash digest
SHA256b153aeaf57db68efb42b801d617823cddd07898af777a497309cc5874df6cfd1
MD5c93a59c622217c026573083492626827
BLAKE2-256ecc5ea3ed2f22ff936a22d9f983ff590e72252e4d505c04fcc7f0358502476e9
Close

Texas Hold'em Python

Hashes for holdem_calc-1.0.0.tar.gz

Hashes for holdem_calc-1.0.0.tar.gz
AlgorithmHash digest
SHA25628a124902c0b247b8651e326df680c488171325b212aeeb8809bed0d30d8f06a
MD546fab1f2d4de43e725a69bb67d2f4500
BLAKE2-2564520eeb82fb1d1470f32d97b386cef005a785c6c168b3057336cb29baf8eb736