* added ACTION dictionary for looking up actionId
* edited addAnte(), addBlind(), addCall(), addBet(), addBlind() (Draw), addDiscard() (Draw), addComplete() (Stud), and addBringIn() (Stud) to standardize element order and datatype * added a field to _addRaise() which allows addComplete() (Stud) to pass the 'compleates' action type
This commit is contained in:
parent
1ae01f1502
commit
94d4bf6ed5
|
@ -49,6 +49,8 @@ class Hand(object):
|
||||||
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
|
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
|
||||||
SYMBOL = {'USD': '$', 'EUR': u'$', 'GBP': '$', 'T$': '', 'play': ''}
|
SYMBOL = {'USD': '$', 'EUR': u'$', 'GBP': '$', 'T$': '', 'play': ''}
|
||||||
MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'}
|
MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'}
|
||||||
|
ACTION = {'ante': 1, 'small blind': 2, 'secondsb': 3, 'big blind': 4, 'both': 5, 'calls': 6, 'raises': 7,
|
||||||
|
'bets': 8, 'stands pat': 9, 'folds': 10, 'checks': 11, 'discards': 12, 'bringin': 13, 'completes': 14}
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"):
|
def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"):
|
||||||
|
@ -350,7 +352,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
ante = re.sub(u',', u'', ante) #some sites have commas
|
ante = re.sub(u',', u'', ante) #some sites have commas
|
||||||
self.bets['BLINDSANTES'][player].append(Decimal(ante))
|
self.bets['BLINDSANTES'][player].append(Decimal(ante))
|
||||||
self.stacks[player] -= Decimal(ante)
|
self.stacks[player] -= Decimal(ante)
|
||||||
act = (player, 'posts', "ante", ante, self.stacks[player]==0)
|
act = (player, 'ante', Decimal(ante), self.stacks[player]==0)
|
||||||
self.actions['BLINDSANTES'].append(act)
|
self.actions['BLINDSANTES'].append(act)
|
||||||
# self.pot.addMoney(player, Decimal(ante))
|
# self.pot.addMoney(player, Decimal(ante))
|
||||||
self.pot.addCommonMoney(player, Decimal(ante))
|
self.pot.addCommonMoney(player, Decimal(ante))
|
||||||
|
@ -369,7 +371,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
if player is not None:
|
if player is not None:
|
||||||
amount = re.sub(u',', u'', amount) #some sites have commas
|
amount = re.sub(u',', u'', amount) #some sites have commas
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
act = (player, 'posts', blindtype, amount, self.stacks[player]==0)
|
act = (player, blindtype, Decimal(amount), self.stacks[player]==0)
|
||||||
self.actions['BLINDSANTES'].append(act)
|
self.actions['BLINDSANTES'].append(act)
|
||||||
|
|
||||||
if blindtype == 'both':
|
if blindtype == 'both':
|
||||||
|
@ -402,7 +404,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
#self.lastBet[street] = Decimal(amount)
|
#self.lastBet[street] = Decimal(amount)
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
#print "DEBUG %s calls %s, stack %s" % (player, amount, self.stacks[player])
|
#print "DEBUG %s calls %s, stack %s" % (player, amount, self.stacks[player])
|
||||||
act = (player, 'calls', amount, self.stacks[player]==0)
|
act = (player, 'calls', Decimal(amount), self.stacks[player]==0)
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
self.pot.addMoney(player, Decimal(amount))
|
self.pot.addMoney(player, Decimal(amount))
|
||||||
|
|
||||||
|
@ -463,7 +465,7 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
Rb = Rt - C - Bc
|
Rb = Rt - C - Bc
|
||||||
self._addRaise(street, player, C, Rb, Rt)
|
self._addRaise(street, player, C, Rb, Rt)
|
||||||
|
|
||||||
def _addRaise(self, street, player, C, Rb, Rt):
|
def _addRaise(self, street, player, C, Rb, Rt, action = 'raises'):
|
||||||
log.debug(_("%s %s raise %s") %(street, player, Rt))
|
log.debug(_("%s %s raise %s") %(street, player, Rt))
|
||||||
self.bets[street][player].append(C + Rb)
|
self.bets[street][player].append(C + Rb)
|
||||||
self.stacks[player] -= (C + Rb)
|
self.stacks[player] -= (C + Rb)
|
||||||
|
@ -481,7 +483,7 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
self.bets[street][player].append(Decimal(amount))
|
self.bets[street][player].append(Decimal(amount))
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
#print "DEBUG %s bets %s, stack %s" % (player, amount, self.stacks[player])
|
#print "DEBUG %s bets %s, stack %s" % (player, amount, self.stacks[player])
|
||||||
act = (player, 'bets', amount, self.stacks[player]==0)
|
act = (player, 'bets', Decimal(amount), self.stacks[player]==0)
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
self.lastBet[street] = Decimal(amount)
|
self.lastBet[street] = Decimal(amount)
|
||||||
self.pot.addMoney(player, Decimal(amount))
|
self.pot.addMoney(player, Decimal(amount))
|
||||||
|
@ -1020,7 +1022,7 @@ class DrawHand(Hand):
|
||||||
self.bets['DEAL'][player].append(Decimal(amount))
|
self.bets['DEAL'][player].append(Decimal(amount))
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
#print "DEBUG %s posts, stack %s" % (player, self.stacks[player])
|
#print "DEBUG %s posts, stack %s" % (player, self.stacks[player])
|
||||||
act = (player, 'posts', blindtype, amount, self.stacks[player]==0)
|
act = (player, blindtype, Decimal(amount), self.stacks[player]==0)
|
||||||
self.actions['BLINDSANTES'].append(act)
|
self.actions['BLINDSANTES'].append(act)
|
||||||
self.pot.addMoney(player, Decimal(amount))
|
self.pot.addMoney(player, Decimal(amount))
|
||||||
if blindtype == 'big blind':
|
if blindtype == 'big blind':
|
||||||
|
@ -1050,10 +1052,10 @@ class DrawHand(Hand):
|
||||||
def addDiscard(self, street, player, num, cards):
|
def addDiscard(self, street, player, num, cards):
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
if cards:
|
if cards:
|
||||||
act = (player, 'discards', num, cards)
|
act = (player, 'discards', Decimal(num), cards)
|
||||||
self.discardDrawHoleCards(cards, player, street)
|
self.discardDrawHoleCards(cards, player, street)
|
||||||
else:
|
else:
|
||||||
act = (player, 'discards', num)
|
act = (player, 'discards', Decimal(num))
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
|
|
||||||
def holecardsAsSet(self, street, player):
|
def holecardsAsSet(self, street, player):
|
||||||
|
@ -1246,7 +1248,7 @@ Add a complete on [street] by [player] to [amountTo]
|
||||||
Rt = Decimal(amountTo)
|
Rt = Decimal(amountTo)
|
||||||
C = Bp - Bc
|
C = Bp - Bc
|
||||||
Rb = Rt - C
|
Rb = Rt - C
|
||||||
self._addRaise(street, player, C, Rb, Rt)
|
self._addRaise(street, player, C, Rb, Rt, 'completes')
|
||||||
#~ self.bets[street][player].append(C + Rb)
|
#~ self.bets[street][player].append(C + Rb)
|
||||||
#~ self.stacks[player] -= (C + Rb)
|
#~ self.stacks[player] -= (C + Rb)
|
||||||
#~ act = (player, 'raises', Rb, Rt, C, self.stacks[player]==0)
|
#~ act = (player, 'raises', Rb, Rt, C, self.stacks[player]==0)
|
||||||
|
@ -1259,7 +1261,7 @@ Add a complete on [street] by [player] to [amountTo]
|
||||||
log.debug(_("Bringin: %s, %s") % (player , bringin))
|
log.debug(_("Bringin: %s, %s") % (player , bringin))
|
||||||
self.bets['THIRD'][player].append(Decimal(bringin))
|
self.bets['THIRD'][player].append(Decimal(bringin))
|
||||||
self.stacks[player] -= Decimal(bringin)
|
self.stacks[player] -= Decimal(bringin)
|
||||||
act = (player, 'bringin', bringin, self.stacks[player]==0)
|
act = (player, 'bringin', Decimal(bringin), self.stacks[player]==0)
|
||||||
self.actions['THIRD'].append(act)
|
self.actions['THIRD'].append(act)
|
||||||
self.lastBet['THIRD'] = Decimal(bringin)
|
self.lastBet['THIRD'] = Decimal(bringin)
|
||||||
self.pot.addMoney(player, Decimal(bringin))
|
self.pot.addMoney(player, Decimal(bringin))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user