print 'Round: ', EVENT.round list_tables(EVENT, showall=True) for match in EVENT.tables[EVENT.round]: y = randint(1, 100) if y < 25: match.report_match(2, 1) if y >= 25 and y < 50: match.report_match(2, 0) if y >= 50 and y < 75: match.report_match(1, 2) if y >= 75 and y <= 100: match.report_match(0, 2) EVENT.finish_round() for x in EVENT.top_players(): print x list_standings(EVENT, byscore=True) # now a test of the round-robin code. Just for laughs, well use the # top eight players from the 'main event'. TOP8 = EVENT.top_players() # create new event RROBIN = Tournament('Round Robin Test', pairing='round') for x in TOP8: RROBIN.add_player(x)
EVENT.start_round() ACTIVE = len(EVENT.active_tables()) while ACTIVE > 0: CMD = raw_input("Round #%d (%d tables open) -> " % (EVENT.round, ACTIVE)) if search("lp", CMD) is not None: list_pairings(EVENT) continue if search("ls", CMD) is not None: list_standings(EVENT) continue if search("lso", CMD) is not None: list_standings(EVENT, byscore=True) continue if search("lt", CMD) is not None: list_tables(EVENT) continue if search("lat", CMD) is not None: list_tables(EVENT, True) continue if search("^r ", CMD) is not None: BROKEN = CMD.split(" ") if len(BROKEN) == 2: # ask for results pass if len(BROKEN) == 4: # report as table broken[1] (broken[2]-broken[3]) EVENT.report_match(int(BROKEN[1]), int(BROKEN[2]), int(BROKEN[3])) ACTIVE = len(EVENT.active_tables()) EVENT.finish_round()