ishikota / PyPokerEngine

Poker engine for poker AI development in Python
https://ishikota.github.io/PyPokerEngine/
MIT License
608 stars 184 forks source link

Do not take ate into account when first action #49

Closed ishikota closed 7 years ago

ishikota commented 7 years ago

original issue : https://github.com/ishikota/PyPokerEngine/issues/45

before when p1 declare RAISE 15 then player should pay 15 even if he already paid ante. But p1 only pays 10 (15 - ante)

-- hole card --
 hole card : ['SJ', 'CK']
-- valid actions --
 fold, call:15, raise: [20, 95]
-- round state --
 Dealer Btn : p1 
 Street : preflop
 Community Card : []
 Pot : main = 40, side = []  <= pot should be 45
 Players
 0 : p1 (nrwbogvakciqwrmpowupkk) => state : participating, stack : 85
 1 : p2 (rcvyscrdwwxrkxqpsoaylj) => state : participating, stack : 90 <= SB, CURRENT
 2 : p3 (rxwhwxhnkftxvedsfhuoaj) => state : participating, stack : 85 <= BB
-- action histories --
  preflop
    {'action': 'ANTE', 'player': 'p2 (uuid=rcvyscrdwwxrkxqpsoaylj)', 'amount': 5}
    {'action': 'ANTE', 'player': 'p3 (uuid=rxwhwxhnkftxvedsfhuoaj)', 'amount': 5}
    {'action': 'ANTE', 'player': 'p1 (uuid=nrwbogvakciqwrmpowupkk)', 'amount': 5}
    {'action': 'SMALLBLIND', 'player': 'p2 (uuid=rcvyscrdwwxrkxqpsoaylj)', 'amount': 5, 'add_amount': 5}
    {'action': 'BIGBLIND', 'player': 'p3 (uuid=rxwhwxhnkftxvedsfhuoaj)', 'amount': 10, 'add_amount': 5}
    {'add_amount': 5, 'paid': 10, 'player': 'p1 (uuid=nrwbogvakciqwrmpowupkk)', 'amount': 15, 'action': 'RAISE'}   <= paid should be 15

after

-- hole card --
 hole card : ['C3', 'SA']
-- valid actions --
 fold, call:15, raise: [20, 95]
-- round state --
 Dealer Btn : p1 
 Street : preflop
 Community Card : []
 Pot : main = 45, side = []
 Players
 0 : p1 (wmhucuzwphitsxcctkkazh) => state : participating, stack : 80
 1 : p2 (npckuwxtnckddwrmjihafi) => state : participating, stack : 90 <= SB, CURRENT
 2 : p3 (frhmepctyubktqtudupvar) => state : participating, stack : 85 <= BB
-- action histories --
  preflop
    {'action': 'ANTE', 'player': 'p2 (uuid=npckuwxtnckddwrmjihafi)', 'amount': 5}
    {'action': 'ANTE', 'player': 'p3 (uuid=frhmepctyubktqtudupvar)', 'amount': 5}
    {'action': 'ANTE', 'player': 'p1 (uuid=wmhucuzwphitsxcctkkazh)', 'amount': 5}
    {'action': 'SMALLBLIND', 'player': 'p2 (uuid=npckuwxtnckddwrmjihafi)', 'amount': 5, 'add_amount': 5}
    {'action': 'BIGBLIND', 'player': 'p3 (uuid=frhmepctyubktqtudupvar)', 'amount': 10, 'add_amount': 5}
    {'add_amount': 5, 'paid': 15, 'player': 'p1 (uuid=wmhucuzwphitsxcctkkazh)', 'amount': 15, 'action': 'RAISE'}
==============================================
coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.849% when pulling 7c7647c66461df10dc74c399373e101fdc8aa7bc on bug-fix-ante-to-pot into 8cda02617c5d1c62ba18ae43c98715d6bb1fcfd9 on 0.1.3.