Make Hand initable without a hhc

Proof of concept code in test_PokerStars.py
This commit is contained in:
Worros 2009-03-14 23:01:40 +09:00
parent d847a71c6e
commit faf19215e8
3 changed files with 75 additions and 56 deletions

View File

@ -399,6 +399,7 @@ class HoldemOmahaHand(Hand):
#Populate a HoldemOmahaHand #Populate a HoldemOmahaHand
#Generally, we call 'read' methods here, which get the info according to the particular filter (hhc) #Generally, we call 'read' methods here, which get the info according to the particular filter (hhc)
# which then invokes a 'addXXX' callback # which then invokes a 'addXXX' callback
if builtFrom == "HHC":
hhc.readHandInfo(self) hhc.readHandInfo(self)
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
@ -418,6 +419,8 @@ class HoldemOmahaHand(Hand):
hhc.readShownCards(self) hhc.readShownCards(self)
self.totalPot() # finalise it (total the pot) self.totalPot() # finalise it (total the pot)
hhc.getRake(self) hhc.getRake(self)
elif builtFrom == "DB":
self.select("dummy") # Will need a handId
def addHoleCards(self, cards, player, shown=False): def addHoleCards(self, cards, player, shown=False):
"""\ """\
@ -553,6 +556,7 @@ class DrawHand(Hand):
self.sb = gametype['sb'] self.sb = gametype['sb']
self.bb = gametype['bb'] self.bb = gametype['bb']
# Populate the draw hand. # Populate the draw hand.
if builtFrom == "HHC":
hhc.readHandInfo(self) hhc.readHandInfo(self)
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
@ -570,7 +574,8 @@ class DrawHand(Hand):
hhc.readShownCards(self) hhc.readShownCards(self)
self.totalPot() # finalise it (total the pot) self.totalPot() # finalise it (total the pot)
hhc.getRake(self) hhc.getRake(self)
elif builtFrom == "DB":
self.select("dummy") # Will need a handId
# Draw games (at least Badugi has blinds - override default Holdem addBlind # Draw games (at least Badugi has blinds - override default Holdem addBlind
def addBlind(self, player, blindtype, amount): def addBlind(self, player, blindtype, amount):
@ -733,6 +738,7 @@ class StudHand(Hand):
#Populate the StudHand #Populate the StudHand
#Generally, we call a 'read' method here, which gets the info according to the particular filter (hhc) #Generally, we call a 'read' method here, which gets the info according to the particular filter (hhc)
# which then invokes a 'addXXX' callback # which then invokes a 'addXXX' callback
if builtFrom == "HHC":
hhc.readHandInfo(self) hhc.readHandInfo(self)
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
@ -751,6 +757,8 @@ class StudHand(Hand):
#hhc.readShownCards(self) # not done yet #hhc.readShownCards(self) # not done yet
self.totalPot() # finalise it (total the pot) self.totalPot() # finalise it (total the pot)
hhc.getRake(self) hhc.getRake(self)
elif builtFrom == "DB":
self.select("dummy") # Will need a handId
def addPlayerCards(self, player, street, open=[], closed=[]): def addPlayerCards(self, player, street, open=[], closed=[]):
"""\ """\

View File

@ -1,10 +1,21 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import PokerStarsToFpdb import PokerStarsToFpdb
from Hand import *
import py import py
#regression-test-files/stars/badugi/ring-fl-badugi.txt #regression-test-files/stars/badugi/ring-fl-badugi.txt
# s0rrow: start $30.00 end: $22.65 total: ($7.35) # s0rrow: start $30.00 end: $22.65 total: ($7.35)
gametype = {'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'}
text = ""
hhc = PokerStarsToFpdb.PokerStars(autostart=False)
h = HoldemOmahaHand(None, "ASite", gametype, text, builtFrom = "Test")
h.addPlayer("1", "s0rrow", "100000")
hhc.compilePlayerRegexs(h)
def checkGameInfo(hhc, header, info): def checkGameInfo(hhc, header, info):
assert hhc.determineGameType(header) == info assert hhc.determineGameType(header) == info