managed to knock checkPositions down to a single line :)

This commit is contained in:
eblade 2009-03-26 15:11:24 -04:00
parent b80a068795
commit 3e6fccd34d

View File

@ -384,17 +384,16 @@ 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=[] return [buyin + fee for i in xrange(count)]
for i in xrange(count):
result.append (buyin+fee)
return result
#end def calcPayin #end def calcPayin
def checkPositions(positions): def checkPositions(positions):
""" verify positions are valid """ """ verify positions are valid """
for p in positions: if any(not (p == "B" or p == "S" or (p >= 0 and p <= 9)) for p in positions):
if not (p == "B" or p == "S" or (p >= 0 and p <= 9)): raise FpdbError("invalid position '"+p+"' found in checkPositions")
raise FpdbError("invalid position '" + p + "' found in checkPositions") # for p in positions:
# if not (p == "B" or p == "S" or (p >= 0 and p <= 9)):
# raise FpdbError("invalid position '" + p + "' found in checkPositions")
### RHH modified to allow for "position 9" here (pos==9 is when you're a dead hand before the BB ### RHH modified to allow for "position 9" here (pos==9 is when you're a dead hand before the BB
### eric - position 8 could be valid - if only one blind is posted, but there's still 10 people, ie a sitout is present, and the small is dead... ### eric - position 8 could be valid - if only one blind is posted, but there's still 10 people, ie a sitout is present, and the small is dead...