Example #1
0
"""

from Player import Player
from Tournament import Tournament
from random import randint
from console import list_tables, list_standings

if __name__ == '__main__':
    EVENT = Tournament('Test Event')
    for x in open('player_names.txt').readlines():
        x = x.strip('\n')
        first, last = x.split(' ')
        EVENT.add_player(Player(first, last))

    for x in xrange(5):
        EVENT.start_round()
        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)
Example #2
0
            userpin = int(raw_input("pin  -> "))
            EVENT.add_player(Player(firstname, lastname, userpin))
        elif sanctioned == False:
            EVENT.add_player(Player(firstname, lastname))


if __name__ == "__main__":
    INFO = get_event_info()
    EVENT = Tournament(INFO[0], INFO[1])
    get_players()

    ROUNDS = number_rounds(len(EVENT.players))

    # main event-reporting loop
    while EVENT.round < ROUNDS:
        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)