本文整理汇总了Python中Card.decodeStartHandValue方法的典型用法代码示例。如果您正苦于以下问题:Python Card.decodeStartHandValue方法的具体用法?Python Card.decodeStartHandValue怎么用?Python Card.decodeStartHandValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card.decodeStartHandValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: starthands
# 需要导入模块: import Card [as 别名]
# 或者: from Card import decodeStartHandValue [as 别名]
def starthands(stat_dict, player, handid):
#summary of known starting hands+position
# data volumes could get crazy here,so info is limited to hands
# in the current HH file only
# this info is NOT read from the cache, so does not obey aggregation
# parameters for other stats
#display shows 3 categories
# PFcall - limp or coldcall preflop
# PFaggr - raise preflop
# PFdefBB - defended in BB
# hand is shown, followed by position indicator
# (b=SB/BB. l=Button/cutoff m=previous 3 seats to that, e=remainder)
# due to screen space required for this stat, it should only
# be used in the popup section i.e.
# <pu_stat pu_stat_name="starthands"> </pu_stat>
stat_descriptions["starthands"] = _("starting hands at this table") + " (starting hands)"
PFlimp=" PFlimp:"
PFaggr=" PFaggr:"
PFcar=" PFCaRa:"
PFdefend=" PFdefBB:"
count_pfl = count_pfa = count_pfc = count_pfd = 2
if handid == -1:
return ((''),
(''),
(''),
(''),
(''),
(''))
c = Configuration.Config()
db_connection = Database.Database(c)
sc = db_connection.get_cursor()
sc.execute(("SELECT distinct startCards, street0Aggr, street0CalledRaiseDone, " +
"case when HandsPlayers.position = 'B' then 'b' " +
"when HandsPlayers.position = 'S' then 'b' " +
"when HandsPlayers.position = '0' then 'l' " +
"when HandsPlayers.position = '1' then 'l' " +
"when HandsPlayers.position = '2' then 'm' " +
"when HandsPlayers.position = '3' then 'm' " +
"when HandsPlayers.position = '4' then 'm' " +
"when HandsPlayers.position = '5' then 'e' " +
"when HandsPlayers.position = '6' then 'e' " +
"when HandsPlayers.position = '7' then 'e' " +
"when HandsPlayers.position = '8' then 'e' " +
"when HandsPlayers.position = '9' then 'e' " +
"else 'X' end " +
"FROM Hands, HandsPlayers, Gametypes " +
"WHERE HandsPlayers.handId = Hands.id " +
" AND Gametypes.id = Hands.gametypeid "+
" AND Gametypes.type = " +
" (SELECT Gametypes.type FROM Gametypes, Hands " +
" WHERE Hands.gametypeid = Gametypes.id and Hands.id = %d) " +
" AND Gametypes.Limittype = " +
" (SELECT Gametypes.limitType FROM Gametypes, Hands " +
" WHERE Hands.gametypeid = Gametypes.id and Hands.id = %d) " +
"AND Gametypes.category = 'holdem' " +
"AND fileId = (SELECT fileId FROM Hands " +
" WHERE Hands.id = %d) " +
"AND HandsPlayers.playerId = %d " +
"AND street0VPI " +
"AND startCards > 0 " +
"ORDER BY startCards DESC " +
";")
% (int(handid), int(handid), int(handid), int(player)))
for (qstartcards, qstreet0Aggr, qstreet0CalledRaiseDone, qposition) in sc.fetchall():
humancards = Card.decodeStartHandValue("holdem", qstartcards)
if qposition == "B" and qstreet0Aggr == False:
PFdefend=PFdefend+"/"+humancards
count_pfd += 1
if (count_pfd / 8.0 == int(count_pfd / 8.0)):
PFdefend=PFdefend+"\n"
elif qstreet0Aggr == True:
PFaggr=PFaggr+"/"+humancards+"."+qposition
count_pfa += 1
if (count_pfa / 8.0 == int(count_pfa / 8.0)):
PFaggr=PFaggr+"\n"
elif qstreet0CalledRaiseDone:
PFcar=PFcar+"/"+humancards+"."+qposition
count_pfc += 1
if (count_pfc / 8.0 == int(count_pfc / 8.0)):
PFcar=PFcar+"\n"
else:
PFlimp=PFlimp+"/"+humancards+"."+qposition
count_pfl += 1
if (count_pfl / 8.0 == int(count_pfl / 8.0)):
PFlimp=PFlimp+"\n"
sc.close()
returnstring = PFlimp + "\n" + PFaggr + "\n" + PFcar + "\n" + PFdefend #+ "\n" + str(handid)
#.........这里部分代码省略.........
示例2: addGrid
# 需要导入模块: import Card [as 别名]
# 或者: from Card import decodeStartHandValue [as 别名]
def addGrid(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
counter = 0
row = 0
sqlrow = 0
if not flags: holecards,grid = False,0
else: holecards,grid = flags[0],flags[2]
tmp = self.sql.query[query]
tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, type, seats, groups, dates, games)
#print "DEBUG: query: %s" % tmp
self.cursor.execute(tmp)
result = self.cursor.fetchall()
colnames = [desc[0].lower() for desc in self.cursor.description]
# pre-fetch some constant values:
colshow = colshowsumm
if groups['posn']: colshow = colshowposn
self.cols_to_show = [x for x in self.columns if x[colshow]]
hgametypeid_idx = colnames.index('hgametypeid')
assert len(self.liststore) == grid, "len(self.liststore)="+str(len(self.liststore))+" grid-1="+str(grid)
self.liststore.append( gtk.ListStore(*([str] * len(self.cols_to_show))) )
view = gtk.TreeView(model=self.liststore[grid])
view.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
#vbox.pack_start(view, expand=False, padding=3)
vbox.add(view)
textcell = gtk.CellRendererText()
textcell50 = gtk.CellRendererText()
textcell50.set_property('xalign', 0.5)
numcell = gtk.CellRendererText()
numcell.set_property('xalign', 1.0)
assert len(self.listcols) == grid
self.listcols.append( [] )
# Create header row eg column: ("game", True, "Game", 0.0, "%s")
for col, column in enumerate(self.cols_to_show):
if column[colalias] == 'game' and holecards:
s = [x for x in self.columns if x[colalias] == 'hand'][0][colheading]
else:
s = column[colheading]
self.listcols[grid].append(gtk.TreeViewColumn(s))
view.append_column(self.listcols[grid][col])
if column[colformat] == '%s':
if column[colxalign] == 0.0:
self.listcols[grid][col].pack_start(textcell, expand=True)
self.listcols[grid][col].add_attribute(textcell, 'text', col)
cellrend = textcell
else:
self.listcols[grid][col].pack_start(textcell50, expand=True)
self.listcols[grid][col].add_attribute(textcell50, 'text', col)
cellrend = textcell50
self.listcols[grid][col].set_expand(True)
else:
self.listcols[grid][col].pack_start(numcell, expand=True)
self.listcols[grid][col].add_attribute(numcell, 'text', col)
self.listcols[grid][col].set_expand(True)
cellrend = numcell
#self.listcols[grid][col].set_alignment(column[colxalign]) # no effect?
self.listcols[grid][col].set_clickable(True)
self.listcols[grid][col].connect("clicked", self.sortcols, (col,grid))
if col == 0:
self.listcols[grid][col].set_sort_order(gtk.SORT_DESCENDING)
self.listcols[grid][col].set_sort_indicator(True)
if column[coltype] == 'cash':
self.listcols[grid][col].set_cell_data_func(numcell, self.ledger_style_render_func)
else:
self.listcols[grid][col].set_cell_data_func(cellrend, self.reset_style_render_func)
rows = len(result) # +1 for title row
while sqlrow < rows:
treerow = []
for col,column in enumerate(self.cols_to_show):
if column[colalias] in colnames:
value = result[sqlrow][colnames.index(column[colalias])]
if column[colalias] == 'plposition':
if value == 'B':
value = 'BB'
elif value == 'S':
value = 'SB'
elif value == '0':
value = 'Btn'
else:
if column[colalias] == 'game':
if holecards:
value = Card.decodeStartHandValue(result[sqlrow][colnames.index('category')], result[sqlrow][hgametypeid_idx] )
else:
minbb = result[sqlrow][colnames.index('minbigblind')]
maxbb = result[sqlrow][colnames.index('maxbigblind')]
value = result[sqlrow][colnames.index('limittype')] + ' ' \
+ result[sqlrow][colnames.index('category')].title() + ' ' \
+ result[sqlrow][colnames.index('name')] + ' $'
if 100 * int(minbb/100.0) != minbb:
value += '%.2f' % (minbb/100.0)
else:
value += '%.0f' % (minbb/100.0)
if minbb != maxbb:
if 100 * int(maxbb/100.0) != maxbb:
value += ' - $' + '%.2f' % (maxbb/100.0)
else:
#.........这里部分代码省略.........
示例3: update_data
# 需要导入模块: import Card [as 别名]
# 或者: from Card import decodeStartHandValue [as 别名]
def update_data(self, new_hand_id, db_connection):
#this method called once for every hand processed
# self.hud.stat_dict contains the stats information for this hand
if not self.active:
return
if (debugmode):
debugfile=open("~Rushdebug.data", "a")
debugfile.write(new_hand_id+"\n")
now = datetime.now()
debugfile.write(now.strftime("%Y%m%d%H%M%S")+ " update_data begins"+ "\n")
debugfile.write("hero="+str(self.heroid)+"\n")
#debugfile.write(str(self.hud.stat_dict)+"\n")
debugfile.write("table="+self.hud.table.name+"\n")
debugfile.write("players="+str(self.hud.stat_dict.keys())+"\n")
debugfile.write("db="+str(db_connection)+"\n")
if self.hud.table.name not in self.rushtables:
return
#
# Grab a list of player id's
#
handplayers = self.hud.stat_dict.keys()
#
# build a dictionary of stats text for each player in the hand (excluding the hero)
# xmlqueuedict contains {playername : stats text}
#
xmlqueuedict = {}
for playerid in handplayers:
# ignore hero, no notes available for hero at Full Tilt
if playerid == self.heroid: continue
playername=unicode(str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'playername')[1]))
# Use index[3] which is a short description
n=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'n')[3] + " ")
vpip=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'vpip')[3] + " ")
pfr=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'pfr')[3] + " ")
three_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'three_B')[3] + " ")
four_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'four_B')[3] + " ")
cbet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'cbet')[3] + " ")
fbbsteal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_BB_steal')[3] + " ")
f_3bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_3bet')[3] + " ")
f_4bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_4bet')[3] + " ")
steal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'steal')[3] + " ")
ffreq1=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'ffreq1')[3] + " ")
agg_freq=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'agg_freq')[3] + " ")
BBper100=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'BBper100')[3])
if BBper100[6] == "-": BBper100=BBper100[0:6] + "(" + BBper100[7:] + ")"
#
# grab villain known starting hands
# only those where they VPIP'd, so limp in the BB will not be shown
# sort by hand strength. Output will show position too,
# so KK.1 is KK from late posn etc.
# ignore non-rush hands (check against known rushtablenames)
# cards decoding is hard-coded for holdem, so that's tuff atm
# three categories of known hands are shown:
# agression preflop hands
# non-aggression preflop hands
# bigblind called to defend hands
#
# This isn't perfect, but it isn't too bad a starting point
#
PFcall="PFcall"
PFaggr="PFaggr"
PFdefend="PFdefend"
c = db_connection.get_cursor()
c.execute(("SELECT handId, position, startCards, street0Aggr, tableName " +
"FROM Hands, HandsPlayers " +
"WHERE HandsPlayers.handId = Hands.id " +
"AND street0VPI " +
"AND startCards > 0 " +
"AND playerId = %d " +
"ORDER BY startCards DESC " +
";")
% int(playerid))
for (qid, qposition, qstartcards, qstreet0Aggr, qtablename) in c.fetchall():
if (debugmode):
debugfile.write("pid, hid, pos, cards, aggr, table player"+
str(playerid)+"/"+str(qid)+"/"+str(qposition)+"/"+
str(qstartcards)+"/"+str(qstreet0Aggr)+"/"+
str(qtablename)+"/"+str(playername)+
"\n")
humancards = Card.decodeStartHandValue("holdem", qstartcards)
if qtablename not in self.rushtables:
pass
elif qposition == "B" and qstreet0Aggr == False:
PFdefend=PFdefend+"/"+humancards
elif qstreet0Aggr == True:
PFaggr=PFaggr+"/"+humancards+"."+qposition
else:
#.........这里部分代码省略.........