3 """Run a poker championship.
6 from pbot.table import Player, Blinds
7 from pbot.tournament import run
10 if __name__ == '__main__':
11 from optparse import OptionParser
13 usage = '%prog [options] PLAYER PLAYER ...'
14 epilog = ('`PLAYER`s should be name,brain tuples, e.g. (`a,p1.py`). '
15 'Give just the name for a human playing from the command line.')
16 p = OptionParser(usage=usage, epilog=epilog)
17 p.add_option('-s', '--start-stack', dest='stack', default=1000,
18 type='int', help='start stack (%default)')
19 p.add_option('-b', '--blinds', dest='blinds',
20 default='1,2,4,8,16,25,37,50',
21 help='blind schedule (%default)')
22 p.add_option('-c', '--hand-clock', dest='clock', default=20, type='int',
23 help='hands between blind increments (%default)')
24 p.add_option('-l', '--hand-limit', dest='limit', default=5000, type='int',
25 help='hand limit (-1 for unlimited play, %default')
26 p.add_option('-t', '--tournaments', dest='tournaments', default=1,
27 type='int', help='number of tournaments (%default)')
28 p.add_option('-v', '--verbose', dest='verbose', action='store_true',
29 help='print the log as it is written')
31 options,args = p.parse_args()
33 blinds = Blinds(blinds=[int(x) for x in options.blinds.split(',')],
34 hand_clock=options.clock)
38 fields = [x.strip() for x in arg.rsplit(',', 1)]
44 players.append(Player(name=name, brain=brain))
47 run(players=list(players), blinds=blinds, start_stack=options.stack,
48 hand_limit=options.limit, tournaments=options.tournaments,
49 verbose=options.verbose)
50 finally: # kill the bots