pokdeng is a package for simulating rounds of pokdeng games!
Project description
pokdeng
pokdeng is a Python package for simulating rounds of pokdeng games!
Quick Guide
Create player Kanye where he will
- place bet amount = 2 if his pocket has a minimum balance of 3 after deducting the bet amount
- draw the third card if his two cards on hand are not two deng or score less than 4
from pokdeng.cardholder import Dealer, Player
from pokdeng.hand import Hand
from pokdeng.game import Game
from pokdeng.pocket import Pocket
from decimal import Decimal
class Kanye(Player):
def place_bet(self, round: int, pocket: Pocket) -> Decimal:
bet = Decimal("2")
if pocket.total_amount - bet >= Decimal("3"):
return bet
return None
def draw_card(self, round: int, pocket: Pocket, hand: Hand) -> bool:
return hand.deng() != 2 or hand.score() < 4
kanye = Kanye()
Create player Ben where he will
- place bet amount = 1 if his pocket has a minimum balance of 0 after deducting the bet amount
- draw the third card if his two cards on hand score lesss than 5
ben = Player()
Create dealer Anita where she will
- fight her two cards on hand with three cards on other player's hands if two deng and score more than 4
- draw the third card if her two cards on hand score less than 3
class Anita(Dealer):
def two_fight_three(self, round: int, pocket: Pocket, hand: Hand) -> bool:
return hand.deng() == 2 and hand.score() > 4
def draw_card(self, round: int, pocket: Pocket, hand: Hand) -> bool:
return hand.score() < 3
anita = Anita()
Create dealer Dixon where he will
- fight his two cards on hand with three cards on other player's hands if score more than 5
- draw the third card if his two cards on hand score less than 5
dixon = Dealer()
Create pocket for each dealer/player with some amount where dealer's pocket usually starts with 0 amount while player's pocket starts with positive amount
kanye_pocket = Pocket(kanye.card_holder_id, Decimal(10))
ben_pocket = Pocket(ben.card_holder_id, Decimal(10))
anita_pocket = Pocket(anita.card_holder_id, Decimal(0))
Create a collection of pockets by dealer/player
pockets = {kanye.card_holder_id: kanye_pocket, ben.card_holder_id: ben_pocket, anita.card_holder_id: anita_pocket}
Create a game of 1 dealer, a list of players, and a collection of pockets by dealer/player
game = Game(dealer = anita, players = [kanye, ben], pockets = pockets)
Play the game for 200 rounds
game.play(200)
Check total amount in each pocket afterwards
[(str(card_holder_id.value), pocket.total_amount) for card_holder_id, pocket in pockets.items()]
Pokdeng is a zero sum game, meaning the total amount in each pocket should sum to zero
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pokdeng-0.0.1.tar.gz.
File metadata
- Download URL: pokdeng-0.0.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5f05f21ef72f3b64aa5856d6d39b095532be3a606d75ff1e1ced3e4ef066cc0
|
|
| MD5 |
7068de15ebc46f052d6918bbe9257a03
|
|
| BLAKE2b-256 |
1245c91112cf72f388d5402fe314198778008ae7d9dc451d333fda48e6c176a0
|
File details
Details for the file pokdeng-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pokdeng-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
211eab5687e95a30f2df6182046aa3470944d0e855b2d8932af3ee183d3e730d
|
|
| MD5 |
0cd22d5e5b21f293514d68ba80402e89
|
|
| BLAKE2b-256 |
b253e2908ee5ee4618732caaac681888a4110d6c96deae3f2f1519da7c89b075
|