Merge branch 'master' of git://git.assembla.com/fpdb-eric
Conflicts: pyfpdb/Configuration.py pyfpdb/Database.py
This commit is contained in:
commit
6bf7be6ae5
52
pyfpdb/Configuration.py
Executable file → Normal file
52
pyfpdb/Configuration.py
Executable file → Normal file
|
@ -43,7 +43,6 @@ class Layout:
|
||||||
self.location = []
|
self.location = []
|
||||||
self.location = map(lambda x: None, range(self.max+1)) # there must be a better way to do this?
|
self.location = map(lambda x: None, range(self.max+1)) # there must be a better way to do this?
|
||||||
|
|
||||||
|
|
||||||
for location_node in node.getElementsByTagName('location'):
|
for location_node in node.getElementsByTagName('location'):
|
||||||
if location_node.getAttribute('seat') != "":
|
if location_node.getAttribute('seat') != "":
|
||||||
self.location[int( location_node.getAttribute('seat') )] = (int( location_node.getAttribute('x') ), int( location_node.getAttribute('y')))
|
self.location[int( location_node.getAttribute('seat') )] = (int( location_node.getAttribute('x') ), int( location_node.getAttribute('y')))
|
||||||
|
@ -57,7 +56,7 @@ class Layout:
|
||||||
if hasattr(self, "common"):
|
if hasattr(self, "common"):
|
||||||
temp = temp + " Common = (%d, %d)\n" % (self.common[0], self.common[1])
|
temp = temp + " Common = (%d, %d)\n" % (self.common[0], self.common[1])
|
||||||
temp = temp + " Locations = "
|
temp = temp + " Locations = "
|
||||||
for i in xrange(1, len(self.location)):
|
for i in range(1, len(self.location)):
|
||||||
temp = temp + "(%d,%d)" % self.location[i]
|
temp = temp + "(%d,%d)" % self.location[i]
|
||||||
|
|
||||||
return temp + "\n"
|
return temp + "\n"
|
||||||
|
@ -86,17 +85,16 @@ class Site:
|
||||||
self.layout[lo.max] = lo
|
self.layout[lo.max] = lo
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
temp = "Site = %s\n" % self.site_name
|
temp = "Site = " + self.site_name + "\n"
|
||||||
for key in dir(self):
|
for key in dir(self):
|
||||||
if key.startswith('__'): continue
|
if key.startswith('__'): continue
|
||||||
if key == 'layout': continue
|
if key == 'layout': continue
|
||||||
value = getattr(self, key)
|
value = getattr(self, key)
|
||||||
if callable(value): continue
|
if callable(value): continue
|
||||||
temp = "%s %s = %s\n" % (temp, key, str(value))
|
|
||||||
temp = temp + ' ' + key + " = " + str(value) + "\n"
|
temp = temp + ' ' + key + " = " + str(value) + "\n"
|
||||||
|
|
||||||
for layout in self.layout:
|
for layout in self.layout:
|
||||||
temp = "%s%s" % (temp, self.layout[layout])
|
temp = temp + "%s" % self.layout[layout]
|
||||||
|
|
||||||
return temp
|
return temp
|
||||||
|
|
||||||
|
@ -137,10 +135,14 @@ class Game:
|
||||||
self.stats[stat.stat_name] = stat
|
self.stats[stat.stat_name] = stat
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
temp = "Game = %s\n db = %s\n rows = %d\n cols = %d\n aux = %s\n" % (self.game_name, self.db, self.rows, self.cols, self.aux)
|
temp = "Game = " + self.game_name + "\n"
|
||||||
|
temp = temp + " db = %s\n" % self.db
|
||||||
|
temp = temp + " rows = %d\n" % self.rows
|
||||||
|
temp = temp + " cols = %d\n" % self.cols
|
||||||
|
temp = temp + " aux = %s\n" % self.aux
|
||||||
|
|
||||||
for stat in self.stats.keys():
|
for stat in self.stats.keys():
|
||||||
temp = "%s%s" % (temp, self.stats[stat])
|
temp = temp + "%s" % self.stats[stat]
|
||||||
|
|
||||||
return temp
|
return temp
|
||||||
|
|
||||||
|
@ -409,7 +411,7 @@ class Config:
|
||||||
site_node = self.get_site_node(site_name)
|
site_node = self.get_site_node(site_name)
|
||||||
layout_node = self.get_layout_node(site_node, max)
|
layout_node = self.get_layout_node(site_node, max)
|
||||||
if layout_node == None: return
|
if layout_node == None: return
|
||||||
for i in xrange(1, max + 1):
|
for i in range(1, max + 1):
|
||||||
location_node = self.get_location_node(layout_node, i)
|
location_node = self.get_location_node(layout_node, i)
|
||||||
location_node.setAttribute("x", str( locations[i-1][0] ))
|
location_node.setAttribute("x", str( locations[i-1][0] ))
|
||||||
location_node.setAttribute("y", str( locations[i-1][1] ))
|
location_node.setAttribute("y", str( locations[i-1][1] ))
|
||||||
|
@ -499,17 +501,35 @@ class Config:
|
||||||
|
|
||||||
def get_default_colors(self, site = "PokerStars"):
|
def get_default_colors(self, site = "PokerStars"):
|
||||||
colors = {}
|
colors = {}
|
||||||
colors['hudopacity'] = float(self.supported_sites[site].hudopacity) if self.supported_sites[site].hudopacity != "" else 0.90
|
if self.supported_sites[site].hudopacity == "":
|
||||||
colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor if self.supported_sites[site].hudbgcolor != "" else "#FFFFFF"
|
colors['hudopacity'] = 0.90
|
||||||
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor if self.supported_sites[site].hudfgcolor != "" else "#000000"
|
else:
|
||||||
|
colors['hudopacity'] = float(self.supported_sites[site].hudopacity)
|
||||||
|
if self.supported_sites[site].hudbgcolor == "":
|
||||||
|
colors['hudbgcolor'] = "#FFFFFF"
|
||||||
|
else:
|
||||||
|
colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor
|
||||||
|
if self.supported_sites[site].hudfgcolor == "":
|
||||||
|
colors['hudfgcolor'] = "#000000"
|
||||||
|
else:
|
||||||
|
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
def get_default_font(self, site = 'PokerStars'):
|
def get_default_font(self, site = 'PokerStars'):
|
||||||
font = self.supported_sites[site].font if self.supported_sites[site].font != "" else "Sans"
|
(font, font_size) = ("Sans", "8")
|
||||||
font_size = self.supported_sites[site].font_size if self.supported_sites[site].font != "" else "8"
|
if self.supported_sites[site].font == "":
|
||||||
|
font = "Sans"
|
||||||
|
else:
|
||||||
|
font = self.supported_sites[site].font
|
||||||
|
|
||||||
|
if self.supported_sites[site].font_size == "":
|
||||||
|
font_size = "8"
|
||||||
|
else:
|
||||||
|
font_size = self.supported_sites[site].font_size
|
||||||
return (font, font_size)
|
return (font, font_size)
|
||||||
|
|
||||||
def get_locations(self, site = "PokerStars", max = "8"):
|
def get_locations(self, site = "PokerStars", max = "8"):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
locations = self.supported_sites[site].layout[max].location
|
locations = self.supported_sites[site].layout[max].location
|
||||||
except:
|
except:
|
||||||
|
@ -586,7 +606,7 @@ class Config:
|
||||||
def get_aux_parameters(self, name):
|
def get_aux_parameters(self, name):
|
||||||
"""Gets a dict of mucked window parameters from the named mw."""
|
"""Gets a dict of mucked window parameters from the named mw."""
|
||||||
param = {}
|
param = {}
|
||||||
if name in self.aux_windows:
|
if self.aux_windows.has_key(name):
|
||||||
for key in dir(self.aux_windows[name]):
|
for key in dir(self.aux_windows[name]):
|
||||||
if key.startswith('__'): continue
|
if key.startswith('__'): continue
|
||||||
value = getattr(self.aux_windows[name], key)
|
value = getattr(self.aux_windows[name], key)
|
||||||
|
@ -599,7 +619,7 @@ class Config:
|
||||||
def get_game_parameters(self, name):
|
def get_game_parameters(self, name):
|
||||||
"""Get the configuration parameters for the named game."""
|
"""Get the configuration parameters for the named game."""
|
||||||
param = {}
|
param = {}
|
||||||
if name in self.supported_games:
|
if self.supported_games.has_key(name):
|
||||||
param['game_name'] = self.supported_games[name].game_name
|
param['game_name'] = self.supported_games[name].game_name
|
||||||
param['db'] = self.supported_games[name].db
|
param['db'] = self.supported_games[name].db
|
||||||
param['rows'] = self.supported_games[name].rows
|
param['rows'] = self.supported_games[name].rows
|
||||||
|
@ -610,7 +630,7 @@ class Config:
|
||||||
def get_supported_games(self):
|
def get_supported_games(self):
|
||||||
"""Get the list of supported games."""
|
"""Get the list of supported games."""
|
||||||
sg = []
|
sg = []
|
||||||
for game in c.supported_games:
|
for game in c.supported_games.keys():
|
||||||
sg.append(c.supported_games[game].game_name)
|
sg.append(c.supported_games[game].game_name)
|
||||||
return sg
|
return sg
|
||||||
|
|
||||||
|
|
20
pyfpdb/Database.py
Executable file → Normal file
20
pyfpdb/Database.py
Executable file → Normal file
|
@ -146,14 +146,22 @@ class Database:
|
||||||
ranks = ('', '', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
|
ranks = ('', '', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
|
||||||
cards = ""
|
cards = ""
|
||||||
for i in xrange(1, 8):
|
for i in xrange(1, 8):
|
||||||
key = 'card' + str(i) + 'Value'
|
# key = 'card' + str(i) + 'Value'
|
||||||
if not d.has_key(key): continue
|
# if not d.has_key(key): continue
|
||||||
if d[key] == None:
|
# if d[key] == None:
|
||||||
|
# break
|
||||||
|
# elif d[key] == 0:
|
||||||
|
# cards += "xx"
|
||||||
|
# else:
|
||||||
|
# cards += ranks[d['card' + str(i) + 'Value']] + d['card' +str(i) + 'Suit']
|
||||||
|
cv = "card%dValue" % i
|
||||||
|
if cv not in d or d[cv] == None:
|
||||||
break
|
break
|
||||||
elif d[key] == 0:
|
elif d[cv] == 0:
|
||||||
cards += "xx"
|
cards = "%sxx" % cards
|
||||||
else:
|
else:
|
||||||
cards += ranks[d['card' + str(i) + 'Value']] + d['card' +str(i) + 'Suit']
|
cs = "card%dSuit" % i
|
||||||
|
cards = "%s%s%s" % (cards, ranks[d[cv]], d[cs])
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
def get_action_from_hand(self, hand_no):
|
def get_action_from_hand(self, hand_no):
|
||||||
|
|
|
@ -152,9 +152,9 @@ class HUD_main(object):
|
||||||
(table_name, max, poker_game) = self.db_connection.get_table_name(new_hand_id)
|
(table_name, max, poker_game) = self.db_connection.get_table_name(new_hand_id)
|
||||||
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id)
|
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id)
|
||||||
cards = self.db_connection.get_cards(new_hand_id)
|
cards = self.db_connection.get_cards(new_hand_id)
|
||||||
except:
|
except Exception, err:
|
||||||
print "skipping ", new_hand_id
|
print "db error: skipping ", new_hand_id, err
|
||||||
sys.stderr.write("Database error in hand %d. Skipping.\n" % int(new_hand_id))
|
sys.stderr.write("Database error %s in hand %d. Skipping.\n" % (err, int(new_hand_id)))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# find out if this hand is from a tournament
|
# find out if this hand is from a tournament
|
||||||
|
|
|
@ -326,7 +326,10 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
"Everleaf" : { "0.10" : ("0.02", "0.05"),
|
"Everleaf" : { "0.10" : ("0.02", "0.05"),
|
||||||
"0.20" : ("0.05", "0.10"),
|
"0.20" : ("0.05", "0.10"),
|
||||||
"0.50" : ("0.10", "0.25"),
|
"0.50" : ("0.10", "0.25"),
|
||||||
"1.00" : ("0.25", "0.50")
|
"1" : ("0.25", "0.50"),
|
||||||
|
"2" : ("0.50", "1.00"),
|
||||||
|
"4" : ("1.00", "2.00"),
|
||||||
|
"6" : ("1.00", "3.00")
|
||||||
},
|
},
|
||||||
"FullTilt" : { "0.10" : ("0.02", "0.05"),
|
"FullTilt" : { "0.10" : ("0.02", "0.05"),
|
||||||
"0.20" : ("0.05", "0.10"),
|
"0.20" : ("0.05", "0.10"),
|
||||||
|
|
|
@ -156,6 +156,8 @@ class Hud:
|
||||||
self.main_window.gdkhandle = gtk.gdk.window_foreign_new(self.main_window.window.xid) # gets a gdk handle for the hud table window
|
self.main_window.gdkhandle = gtk.gdk.window_foreign_new(self.main_window.window.xid) # gets a gdk handle for the hud table window
|
||||||
self.main_window.gdkhandle.set_transient_for(self.main_window.parentgdkhandle) #
|
self.main_window.gdkhandle.set_transient_for(self.main_window.parentgdkhandle) #
|
||||||
|
|
||||||
|
self.update_table_position()
|
||||||
|
|
||||||
def update_table_position(self):
|
def update_table_position(self):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
if not win32gui.IsWindow(self.table.number):
|
if not win32gui.IsWindow(self.table.number):
|
||||||
|
@ -197,6 +199,7 @@ class Hud:
|
||||||
self.aux_windows = []
|
self.aux_windows = []
|
||||||
|
|
||||||
def reposition_windows(self, *args):
|
def reposition_windows(self, *args):
|
||||||
|
if self.stat_windows and len(self.stat_windows > 0):
|
||||||
map(lambda x: x.window.move(x.x, x.y), self.stat_windows)
|
map(lambda x: x.window.move(x.x, x.y), self.stat_windows)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -248,6 +251,7 @@ class Hud:
|
||||||
#
|
#
|
||||||
# this method also manages the creating and destruction of stat
|
# this method also manages the creating and destruction of stat
|
||||||
# windows via calls to the Stat_Window class
|
# windows via calls to the Stat_Window class
|
||||||
|
self.hand = hand
|
||||||
if not self.mw_created:
|
if not self.mw_created:
|
||||||
self.create_mw()
|
self.create_mw()
|
||||||
|
|
||||||
|
|
|
@ -374,14 +374,14 @@ def getLastInsertId(backend, conn, cursor):
|
||||||
#returns an array of the total money paid. intending to add rebuys/addons here
|
#returns an array of the total money paid. intending to add rebuys/addons here
|
||||||
def calcPayin(count, buyin, fee):
|
def calcPayin(count, buyin, fee):
|
||||||
result=[]
|
result=[]
|
||||||
for i in range(count):
|
for i in xrange(count):
|
||||||
result.append (buyin+fee)
|
result.append (buyin+fee)
|
||||||
return result
|
return result
|
||||||
#end def calcPayin
|
#end def calcPayin
|
||||||
|
|
||||||
def checkPositions(positions):
|
def checkPositions(positions):
|
||||||
"""verifies that these positions are valid"""
|
"""verifies that these positions are valid"""
|
||||||
for i in range (len(positions)):
|
for i in xrange(len(positions)):
|
||||||
pos=positions[i]
|
pos=positions[i]
|
||||||
try:#todo: use type recognition instead of error
|
try:#todo: use type recognition instead of error
|
||||||
if (len(pos)!=1):
|
if (len(pos)!=1):
|
||||||
|
@ -460,10 +460,10 @@ def classifyLines(hand, category, lineTypes, lineStreets):
|
||||||
|
|
||||||
def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
|
def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
|
||||||
"""calculates the actual bet amounts in the given amount array and changes it accordingly."""
|
"""calculates the actual bet amounts in the given amount array and changes it accordingly."""
|
||||||
for i in range (len(actionTypes)):
|
for i in xrange(len(actionTypes)):
|
||||||
for j in range (len(actionTypes[i])):
|
for j in xrange(len(actionTypes[i])):
|
||||||
bets=[]
|
bets=[]
|
||||||
for k in range (len(actionTypes[i][j])):
|
for k in xrange(len(actionTypes[i][j])):
|
||||||
if (actionTypes[i][j][k]=="bet"):
|
if (actionTypes[i][j][k]=="bet"):
|
||||||
bets.append((i,j,k))
|
bets.append((i,j,k))
|
||||||
if (len(bets)==2):
|
if (len(bets)==2):
|
||||||
|
@ -489,10 +489,10 @@ def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
|
||||||
#Corrects the bet amount if the player had to pay blinds
|
#Corrects the bet amount if the player had to pay blinds
|
||||||
def convertBlindBet(actionTypes, actionAmounts):
|
def convertBlindBet(actionTypes, actionAmounts):
|
||||||
i=0#setting street to pre-flop
|
i=0#setting street to pre-flop
|
||||||
for j in range (len(actionTypes[i])):#playerloop
|
for j in xrange(len(actionTypes[i])):#playerloop
|
||||||
blinds=[]
|
blinds=[]
|
||||||
bets=[]
|
bets=[]
|
||||||
for k in range (len(actionTypes[i][j])):
|
for k in xrange(len(actionTypes[i][j])):
|
||||||
if (actionTypes[i][j][k]=="blind"):
|
if (actionTypes[i][j][k]=="blind"):
|
||||||
blinds.append((i,j,k))
|
blinds.append((i,j,k))
|
||||||
|
|
||||||
|
@ -507,25 +507,12 @@ def convertBlindBet(actionTypes, actionAmounts):
|
||||||
#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
|
||||||
#todo: make this use convertCardValuesBoard
|
#todo: make this use convertCardValuesBoard
|
||||||
def convertCardValues(arr):
|
def convertCardValues(arr):
|
||||||
for i in range (len(arr)):
|
map(convertCardValuesBoard, arr)
|
||||||
for j in range (len(arr[i])):
|
|
||||||
if (arr[i][j]=="A"):
|
|
||||||
arr[i][j]=14
|
|
||||||
elif (arr[i][j]=="K"):
|
|
||||||
arr[i][j]=13
|
|
||||||
elif (arr[i][j]=="Q"):
|
|
||||||
arr[i][j]=12
|
|
||||||
elif (arr[i][j]=="J"):
|
|
||||||
arr[i][j]=11
|
|
||||||
elif (arr[i][j]=="T"):
|
|
||||||
arr[i][j]=10
|
|
||||||
else:
|
|
||||||
arr[i][j]=int(arr[i][j])
|
|
||||||
#end def convertCardValues
|
#end def convertCardValues
|
||||||
|
|
||||||
#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):
|
||||||
for i in range (len(arr)):
|
for i in xrange(len(arr)):
|
||||||
if (arr[i]=="A"):
|
if (arr[i]=="A"):
|
||||||
arr[i]=14
|
arr[i]=14
|
||||||
elif (arr[i]=="K"):
|
elif (arr[i]=="K"):
|
||||||
|
@ -542,7 +529,7 @@ 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 range(seats):#create second dimension arrays
|
for i in xrange(seats):#create second dimension arrays
|
||||||
tmp=[]
|
tmp=[]
|
||||||
card_values.append(tmp)
|
card_values.append(tmp)
|
||||||
tmp=[]
|
tmp=[]
|
||||||
|
@ -556,7 +543,7 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
|
||||||
else:
|
else:
|
||||||
streetCount=5
|
streetCount=5
|
||||||
|
|
||||||
for i in range(streetCount): #build the first dimension array, for streets
|
for i in xrange(streetCount): #build the first dimension array, for streets
|
||||||
tmp=[]
|
tmp=[]
|
||||||
action_types.append(tmp)
|
action_types.append(tmp)
|
||||||
tmp=[]
|
tmp=[]
|
||||||
|
@ -567,7 +554,7 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
|
||||||
actionNos.append(tmp)
|
actionNos.append(tmp)
|
||||||
tmp=[]
|
tmp=[]
|
||||||
actionTypeByNo.append(tmp)
|
actionTypeByNo.append(tmp)
|
||||||
for j in range (seats): #second dimension arrays: players
|
for j in xrange (seats): #second dimension arrays: players
|
||||||
tmp=[]
|
tmp=[]
|
||||||
action_types[i].append(tmp)
|
action_types[i].append(tmp)
|
||||||
tmp=[]
|
tmp=[]
|
||||||
|
@ -579,8 +566,8 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
|
||||||
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
||||||
pass
|
pass
|
||||||
elif (category=="razz" or category=="studhi" or category=="studhilo"):#need to fill card arrays.
|
elif (category=="razz" or category=="studhi" or category=="studhilo"):#need to fill card arrays.
|
||||||
for i in range(seats):
|
for i in xrange(seats):
|
||||||
for j in range (7):
|
for j in xrange (7):
|
||||||
card_values[i].append(0)
|
card_values[i].append(0)
|
||||||
card_suits[i].append("x")
|
card_suits[i].append("x")
|
||||||
else:
|
else:
|
||||||
|
@ -605,7 +592,7 @@ def fillCardArrays(player_count, base, category, card_values, card_suits):
|
||||||
else:
|
else:
|
||||||
raise fpdb_simple.FpdbError ("invalid category:", category)
|
raise fpdb_simple.FpdbError ("invalid category:", category)
|
||||||
|
|
||||||
for i in range (player_count):
|
for i in xrange (player_count):
|
||||||
while (len(card_values[i])<cardCount):
|
while (len(card_values[i])<cardCount):
|
||||||
card_values[i].append(0)
|
card_values[i].append(0)
|
||||||
card_suits[i].append("x")
|
card_suits[i].append("x")
|
||||||
|
@ -618,16 +605,16 @@ def filterAnteBlindFold(site,hand):
|
||||||
#todo: in tourneys this should not be removed but
|
#todo: in tourneys this should not be removed but
|
||||||
#print "start of filterAnteBlindFold"
|
#print "start of filterAnteBlindFold"
|
||||||
pre3rd=[]
|
pre3rd=[]
|
||||||
for i in range (len(hand)):
|
for i in xrange (len(hand)):
|
||||||
if (hand[i].startswith("*** 3") or hand[i].startswith("*** HOLE")):
|
if (hand[i].startswith("*** 3") or hand[i].startswith("*** HOLE")):
|
||||||
pre3rd=hand[0:i]
|
pre3rd=hand[0:i]
|
||||||
|
|
||||||
foldeeName=None
|
foldeeName=None
|
||||||
for i in range (len(pre3rd)):
|
for i in xrange (len(pre3rd)):
|
||||||
if (pre3rd[i].endswith("folds") or pre3rd[i].endswith("is sitting out") or pre3rd[i].endswith(" stands up")): #found ante fold or timeout
|
if (pre3rd[i].endswith("folds") or pre3rd[i].endswith("is sitting out") or pre3rd[i].endswith(" stands up")): #found ante fold or timeout
|
||||||
pos=pre3rd[i].find (" folds")
|
pos=pre3rd[i].find (" folds")
|
||||||
foldeeName=pre3rd[i][0:pos]
|
foldeeName=pre3rd[i][0:pos]
|
||||||
if pos==-1 and pre3rd[i].find(" in chips)")==-1:
|
if pos == -1 and " in chips)" not in pre3rd[i]:
|
||||||
pos=pre3rd[i].find (" is sitting out")
|
pos=pre3rd[i].find (" is sitting out")
|
||||||
foldeeName=pre3rd[i][0:pos]
|
foldeeName=pre3rd[i][0:pos]
|
||||||
if pos==-1:
|
if pos==-1:
|
||||||
|
@ -641,19 +628,19 @@ def filterAnteBlindFold(site,hand):
|
||||||
if foldeeName!=None:
|
if foldeeName!=None:
|
||||||
#print "filterAnteBlindFold, foldeeName:",foldeeName
|
#print "filterAnteBlindFold, foldeeName:",foldeeName
|
||||||
toRemove=[]
|
toRemove=[]
|
||||||
for i in range (len(hand)): #using hand again to filter from all streets, just in case.
|
for i in xrange(len(hand)): #using hand again to filter from all streets, just in case.
|
||||||
#todo: this will break it if sittin out BB wins a hand
|
#todo: this will break it if sittin out BB wins a hand
|
||||||
if (hand[i].find(foldeeName)!=-1):
|
if (hand[i].find(foldeeName)!=-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
|
|
||||||
for i in range (len(toRemove)):
|
for i in xrange(len(toRemove)):
|
||||||
hand.remove(toRemove[i])
|
hand.remove(toRemove[i])
|
||||||
#end def filterAnteFold
|
#end def filterAnteFold
|
||||||
|
|
||||||
#removes useless lines as well as trailing spaces
|
#removes useless lines as well as trailing spaces
|
||||||
def filterCrap(site, hand, isTourney):
|
def filterCrap(site, hand, isTourney):
|
||||||
#remove two trailing spaces at end of line
|
#remove two trailing spaces at end of line
|
||||||
for i in range (len(hand)):
|
for i in xrange (len(hand)):
|
||||||
if (hand[i][-1]==' '):
|
if (hand[i][-1]==' '):
|
||||||
hand[i]=hand[i][:-1]
|
hand[i]=hand[i][:-1]
|
||||||
if (hand[i][-1]==' '):
|
if (hand[i][-1]==' '):
|
||||||
|
@ -662,7 +649,7 @@ def filterCrap(site, hand, isTourney):
|
||||||
#print "hand after trailing space removal in filterCrap:",hand
|
#print "hand after trailing space removal in filterCrap:",hand
|
||||||
#general variable position word filter/string filter
|
#general variable position word filter/string filter
|
||||||
toRemove=[]
|
toRemove=[]
|
||||||
for i in range (len(hand)):
|
for i in xrange (len(hand)):
|
||||||
if (hand[i].startswith("Board [")):
|
if (hand[i].startswith("Board [")):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].find(" out of hand ")!=-1):
|
elif (hand[i].find(" out of hand ")!=-1):
|
||||||
|
@ -759,7 +746,7 @@ def filterCrap(site, hand, isTourney):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
|
|
||||||
|
|
||||||
for i in range (len(toRemove)):
|
for i in xrange (len(toRemove)):
|
||||||
#print "removing in filterCr:",toRemove[i]
|
#print "removing in filterCr:",toRemove[i]
|
||||||
hand.remove(toRemove[i])
|
hand.remove(toRemove[i])
|
||||||
|
|
||||||
|
@ -949,8 +936,8 @@ def parseActionLine(site, base, isTourney, line, street, playerIDs, names, actio
|
||||||
street=3
|
street=3
|
||||||
|
|
||||||
nextActionNo=0
|
nextActionNo=0
|
||||||
for player in range(len(actionNos[street])):
|
for player in xrange(len(actionNos[street])):
|
||||||
for count in range(len(actionNos[street][player])):
|
for count in xrange(len(actionNos[street][player])):
|
||||||
if actionNos[street][player][count]>=nextActionNo:
|
if actionNos[street][player][count]>=nextActionNo:
|
||||||
nextActionNo=actionNos[street][player][count]+1
|
nextActionNo=actionNos[street][player][count]+1
|
||||||
|
|
||||||
|
@ -1019,7 +1006,7 @@ def parseActionType(line):
|
||||||
|
|
||||||
#parses the ante out of the given line and checks which player paid it, updates antes accordingly.
|
#parses the ante out of the given line and checks which player paid it, updates antes accordingly.
|
||||||
def parseAnteLine(line, site, isTourney, names, antes):
|
def parseAnteLine(line, site, isTourney, names, antes):
|
||||||
for i in range(len(names)):
|
for i in xrange(len(names)):
|
||||||
if (line.startswith(names[i].encode("latin-1"))): #found the ante'er
|
if (line.startswith(names[i].encode("latin-1"))): #found the ante'er
|
||||||
pos=line.rfind("$")+1
|
pos=line.rfind("$")+1
|
||||||
if not isTourney:
|
if not isTourney:
|
||||||
|
@ -1122,7 +1109,7 @@ def parseCashesAndSeatNos(lines, site):
|
||||||
"""parses the startCashes and seatNos of each player out of the given lines and returns them as a dictionary of two arrays"""
|
"""parses the startCashes and seatNos of each player out of the given lines and returns them as a dictionary of two arrays"""
|
||||||
cashes = []
|
cashes = []
|
||||||
seatNos = []
|
seatNos = []
|
||||||
for i in range (len(lines)):
|
for i in xrange (len(lines)):
|
||||||
pos2=lines[i].find(":")
|
pos2=lines[i].find(":")
|
||||||
seatNos.append(int(lines[i][5:pos2]))
|
seatNos.append(int(lines[i][5:pos2]))
|
||||||
|
|
||||||
|
@ -1200,7 +1187,7 @@ def parseHandStartTime(topline, site):
|
||||||
#parses the names out of the given lines and returns them as an array
|
#parses the names out of the given lines and returns them as an array
|
||||||
def parseNames(lines):
|
def parseNames(lines):
|
||||||
result = []
|
result = []
|
||||||
for i in range (len(lines)):
|
for i in xrange (len(lines)):
|
||||||
pos1=lines[i].find(":")+2
|
pos1=lines[i].find(":")+2
|
||||||
pos2=lines[i].rfind("(")-1
|
pos2=lines[i].rfind("(")-1
|
||||||
tmp=lines[i][pos1:pos2]
|
tmp=lines[i][pos1:pos2]
|
||||||
|
@ -1215,12 +1202,12 @@ def parseNames(lines):
|
||||||
def parsePositions (hand, names):
|
def parsePositions (hand, names):
|
||||||
#prep array
|
#prep array
|
||||||
positions=[]
|
positions=[]
|
||||||
for i in range(len(names)):
|
for i in xrange(len(names)):
|
||||||
positions.append(-1)
|
positions.append(-1)
|
||||||
|
|
||||||
#find blinds
|
#find blinds
|
||||||
sb,bb=-1,-1
|
sb,bb=-1,-1
|
||||||
for i in range (len(hand)):
|
for i in xrange (len(hand)):
|
||||||
if (sb==-1 and hand[i].find("small blind")!=-1 and hand[i].find("dead small blind")==-1):
|
if (sb==-1 and hand[i].find("small blind")!=-1 and hand[i].find("dead small blind")==-1):
|
||||||
sb=hand[i]
|
sb=hand[i]
|
||||||
#print "sb:",sb
|
#print "sb:",sb
|
||||||
|
@ -1283,7 +1270,7 @@ def parsePositions (hand, names):
|
||||||
arraypos-=1
|
arraypos-=1
|
||||||
distFromBtn+=1
|
distFromBtn+=1
|
||||||
|
|
||||||
for i in range (len(names)):
|
for i in xrange (len(names)):
|
||||||
if positions[i]==-1:
|
if positions[i]==-1:
|
||||||
print "parsePositions names:",names
|
print "parsePositions names:",names
|
||||||
print "result:",positions
|
print "result:",positions
|
||||||
|
@ -1355,7 +1342,7 @@ def parseTourneyNo(topline):
|
||||||
#parses a win/collect line. manipulates the passed array winnings, no explicit return
|
#parses a win/collect line. manipulates the passed array winnings, no explicit return
|
||||||
def parseWinLine(line, site, names, winnings, isTourney):
|
def parseWinLine(line, site, names, winnings, isTourney):
|
||||||
#print "parseWinLine: line:",line
|
#print "parseWinLine: line:",line
|
||||||
for i in range(len(names)):
|
for i in xrange(len(names)):
|
||||||
if (line.startswith(names[i].encode("latin-1"))): #found a winner
|
if (line.startswith(names[i].encode("latin-1"))): #found a winner
|
||||||
if isTourney:
|
if isTourney:
|
||||||
pos1=line.rfind("collected ")+10
|
pos1=line.rfind("collected ")+10
|
||||||
|
@ -1515,7 +1502,7 @@ def recogniseTourneyTypeId(cursor, siteId, buyin, fee, knockout, rebuyOrAddon):
|
||||||
#returns the SQL ids of the names given in an array
|
#returns the SQL ids of the names given in an array
|
||||||
def recognisePlayerIDs(cursor, names, site_id):
|
def recognisePlayerIDs(cursor, names, site_id):
|
||||||
result = []
|
result = []
|
||||||
for i in range (len(names)):
|
for i in xrange(len(names)):
|
||||||
cursor.execute ("SELECT id FROM Players WHERE name=%s", (names[i],))
|
cursor.execute ("SELECT id FROM Players WHERE name=%s", (names[i],))
|
||||||
tmp=cursor.fetchall()
|
tmp=cursor.fetchall()
|
||||||
if (len(tmp)==0): #new player
|
if (len(tmp)==0): #new player
|
||||||
|
@ -1531,7 +1518,7 @@ def recognisePlayerIDs(cursor, names, site_id):
|
||||||
#recognises the name in the given line and returns its array position in the given array
|
#recognises the name in the given line and returns its array position in the given array
|
||||||
def recognisePlayerNo(line, names, atype):
|
def recognisePlayerNo(line, names, atype):
|
||||||
#print "recogniseplayerno, names:",names
|
#print "recogniseplayerno, names:",names
|
||||||
for i in range (len(names)):
|
for i in xrange(len(names)):
|
||||||
if (atype=="unbet"):
|
if (atype=="unbet"):
|
||||||
if (line.endswith(names[i].encode("latin-1"))):
|
if (line.endswith(names[i].encode("latin-1"))):
|
||||||
return (i)
|
return (i)
|
||||||
|
@ -1581,7 +1568,7 @@ def recogniseSiteID(cursor, site):
|
||||||
|
|
||||||
#removes trailing \n from the given array
|
#removes trailing \n from the given array
|
||||||
def removeTrailingEOL(arr):
|
def removeTrailingEOL(arr):
|
||||||
for i in range(len(arr)):
|
for i in xrange(len(arr)):
|
||||||
if (arr[i].endswith("\n")):
|
if (arr[i].endswith("\n")):
|
||||||
#print "arr[i] before removetrailingEOL:", arr[i]
|
#print "arr[i] before removetrailingEOL:", arr[i]
|
||||||
arr[i]=arr[i][:-1]
|
arr[i]=arr[i][:-1]
|
||||||
|
@ -1593,7 +1580,7 @@ def removeTrailingEOL(arr):
|
||||||
def splitRake(winnings, rakes, totalRake):
|
def splitRake(winnings, rakes, totalRake):
|
||||||
winnercnt=0
|
winnercnt=0
|
||||||
totalWin=0
|
totalWin=0
|
||||||
for i in range(len(winnings)):
|
for i in xrange(len(winnings)):
|
||||||
if winnings[i]!=0:
|
if winnings[i]!=0:
|
||||||
winnercnt+=1
|
winnercnt+=1
|
||||||
totalWin+=winnings[i]
|
totalWin+=winnings[i]
|
||||||
|
@ -1602,7 +1589,7 @@ def splitRake(winnings, rakes, totalRake):
|
||||||
rakes[firstWinner]=totalRake
|
rakes[firstWinner]=totalRake
|
||||||
else:
|
else:
|
||||||
totalWin=float(totalWin)
|
totalWin=float(totalWin)
|
||||||
for i in range(len(winnings)):
|
for i in xrange(len(winnings)):
|
||||||
if winnings[i]!=0:
|
if winnings[i]!=0:
|
||||||
winPortion=winnings[i]/totalWin
|
winPortion=winnings[i]/totalWin
|
||||||
rakes[i]=totalRake*winPortion
|
rakes[i]=totalRake*winPortion
|
||||||
|
@ -1612,9 +1599,9 @@ def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, ac
|
||||||
#stores into table hands_actions
|
#stores into table hands_actions
|
||||||
#print "start of storeActions, actionNos:",actionNos
|
#print "start of storeActions, actionNos:",actionNos
|
||||||
#print " action_amounts:",action_amounts
|
#print " action_amounts:",action_amounts
|
||||||
for i in range (len(actionTypes)): #iterate through streets
|
for i in xrange(len(actionTypes)): #iterate through streets
|
||||||
for j in range (len(actionTypes[i])): #iterate through names
|
for j in xrange(len(actionTypes[i])): #iterate through names
|
||||||
for k in range (len(actionTypes[i][j])): #iterate through individual actions of that player on that street
|
for k in xrange(len(actionTypes[i][j])): #iterate through individual actions of that player on that street
|
||||||
cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)"
|
cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)"
|
||||||
, (handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k]))
|
, (handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k]))
|
||||||
#end def storeActions
|
#end def storeActions
|
||||||
|
@ -1644,7 +1631,7 @@ def store_hands_players_holdem_omaha(backend, conn, cursor, category, hands_id,
|
||||||
,positions, card_values, card_suits, winnings, rakes, seatNos):
|
,positions, card_values, card_suits, winnings, rakes, seatNos):
|
||||||
result=[]
|
result=[]
|
||||||
if (category=="holdem"):
|
if (category=="holdem"):
|
||||||
for i in range (len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
cursor.execute ("""
|
cursor.execute ("""
|
||||||
INSERT INTO HandsPlayers
|
INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, position,
|
(handId, playerId, startCash, position,
|
||||||
|
@ -1657,7 +1644,7 @@ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
|
||||||
#result.append(cursor.fetchall()[0][0])
|
#result.append(cursor.fetchall()[0][0])
|
||||||
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
|
result.append( getLastInsertId(backend, conn, cursor) ) # mysql only
|
||||||
elif (category=="omahahi" or category=="omahahilo"):
|
elif (category=="omahahi" or category=="omahahilo"):
|
||||||
for i in range (len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
cursor.execute ("""INSERT INTO HandsPlayers
|
cursor.execute ("""INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, position,
|
(handId, playerId, startCash, position,
|
||||||
card1Value, card1Suit, card2Value, card2Suit,
|
card1Value, card1Suit, card2Value, card2Suit,
|
||||||
|
@ -1680,7 +1667,7 @@ def store_hands_players_stud(backend, conn, cursor, hands_id, player_ids, start_
|
||||||
#stores hands_players rows for stud/razz games. returns an array of the resulting IDs
|
#stores hands_players rows for stud/razz games. returns an array of the resulting IDs
|
||||||
result=[]
|
result=[]
|
||||||
#print "before inserts in store_hands_players_stud, antes:", antes
|
#print "before inserts in store_hands_players_stud, antes:", antes
|
||||||
for i in range (len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
cursor.execute ("""INSERT INTO HandsPlayers
|
cursor.execute ("""INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, ante,
|
(handId, playerId, startCash, ante,
|
||||||
card1Value, card1Suit, card2Value, card2Suit,
|
card1Value, card1Suit, card2Value, card2Suit,
|
||||||
|
@ -1705,7 +1692,7 @@ def store_hands_players_holdem_omaha_tourney(backend, conn, cursor, category, ha
|
||||||
, winnings, rakes, seatNos, tourneys_players_ids):
|
, winnings, rakes, seatNos, tourneys_players_ids):
|
||||||
#stores hands_players for tourney holdem/omaha hands
|
#stores hands_players for tourney holdem/omaha hands
|
||||||
result=[]
|
result=[]
|
||||||
for i in range (len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
if len(card_values[0])==2:
|
if len(card_values[0])==2:
|
||||||
cursor.execute ("""INSERT INTO HandsPlayers
|
cursor.execute ("""INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, position,
|
(handId, playerId, startCash, position,
|
||||||
|
@ -1739,7 +1726,7 @@ def store_hands_players_stud_tourney(backend, conn, cursor, hands_id, player_ids
|
||||||
antes, card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids):
|
antes, card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids):
|
||||||
#stores hands_players for tourney stud/razz hands
|
#stores hands_players for tourney stud/razz hands
|
||||||
result=[]
|
result=[]
|
||||||
for i in range (len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
cursor.execute ("""INSERT INTO HandsPlayers
|
cursor.execute ("""INSERT INTO HandsPlayers
|
||||||
(handId, playerId, startCash, ante,
|
(handId, playerId, startCash, ante,
|
||||||
card1Value, card1Suit, card2Value, card2Suit,
|
card1Value, card1Suit, card2Value, card2Suit,
|
||||||
|
@ -1799,16 +1786,16 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
firstPfRaiserNo=-1
|
firstPfRaiserNo=-1
|
||||||
firstPfCallByNo=-1
|
firstPfCallByNo=-1
|
||||||
firstPfCallerId=-1
|
firstPfCallerId=-1
|
||||||
for i in range(len(actionTypeByNo[0])):
|
for i in xrange(len(actionTypeByNo[0])):
|
||||||
if actionTypeByNo[0][i][1]=="bet":
|
if actionTypeByNo[0][i][1]=="bet":
|
||||||
firstPfRaiseByNo=i
|
firstPfRaiseByNo=i
|
||||||
firstPfRaiserId=actionTypeByNo[0][i][0]
|
firstPfRaiserId=actionTypeByNo[0][i][0]
|
||||||
for j in range(len(player_ids)):
|
for j in xrange(len(player_ids)):
|
||||||
if player_ids[j]==firstPfRaiserId:
|
if player_ids[j]==firstPfRaiserId:
|
||||||
firstPfRaiserNo=j
|
firstPfRaiserNo=j
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
for i in range(len(actionTypeByNo[0])):
|
for i in xrange(len(actionTypeByNo[0])):
|
||||||
if actionTypeByNo[0][i][1]=="call":
|
if actionTypeByNo[0][i][1]=="call":
|
||||||
firstPfCallByNo=i
|
firstPfCallByNo=i
|
||||||
firstPfCallerId=actionTypeByNo[0][i][0]
|
firstPfCallerId=actionTypeByNo[0][i][0]
|
||||||
|
@ -1819,7 +1806,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
sbId=-1
|
sbId=-1
|
||||||
bbId=-1
|
bbId=-1
|
||||||
if base=="hold":
|
if base=="hold":
|
||||||
for player in range(len(positions)):
|
for player in xrange(len(positions)):
|
||||||
if positions==1:
|
if positions==1:
|
||||||
cutoffId=player_ids[player]
|
cutoffId=player_ids[player]
|
||||||
if positions==0:
|
if positions==0:
|
||||||
|
@ -1832,7 +1819,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
someoneStole=False
|
someoneStole=False
|
||||||
|
|
||||||
#run a loop for each player preparing the actual values that will be commited to SQL
|
#run a loop for each player preparing the actual values that will be commited to SQL
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
#set default values
|
#set default values
|
||||||
myStreet0VPI=False
|
myStreet0VPI=False
|
||||||
myStreet0Aggr=False
|
myStreet0Aggr=False
|
||||||
|
@ -1863,7 +1850,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
#calculate VPIP and PFR
|
#calculate VPIP and PFR
|
||||||
street=0
|
street=0
|
||||||
heroPfRaiseCount=0
|
heroPfRaiseCount=0
|
||||||
for count in range (len(action_types[street][player])):#finally individual actions
|
for count in xrange(len(action_types[street][player])):#finally individual actions
|
||||||
currentAction=action_types[street][player][count]
|
currentAction=action_types[street][player][count]
|
||||||
if currentAction=="bet":
|
if currentAction=="bet":
|
||||||
myStreet0Aggr=True
|
myStreet0Aggr=True
|
||||||
|
@ -1874,7 +1861,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
pfFold=-1
|
pfFold=-1
|
||||||
pfRaise=-1
|
pfRaise=-1
|
||||||
if firstPfRaiseByNo!=-1:
|
if firstPfRaiseByNo!=-1:
|
||||||
for i in range(len(actionTypeByNo[0])):
|
for i in xrange(len(actionTypeByNo[0])):
|
||||||
if actionTypeByNo[0][i][0]==player_ids[player]:
|
if actionTypeByNo[0][i][0]==player_ids[player]:
|
||||||
if actionTypeByNo[0][i][1]=="bet" and pfRaise==-1 and i>firstPfRaiseByNo:
|
if actionTypeByNo[0][i][1]=="bet" and pfRaise==-1 and i>firstPfRaiseByNo:
|
||||||
pfRaise=i
|
pfRaise=i
|
||||||
|
@ -1915,19 +1902,19 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
|
|
||||||
#calculate saw* values
|
#calculate saw* values
|
||||||
isAllIn=False
|
isAllIn=False
|
||||||
for i in range(len(allIns[0][player])):
|
for i in xrange(len(allIns[0][player])):
|
||||||
if allIns[0][player][i]:
|
if allIns[0][player][i]:
|
||||||
isAllIn=True
|
isAllIn=True
|
||||||
if (len(action_types[1][player])>0 or isAllIn):
|
if (len(action_types[1][player])>0 or isAllIn):
|
||||||
myStreet1Seen=True
|
myStreet1Seen=True
|
||||||
|
|
||||||
for i in range(len(allIns[1][player])):
|
for i in xrange(len(allIns[1][player])):
|
||||||
if allIns[1][player][i]:
|
if allIns[1][player][i]:
|
||||||
isAllIn=True
|
isAllIn=True
|
||||||
if (len(action_types[2][player])>0 or isAllIn):
|
if (len(action_types[2][player])>0 or isAllIn):
|
||||||
myStreet2Seen=True
|
myStreet2Seen=True
|
||||||
|
|
||||||
for i in range(len(allIns[2][player])):
|
for i in xrange(len(allIns[2][player])):
|
||||||
if allIns[2][player][i]:
|
if allIns[2][player][i]:
|
||||||
isAllIn=True
|
isAllIn=True
|
||||||
if (len(action_types[3][player])>0 or isAllIn):
|
if (len(action_types[3][player])>0 or isAllIn):
|
||||||
|
@ -1936,12 +1923,12 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
#print "base:", base
|
#print "base:", base
|
||||||
if base=="hold":
|
if base=="hold":
|
||||||
mySawShowdown=True
|
mySawShowdown=True
|
||||||
for count in range (len(action_types[3][player])):
|
for count in xrange(len(action_types[3][player])):
|
||||||
if action_types[3][player][count]=="fold":
|
if action_types[3][player][count]=="fold":
|
||||||
mySawShowdown=False
|
mySawShowdown=False
|
||||||
else:
|
else:
|
||||||
#print "in else"
|
#print "in else"
|
||||||
for i in range(len(allIns[3][player])):
|
for i in xrange(len(allIns[3][player])):
|
||||||
if allIns[3][player][i]:
|
if allIns[3][player][i]:
|
||||||
isAllIn=True
|
isAllIn=True
|
||||||
if (len(action_types[4][player])>0 or isAllIn):
|
if (len(action_types[4][player])>0 or isAllIn):
|
||||||
|
@ -1949,7 +1936,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
myStreet4Seen=True
|
myStreet4Seen=True
|
||||||
|
|
||||||
mySawShowdown=True
|
mySawShowdown=True
|
||||||
for count in range (len(action_types[4][player])):
|
for count in xrange(len(action_types[4][player])):
|
||||||
if action_types[4][player][count]=="fold":
|
if action_types[4][player][count]=="fold":
|
||||||
mySawShowdown=False
|
mySawShowdown=False
|
||||||
|
|
||||||
|
@ -1957,72 +1944,72 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
#flop stuff
|
#flop stuff
|
||||||
street=1
|
street=1
|
||||||
if myStreet1Seen:
|
if myStreet1Seen:
|
||||||
for count in range(len(action_types[street][player])):
|
for count in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][count]=="bet":
|
if action_types[street][player][count]=="bet":
|
||||||
myStreet1Aggr=True
|
myStreet1Aggr=True
|
||||||
|
|
||||||
for otherPlayer in range (len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for countOther in range (len(action_types[street][otherPlayer])):
|
for countOther in xrange(len(action_types[street][otherPlayer])):
|
||||||
if action_types[street][otherPlayer][countOther]=="bet":
|
if action_types[street][otherPlayer][countOther]=="bet":
|
||||||
myOtherRaisedStreet1=True
|
myOtherRaisedStreet1=True
|
||||||
for countOtherFold in range (len(action_types[street][player])):
|
for countOtherFold in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][countOtherFold]=="fold":
|
if action_types[street][player][countOtherFold]=="fold":
|
||||||
myFoldToOtherRaisedStreet1=True
|
myFoldToOtherRaisedStreet1=True
|
||||||
|
|
||||||
#turn stuff - copy of flop with different vars
|
#turn stuff - copy of flop with different vars
|
||||||
street=2
|
street=2
|
||||||
if myStreet2Seen:
|
if myStreet2Seen:
|
||||||
for count in range(len(action_types[street][player])):
|
for count in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][count]=="bet":
|
if action_types[street][player][count]=="bet":
|
||||||
myStreet2Aggr=True
|
myStreet2Aggr=True
|
||||||
|
|
||||||
for otherPlayer in range (len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for countOther in range (len(action_types[street][otherPlayer])):
|
for countOther in xrange(len(action_types[street][otherPlayer])):
|
||||||
if action_types[street][otherPlayer][countOther]=="bet":
|
if action_types[street][otherPlayer][countOther]=="bet":
|
||||||
myOtherRaisedStreet2=True
|
myOtherRaisedStreet2=True
|
||||||
for countOtherFold in range (len(action_types[street][player])):
|
for countOtherFold in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][countOtherFold]=="fold":
|
if action_types[street][player][countOtherFold]=="fold":
|
||||||
myFoldToOtherRaisedStreet2=True
|
myFoldToOtherRaisedStreet2=True
|
||||||
|
|
||||||
#river stuff - copy of flop with different vars
|
#river stuff - copy of flop with different vars
|
||||||
street=3
|
street=3
|
||||||
if myStreet3Seen:
|
if myStreet3Seen:
|
||||||
for count in range(len(action_types[street][player])):
|
for count in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][count]=="bet":
|
if action_types[street][player][count]=="bet":
|
||||||
myStreet3Aggr=True
|
myStreet3Aggr=True
|
||||||
|
|
||||||
for otherPlayer in range (len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for countOther in range (len(action_types[street][otherPlayer])):
|
for countOther in xrange(len(action_types[street][otherPlayer])):
|
||||||
if action_types[street][otherPlayer][countOther]=="bet":
|
if action_types[street][otherPlayer][countOther]=="bet":
|
||||||
myOtherRaisedStreet3=True
|
myOtherRaisedStreet3=True
|
||||||
for countOtherFold in range (len(action_types[street][player])):
|
for countOtherFold in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][countOtherFold]=="fold":
|
if action_types[street][player][countOtherFold]=="fold":
|
||||||
myFoldToOtherRaisedStreet3=True
|
myFoldToOtherRaisedStreet3=True
|
||||||
|
|
||||||
#stud river stuff - copy of flop with different vars
|
#stud river stuff - copy of flop with different vars
|
||||||
street=4
|
street=4
|
||||||
if myStreet4Seen:
|
if myStreet4Seen:
|
||||||
for count in range(len(action_types[street][player])):
|
for count in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][count]=="bet":
|
if action_types[street][player][count]=="bet":
|
||||||
myStreet4Aggr=True
|
myStreet4Aggr=True
|
||||||
|
|
||||||
for otherPlayer in range (len(player_ids)):
|
for otherPlayer in xrange(len(player_ids)):
|
||||||
if player==otherPlayer:
|
if player==otherPlayer:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for countOther in range (len(action_types[street][otherPlayer])):
|
for countOther in xrange(len(action_types[street][otherPlayer])):
|
||||||
if action_types[street][otherPlayer][countOther]=="bet":
|
if action_types[street][otherPlayer][countOther]=="bet":
|
||||||
myOtherRaisedStreet4=True
|
myOtherRaisedStreet4=True
|
||||||
for countOtherFold in range (len(action_types[street][player])):
|
for countOtherFold in xrange(len(action_types[street][player])):
|
||||||
if action_types[street][player][countOtherFold]=="fold":
|
if action_types[street][player][countOtherFold]=="fold":
|
||||||
myFoldToOtherRaisedStreet4=True
|
myFoldToOtherRaisedStreet4=True
|
||||||
|
|
||||||
|
@ -2114,7 +2101,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
foldedBbToSteal=[]
|
foldedBbToSteal=[]
|
||||||
foldSbToStealChance=[]
|
foldSbToStealChance=[]
|
||||||
foldedSbToSteal=[]
|
foldedSbToSteal=[]
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
myFoldBbToStealChance=False
|
myFoldBbToStealChance=False
|
||||||
myFoldedBbToSteal=False
|
myFoldedBbToSteal=False
|
||||||
myFoldSbToStealChance=False
|
myFoldSbToStealChance=False
|
||||||
|
@ -2123,7 +2110,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
if base=="hold":
|
if base=="hold":
|
||||||
if someoneStole and (positions[player]=='B' or positions[player]=='S') and firstPfRaiserId!=player_ids[player]:
|
if someoneStole and (positions[player]=='B' or positions[player]=='S') and firstPfRaiserId!=player_ids[player]:
|
||||||
street=0
|
street=0
|
||||||
for count in range (len(action_types[street][player])):#individual actions
|
for count in xrange(len(action_types[street][player])):#individual actions
|
||||||
if positions[player]=='B':
|
if positions[player]=='B':
|
||||||
myFoldBbToStealChance=True
|
myFoldBbToStealChance=True
|
||||||
if action_types[street][player][count]=="fold":
|
if action_types[street][player][count]=="fold":
|
||||||
|
@ -2147,7 +2134,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
street1CBChance=[]
|
street1CBChance=[]
|
||||||
street1CBDone=[]
|
street1CBDone=[]
|
||||||
didStreet1CB=[]
|
didStreet1CB=[]
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
myStreet1CBChance=False
|
myStreet1CBChance=False
|
||||||
myStreet1CBDone=False
|
myStreet1CBDone=False
|
||||||
|
|
||||||
|
@ -2166,7 +2153,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
street2CBChance=[]
|
street2CBChance=[]
|
||||||
street2CBDone=[]
|
street2CBDone=[]
|
||||||
didStreet2CB=[]
|
didStreet2CB=[]
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
myStreet2CBChance=False
|
myStreet2CBChance=False
|
||||||
myStreet2CBDone=False
|
myStreet2CBDone=False
|
||||||
|
|
||||||
|
@ -2185,7 +2172,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
street3CBChance=[]
|
street3CBChance=[]
|
||||||
street3CBDone=[]
|
street3CBDone=[]
|
||||||
didStreet3CB=[]
|
didStreet3CB=[]
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
myStreet3CBChance=False
|
myStreet3CBChance=False
|
||||||
myStreet3CBDone=False
|
myStreet3CBDone=False
|
||||||
|
|
||||||
|
@ -2204,7 +2191,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
street4CBChance=[]
|
street4CBChance=[]
|
||||||
street4CBDone=[]
|
street4CBDone=[]
|
||||||
didStreet4CB=[]
|
didStreet4CB=[]
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
myStreet4CBChance=False
|
myStreet4CBChance=False
|
||||||
myStreet4CBDone=False
|
myStreet4CBDone=False
|
||||||
|
|
||||||
|
@ -2231,7 +2218,7 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
foldToStreet4CBChance=[]
|
foldToStreet4CBChance=[]
|
||||||
foldToStreet4CBDone=[]
|
foldToStreet4CBDone=[]
|
||||||
|
|
||||||
for player in range (len(player_ids)):
|
for player in xrange(len(player_ids)):
|
||||||
myFoldToStreet1CBChance=False
|
myFoldToStreet1CBChance=False
|
||||||
myFoldToStreet1CBDone=False
|
myFoldToStreet1CBDone=False
|
||||||
foldToStreet1CBChance.append(myFoldToStreet1CBChance)
|
foldToStreet1CBChance.append(myFoldToStreet1CBChance)
|
||||||
|
@ -2285,14 +2272,14 @@ sure to also change the following storage method and table_viewer.prepare_data i
|
||||||
street4CheckCallRaiseChance=[]
|
street4CheckCallRaiseChance=[]
|
||||||
street4CheckCallRaiseDone=[]
|
street4CheckCallRaiseDone=[]
|
||||||
#print "b4 totprof calc, len(playerIds)=", len(player_ids)
|
#print "b4 totprof calc, len(playerIds)=", len(player_ids)
|
||||||
for pl in range (len(player_ids)):
|
for pl in xrange(len(player_ids)):
|
||||||
#print "pl=", pl
|
#print "pl=", pl
|
||||||
myTotalProfit=winnings[pl] # still need to deduct other costs
|
myTotalProfit=winnings[pl] # still need to deduct other costs
|
||||||
if antes:
|
if antes:
|
||||||
myTotalProfit=winnings[pl] - antes[pl]
|
myTotalProfit=winnings[pl] - antes[pl]
|
||||||
for i in range (len(actionTypes)): #iterate through streets
|
for i in xrange(len(actionTypes)): #iterate through streets
|
||||||
#for j in range (len(actionTypes[i])): #iterate through names (using pl loop above)
|
#for j in xrange(len(actionTypes[i])): #iterate through names (using pl loop above)
|
||||||
for k in range (len(actionTypes[i][pl])): #iterate through individual actions of that player on that street
|
for k in xrange(len(actionTypes[i][pl])): #iterate through individual actions of that player on that street
|
||||||
myTotalProfit -= actionAmounts[i][pl][k]
|
myTotalProfit -= actionAmounts[i][pl][k]
|
||||||
|
|
||||||
myStreet1CheckCallRaiseChance=False
|
myStreet1CheckCallRaiseChance=False
|
||||||
|
@ -2336,7 +2323,7 @@ def generateFoldToCB(street, playerIDs, didStreetCB, streetCBDone, foldToStreetC
|
||||||
#print "beginning of generateFoldToCB, street:", street, "len(actionTypeByNo):", len(actionTypeByNo)
|
#print "beginning of generateFoldToCB, street:", street, "len(actionTypeByNo):", len(actionTypeByNo)
|
||||||
#print "len(actionTypeByNo[street]):",len(actionTypeByNo[street])
|
#print "len(actionTypeByNo[street]):",len(actionTypeByNo[street])
|
||||||
firstCBReaction=0
|
firstCBReaction=0
|
||||||
for action in range(len(actionTypeByNo[street])):
|
for action in xrange(len(actionTypeByNo[street])):
|
||||||
if actionTypeByNo[street][action][1]=="bet":
|
if actionTypeByNo[street][action][1]=="bet":
|
||||||
for player in didStreetCB:
|
for player in didStreetCB:
|
||||||
if player==actionTypeByNo[street][action][0] and firstCBReaction==0:
|
if player==actionTypeByNo[street][action][0] and firstCBReaction==0:
|
||||||
|
@ -2344,7 +2331,7 @@ def generateFoldToCB(street, playerIDs, didStreetCB, streetCBDone, foldToStreetC
|
||||||
break
|
break
|
||||||
|
|
||||||
for action in actionTypeByNo[street][firstCBReaction:]:
|
for action in actionTypeByNo[street][firstCBReaction:]:
|
||||||
for player in range(len(playerIDs)):
|
for player in xrange(len(playerIDs)):
|
||||||
if playerIDs[player]==action[0]:
|
if playerIDs[player]==action[0]:
|
||||||
foldToStreetCBChance[player]=True
|
foldToStreetCBChance[player]=True
|
||||||
if action[1]=="fold":
|
if action[1]=="fold":
|
||||||
|
@ -2356,7 +2343,7 @@ def storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData):
|
||||||
|
|
||||||
#print "storeHudCache, len(playerIds)=", len(playerIds), " len(vpip)=" \
|
#print "storeHudCache, len(playerIds)=", len(playerIds), " len(vpip)=" \
|
||||||
#, len(hudImportData['street0VPI']), " len(totprof)=", len(hudImportData['totalProfit'])
|
#, len(hudImportData['street0VPI']), " len(totprof)=", len(hudImportData['totalProfit'])
|
||||||
for player in range (len(playerIds)):
|
for player in xrange(len(playerIds)):
|
||||||
if base=="hold":
|
if base=="hold":
|
||||||
cursor.execute("SELECT * FROM HudCache WHERE gametypeId+0=%s AND playerId=%s AND activeSeats=%s AND position=%s", (gametypeId, playerIds[player], len(playerIds), hudImportData['position'][player]))
|
cursor.execute("SELECT * FROM HudCache WHERE gametypeId+0=%s AND playerId=%s AND activeSeats=%s AND position=%s", (gametypeId, playerIds[player], len(playerIds), hudImportData['position'][player]))
|
||||||
else:
|
else:
|
||||||
|
@ -2376,13 +2363,13 @@ def storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData):
|
||||||
row.append(gametypeId)
|
row.append(gametypeId)
|
||||||
row.append(playerIds[player])
|
row.append(playerIds[player])
|
||||||
row.append(len(playerIds))#seats
|
row.append(len(playerIds))#seats
|
||||||
for i in range(len(hudImportData)+2):
|
for i in xrange(len(hudImportData)+2):
|
||||||
row.append(0)
|
row.append(0)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
doInsert=False
|
doInsert=False
|
||||||
newrow=[]
|
newrow=[]
|
||||||
for i in range(len(row)):
|
for i in xrange(len(row)):
|
||||||
newrow.append(row[i])
|
newrow.append(row[i])
|
||||||
row=newrow
|
row=newrow
|
||||||
|
|
||||||
|
@ -2514,7 +2501,7 @@ def storeHudCache2(backend, cursor, base, category, gametypeId, playerIds, hudIm
|
||||||
|
|
||||||
#print "storeHudCache, len(playerIds)=", len(playerIds), " len(vpip)=" \
|
#print "storeHudCache, len(playerIds)=", len(playerIds), " len(vpip)=" \
|
||||||
#, len(hudImportData['street0VPI']), " len(totprof)=", len(hudImportData['totalProfit'])
|
#, len(hudImportData['street0VPI']), " len(totprof)=", len(hudImportData['totalProfit'])
|
||||||
for player in range (len(playerIds)):
|
for player in xrange(len(playerIds)):
|
||||||
|
|
||||||
# Set up a clean row
|
# Set up a clean row
|
||||||
row=[]
|
row=[]
|
||||||
|
@ -2522,7 +2509,7 @@ def storeHudCache2(backend, cursor, base, category, gametypeId, playerIds, hudIm
|
||||||
row.append(gametypeId)
|
row.append(gametypeId)
|
||||||
row.append(playerIds[player])
|
row.append(playerIds[player])
|
||||||
row.append(len(playerIds))#seats
|
row.append(len(playerIds))#seats
|
||||||
for i in range(len(hudImportData)+2):
|
for i in xrange(len(hudImportData)+2):
|
||||||
row.append(0)
|
row.append(0)
|
||||||
|
|
||||||
if base=="hold":
|
if base=="hold":
|
||||||
|
@ -2701,7 +2688,7 @@ def store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks,
|
||||||
#print "payin_amounts:",payin_amounts
|
#print "payin_amounts:",payin_amounts
|
||||||
#print "ranks:",ranks
|
#print "ranks:",ranks
|
||||||
#print "winnings:",winnings
|
#print "winnings:",winnings
|
||||||
for i in range (len(player_ids)):
|
for i in xrange(len(player_ids)):
|
||||||
cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId+0=%s", (tourney_id, player_ids[i]))
|
cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId+0=%s", (tourney_id, player_ids[i]))
|
||||||
tmp=cursor.fetchone()
|
tmp=cursor.fetchone()
|
||||||
#print "tried SELECTing tourneys_players.id:",tmp
|
#print "tried SELECTing tourneys_players.id:",tmp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user