Hand.py: Call Decimal ctor a lot less.
This commit is contained in:
parent
1227c5df74
commit
cdf158cfae
|
@ -504,12 +504,13 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
log.debug("%s %s antes %s" % ('BLINDSANTES', player, ante))
|
log.debug("%s %s antes %s" % ('BLINDSANTES', player, ante))
|
||||||
if player is not None:
|
if player is not None:
|
||||||
ante = ante.replace(u',', u'') #some sites have commas
|
ante = ante.replace(u',', u'') #some sites have commas
|
||||||
self.bets['BLINDSANTES'][player].append(Decimal(ante))
|
ante = Decimal(ante)
|
||||||
self.stacks[player] -= Decimal(ante)
|
self.bets['BLINDSANTES'][player].append(ante)
|
||||||
act = (player, 'ante', Decimal(ante), self.stacks[player]==0)
|
self.stacks[player] -= ante
|
||||||
|
act = (player, 'ante', 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, ante)
|
||||||
self.pot.addCommonMoney(player, Decimal(ante))
|
self.pot.addCommonMoney(player, ante)
|
||||||
#I think the antes should be common money, don't have enough hand history to check
|
#I think the antes should be common money, don't have enough hand history to check
|
||||||
|
|
||||||
def addBlind(self, player, blindtype, amount):
|
def addBlind(self, player, blindtype, amount):
|
||||||
|
@ -523,21 +524,24 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
log.debug("addBlind: %s posts %s, %s" % (player, blindtype, amount))
|
log.debug("addBlind: %s posts %s, %s" % (player, blindtype, amount))
|
||||||
if player is not None:
|
if player is not None:
|
||||||
amount = amount.replace(u',', u'') #some sites have commas
|
amount = amount.replace(u',', u'') #some sites have commas
|
||||||
self.stacks[player] -= Decimal(amount)
|
amount = Decimal(amount)
|
||||||
act = (player, blindtype, Decimal(amount), self.stacks[player]==0)
|
self.stacks[player] -= amount
|
||||||
|
act = (player, blindtype, amount, self.stacks[player]==0)
|
||||||
self.actions['BLINDSANTES'].append(act)
|
self.actions['BLINDSANTES'].append(act)
|
||||||
|
|
||||||
if blindtype == 'both':
|
if blindtype == 'both':
|
||||||
# work with the real amount. limit games are listed as $1, $2, where
|
# work with the real amount. limit games are listed as $1, $2, where
|
||||||
# the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2....
|
# the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2....
|
||||||
amount = self.bb
|
amount = Decimal(self.bb)
|
||||||
self.bets['BLINDSANTES'][player].append(Decimal(self.sb))
|
sb = Decimal(self.sb)
|
||||||
self.pot.addCommonMoney(player, Decimal(self.sb))
|
self.bets['BLINDSANTES'][player].append(sb)
|
||||||
|
self.pot.addCommonMoney(player, sb)
|
||||||
|
|
||||||
if blindtype == 'secondsb':
|
if blindtype == 'secondsb':
|
||||||
amount = Decimal(0)
|
amount = Decimal(0)
|
||||||
self.bets['BLINDSANTES'][player].append(Decimal(self.sb))
|
sb = Decimal(self.sb)
|
||||||
self.pot.addCommonMoney(player, Decimal(self.sb))
|
self.bets['BLINDSANTES'][player].append(sb)
|
||||||
|
self.pot.addCommonMoney(player, sb)
|
||||||
|
|
||||||
street = 'BLAH'
|
street = 'BLAH'
|
||||||
|
|
||||||
|
@ -546,9 +550,9 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
elif self.gametype['base'] == 'draw':
|
elif self.gametype['base'] == 'draw':
|
||||||
street = 'DEAL'
|
street = 'DEAL'
|
||||||
|
|
||||||
self.bets[street][player].append(Decimal(amount))
|
self.bets[street][player].append(amount)
|
||||||
self.pot.addMoney(player, Decimal(amount))
|
self.pot.addMoney(player, amount)
|
||||||
self.lastBet[street] = Decimal(amount)
|
self.lastBet[street] = amount
|
||||||
self.posted = self.posted + [[player,blindtype]]
|
self.posted = self.posted + [[player,blindtype]]
|
||||||
|
|
||||||
|
|
||||||
|
@ -560,13 +564,14 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
# Potentially calculate the amount of the call if not supplied
|
# Potentially calculate the amount of the call if not supplied
|
||||||
# corner cases include if player would be all in
|
# corner cases include if player would be all in
|
||||||
if amount is not None:
|
if amount is not None:
|
||||||
self.bets[street][player].append(Decimal(amount))
|
amount = Decimal(amount)
|
||||||
#self.lastBet[street] = Decimal(amount)
|
self.bets[street][player].append(amount)
|
||||||
self.stacks[player] -= Decimal(amount)
|
#self.lastBet[street] = amount
|
||||||
|
self.stacks[player] -= 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', Decimal(amount), self.stacks[player]==0)
|
act = (player, 'calls', 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, amount)
|
||||||
|
|
||||||
def addRaiseBy(self, street, player, amountBy):
|
def addRaiseBy(self, street, player, amountBy):
|
||||||
"""\
|
"""\
|
||||||
|
@ -639,14 +644,15 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
def addBet(self, street, player, amount):
|
def addBet(self, street, player, amount):
|
||||||
log.debug(_("%s %s bets %s") %(street, player, amount))
|
log.debug(_("%s %s bets %s") %(street, player, amount))
|
||||||
amount = amount.replace(u',', u'') #some sites have commas
|
amount = amount.replace(u',', u'') #some sites have commas
|
||||||
|
amount = Decimal(amount)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.bets[street][player].append(Decimal(amount))
|
self.bets[street][player].append(amount)
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= 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', Decimal(amount), self.stacks[player]==0)
|
act = (player, 'bets', amount, self.stacks[player]==0)
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
self.lastBet[street] = Decimal(amount)
|
self.lastBet[street] = amount
|
||||||
self.pot.addMoney(player, Decimal(amount))
|
self.pot.addMoney(player, amount)
|
||||||
|
|
||||||
|
|
||||||
def addStandsPat(self, street, player):
|
def addStandsPat(self, street, player):
|
||||||
|
@ -1395,12 +1401,13 @@ Add a complete on [street] by [player] to [amountTo]
|
||||||
def addBringIn(self, player, bringin):
|
def addBringIn(self, player, bringin):
|
||||||
if player is not None:
|
if player is not None:
|
||||||
log.debug(_("Bringin: %s, %s") % (player , bringin))
|
log.debug(_("Bringin: %s, %s") % (player , bringin))
|
||||||
self.bets['THIRD'][player].append(Decimal(bringin))
|
bringin = Decimal(bringin)
|
||||||
self.stacks[player] -= Decimal(bringin)
|
self.bets['THIRD'][player].append(bringin)
|
||||||
act = (player, 'bringin', Decimal(bringin), self.stacks[player]==0)
|
self.stacks[player] -= bringin
|
||||||
|
act = (player, 'bringin', bringin, self.stacks[player]==0)
|
||||||
self.actions['THIRD'].append(act)
|
self.actions['THIRD'].append(act)
|
||||||
self.lastBet['THIRD'] = Decimal(bringin)
|
self.lastBet['THIRD'] = bringin
|
||||||
self.pot.addMoney(player, Decimal(bringin))
|
self.pot.addMoney(player, bringin)
|
||||||
|
|
||||||
def getStreetTotals(self):
|
def getStreetTotals(self):
|
||||||
# street1Pot INT, /* pot size at flop/street4 */
|
# street1Pot INT, /* pot size at flop/street4 */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user