Fix omaha hudCache update

This commit is contained in:
Worros 2009-05-21 22:14:49 +08:00
parent eda23de609
commit 4819fc28e5
2 changed files with 15 additions and 4 deletions

View File

@ -44,6 +44,14 @@ def twoStartCardString(card):
elif x > y: return(s[x] + s[y] + 's') elif x > y: return(s[x] + s[y] + 's')
else: return(s[y] + s[x] + 'o') else: return(s[y] + s[x] + 'o')
def fourStartCards(value1, suit1, value2, suit2, value3, suit3, value4, suit4):
""" Function to convert 4 value,suit pairs into a Omaha style starting hand e.g. AAds
Hand is stored as an int 13 * x + y where (x+2) represents rank of 1st card and
(y+2) represents rank of second card (2=2 .. 14=Ace)
If x > y then pair is suited, if x < y then unsuited"""
# This doesn't actually do anything yet - CG
return(0)
def cardFromValueSuit(value, suit): def cardFromValueSuit(value, suit):
""" 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As """ """ 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As """
if suit == 'h': return(value-1) if suit == 'h': return(value-1)

View File

@ -1551,10 +1551,14 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
result.append( getLastInsertId(backend, conn, cursor) ) result.append( getLastInsertId(backend, conn, cursor) )
elif (category=="omahahi" or category=="omahahilo"): elif (category=="omahahi" or category=="omahahilo"):
for i in xrange(len(player_ids)): for i in xrange(len(player_ids)):
startCards = Card.fourStartCards(card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1], card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3])
card1 = Card.cardFromValueSuit(card_values[i][0], card_suits[i][0])
card2 = Card.cardFromValueSuit(card_values[i][1], card_suits[i][1])
card3 = Card.cardFromValueSuit(card_values[i][2], card_suits[i][2])
card4 = Card.cardFromValueSuit(card_values[i][3], card_suits[i][3])
cursor.execute ("""INSERT INTO HandsPlayers cursor.execute ("""INSERT INTO HandsPlayers
(handId, playerId, startCash, position, tourneyTypeId, (handId, playerId, startCash, position, tourneyTypeId,
card1Value, card1Suit, card2Value, card2Suit, card1, card2, card3, card4, winnings, rake, seatNo, totalProfit,
card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo, totalProfit,
street0VPI, street0Aggr, street0_3BChance, street0_3BDone, street0VPI, street0Aggr, street0_3BChance, street0_3BDone,
street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown, street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown,
street1Aggr, street2Aggr, street3Aggr, street4Aggr, street1Aggr, street2Aggr, street3Aggr, street4Aggr,
@ -1576,8 +1580,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s)""", %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], 1, # tourneytypeid (hands_id, player_ids[i], start_cashes[i], positions[i], 1, # tourneytypeid
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1], card1, card2, card3, card4,
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i], winnings[i], rakes[i], seatNos[i], hudCache['totalProfit'][i],
hudCache['street0VPI'][i], hudCache['street0Aggr'][i], hudCache['street0VPI'][i], hudCache['street0Aggr'][i],
hudCache['street0_3BChance'][i], hudCache['street0_3BDone'][i], hudCache['street0_3BChance'][i], hudCache['street0_3BDone'][i],