move some junk around classifyLines, as it will normally run into the first stuff first, allowing us to shorten the execution for smaller hands
This commit is contained in:
parent
375e0ed7c9
commit
593691301b
|
@ -411,20 +411,14 @@ def classifyLines(hand, category, lineTypes, lineStreets):
|
||||||
lineTypes.append("cards")
|
lineTypes.append("cards")
|
||||||
elif i == 0:
|
elif i == 0:
|
||||||
lineTypes.append("header")
|
lineTypes.append("header")
|
||||||
|
elif line.startswith("Table '"):
|
||||||
|
lineTypes.append("table")
|
||||||
elif line.startswith("Seat ") and ( ("in chips" in line) or "($" in line):
|
elif line.startswith("Seat ") and ( ("in chips" in line) or "($" in line):
|
||||||
lineTypes.append("name")
|
lineTypes.append("name")
|
||||||
elif isActionLine(line):
|
elif isActionLine(line):
|
||||||
lineTypes.append("action")
|
lineTypes.append("action")
|
||||||
if " posts " in line or " posts the " in line:
|
if " posts " in line or " posts the " in line:
|
||||||
currentStreet="preflop"
|
currentStreet="preflop"
|
||||||
elif isWinLine(line):
|
|
||||||
lineTypes.append("win")
|
|
||||||
elif line.startswith("Total pot ") and "Rake" in line:
|
|
||||||
lineTypes.append("rake")
|
|
||||||
done=True
|
|
||||||
elif "*** SHOW DOWN ***" in line or "*** SUMMARY ***" in line:
|
|
||||||
lineTypes.append("ignore")
|
|
||||||
#print "in classifyLine, showdown or summary"
|
|
||||||
elif " antes " in line or " posts the ante " in line:
|
elif " antes " in line or " posts the ante " in line:
|
||||||
lineTypes.append("ante")
|
lineTypes.append("ante")
|
||||||
elif line.startswith("*** FLOP *** ["):
|
elif line.startswith("*** FLOP *** ["):
|
||||||
|
@ -451,10 +445,16 @@ def classifyLines(hand, category, lineTypes, lineStreets):
|
||||||
elif line.startswith("*** 7") or line == "*** RIVER ***":
|
elif line.startswith("*** 7") or line == "*** RIVER ***":
|
||||||
lineTypes.append("ignore")
|
lineTypes.append("ignore")
|
||||||
currentStreet=4
|
currentStreet=4
|
||||||
|
elif isWinLine(line):
|
||||||
|
lineTypes.append("win")
|
||||||
|
elif line.startswith("Total pot ") and "Rake" in line:
|
||||||
|
lineTypes.append("rake")
|
||||||
|
done=True
|
||||||
|
elif "*** SHOW DOWN ***" in line or "*** SUMMARY ***" in line:
|
||||||
|
lineTypes.append("ignore")
|
||||||
|
#print "in classifyLine, showdown or summary"
|
||||||
elif " shows [" in line:
|
elif " shows [" in line:
|
||||||
lineTypes.append("cards")
|
lineTypes.append("cards")
|
||||||
elif line.startswith("Table '"):
|
|
||||||
lineTypes.append("table")
|
|
||||||
else:
|
else:
|
||||||
raise FpdbError("unrecognised linetype in:"+hand[i])
|
raise FpdbError("unrecognised linetype in:"+hand[i])
|
||||||
lineStreets.append(currentStreet)
|
lineStreets.append(currentStreet)
|
||||||
|
@ -512,10 +512,10 @@ def convertCardValues(arr):
|
||||||
map(convertCardValuesBoard, arr)
|
map(convertCardValuesBoard, arr)
|
||||||
#end def convertCardValues
|
#end def convertCardValues
|
||||||
|
|
||||||
|
card_map = { "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8, "9" : 9, "T" : 10, "J" : 11, "Q" : 12, "K" : 13, "A" : 14}
|
||||||
|
|
||||||
#converts the strings in the given array to ints (changes the passed array, no returning). see table design for conversion details
|
#converts the strings in the given array to ints (changes the passed array, no returning). see table design for conversion details
|
||||||
def convertCardValuesBoard(arr):
|
def convertCardValuesBoard(arr):
|
||||||
# TODO: this could probably be useful in many places, it should be a constant somewhere maybe?
|
|
||||||
card_map = { "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8, "9" : 9, "T" : 10, "J" : 11, "Q" : 12, "K" : 13, "A" : 14}
|
|
||||||
for i in xrange(len(arr)):
|
for i in xrange(len(arr)):
|
||||||
arr[i] = card_map[arr[i]]
|
arr[i] = card_map[arr[i]]
|
||||||
#end def convertCardValuesBoard
|
#end def convertCardValuesBoard
|
||||||
|
@ -523,10 +523,8 @@ def convertCardValuesBoard(arr):
|
||||||
#this creates the 2D/3D arrays. manipulates the passed arrays instead of returning.
|
#this creates the 2D/3D arrays. manipulates the passed arrays instead of returning.
|
||||||
def createArrays(category, seats, card_values, card_suits, antes, winnings, rakes, action_types, allIns, action_amounts, actionNos, actionTypeByNo):
|
def createArrays(category, seats, card_values, card_suits, antes, winnings, rakes, action_types, allIns, action_amounts, actionNos, actionTypeByNo):
|
||||||
for i in xrange(seats):#create second dimension arrays
|
for i in xrange(seats):#create second dimension arrays
|
||||||
tmp=[]
|
card_values.append( [] )
|
||||||
card_values.append(tmp)
|
card_suits.append( [] )
|
||||||
tmp=[]
|
|
||||||
card_suits.append(tmp)
|
|
||||||
antes.append(0)
|
antes.append(0)
|
||||||
winnings.append(0)
|
winnings.append(0)
|
||||||
rakes.append(0)
|
rakes.append(0)
|
||||||
|
@ -534,25 +532,16 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
|
||||||
streetCount = 4 if category == "holdem" or category == "omahahi" or category == "omahahilo" else 5
|
streetCount = 4 if category == "holdem" or category == "omahahi" or category == "omahahilo" else 5
|
||||||
|
|
||||||
for i in xrange(streetCount): #build the first dimension array, for streets
|
for i in xrange(streetCount): #build the first dimension array, for streets
|
||||||
tmp=[]
|
action_types.append([])
|
||||||
action_types.append(tmp)
|
allIns.append([])
|
||||||
tmp=[]
|
action_amounts.append([])
|
||||||
allIns.append(tmp)
|
actionNos.append([])
|
||||||
tmp=[]
|
actionTypeByNo.append([])
|
||||||
action_amounts.append(tmp)
|
|
||||||
tmp=[]
|
|
||||||
actionNos.append(tmp)
|
|
||||||
tmp=[]
|
|
||||||
actionTypeByNo.append(tmp)
|
|
||||||
for j in xrange (seats): #second dimension arrays: players
|
for j in xrange (seats): #second dimension arrays: players
|
||||||
tmp=[]
|
action_types[i].append([])
|
||||||
action_types[i].append(tmp)
|
allIns[i].append([])
|
||||||
tmp=[]
|
action_amounts[i].append([])
|
||||||
allIns[i].append(tmp)
|
actionNos[i].append([])
|
||||||
tmp=[]
|
|
||||||
action_amounts[i].append(tmp)
|
|
||||||
tmp=[]
|
|
||||||
actionNos[i].append(tmp)
|
|
||||||
# if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
# if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
||||||
# pass
|
# pass
|
||||||
if category=="razz" or category=="studhi" or category=="studhilo":#need to fill card arrays.
|
if category=="razz" or category=="studhi" or category=="studhilo":#need to fill card arrays.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user