Stove: Rename Holder to Stove

Remove some debug code, and structure cli interface in the same way as other fpdb modules
This commit is contained in:
Worros 2010-11-30 15:16:01 +08:00
parent 404cccb1d9
commit e1b1d06ec7

View File

@ -22,14 +22,19 @@ OFFSUIT = 2
ev = pokereval.PokerEval() ev = pokereval.PokerEval()
holder = None
class Holder: class Stove:
def __init__(self): def __init__(self):
self.hand = None self.hand = None
self.board = None self.board = None
self.range = None self.range = None
def set_board_with_list(self, board):
pass
def set_board_with_string(self, board):
pass
class Cards: class Cards:
def __init__(self, c1, c2): def __init__(self, c1, c2):
@ -218,9 +223,9 @@ def parse_args(args, container):
else: else:
range.expand(expand_hands(_h, pocket_cards, board)) range.expand(expand_hands(_h, pocket_cards, board))
holder.hand = pocket_cards container.hand = pocket_cards
holder.range = range container.range = range
holder.board = board container.board = board
return True return True
@ -284,26 +289,12 @@ def odds_for_range(holder):
sev.show(holder.hand, holder.range.get()) sev.show(holder.hand, holder.range.get())
def main(argv=None):
stove = Stove()
holder = Holder() if not parse_args(sys.argv, stove):
if not parse_args(sys.argv, holder):
usage(sys.argv[0]) usage(sys.argv[0])
sys.exit(2) sys.exit(2)
odds_for_range(holder) odds_for_range(stove)
# debugs
#print '%s, %s' % ( holder.hand.c1, holder.hand.c2)
#print '%s %s %s %s %s' % (holder.board.b1, holder.board.b2,
# holder.board.b3, holder.board.b4, holder.board.b5)
#while True:
# try:
# vl = holder.range.get()
# v = vl.pop()
# print '\t%s %s' % (v.c1, v.c2)
# except IndexError:
# break
if __name__ == '__main__':
sys.exit(main())