remove string concat from fairly highly used convert_cards() func
This commit is contained in:
parent
9dab2899f7
commit
7a6684699a
|
@ -132,13 +132,15 @@ class Database:
|
||||||
def convert_cards(self, d):
|
def convert_cards(self, d):
|
||||||
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 range(1, 8):
|
for i in xrange(1, 8):
|
||||||
if d['card' + str(i) + 'Value'] == None:
|
cv = "card%dValue" % i
|
||||||
|
if d[cv] == None:
|
||||||
break
|
break
|
||||||
elif d['card' + str(i) + 'Value'] == 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]], cs)
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
def get_action_from_hand(self, hand_no):
|
def get_action_from_hand(self, hand_no):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user