/
run.py
82 lines (72 loc) · 2.55 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from team import *
'''
Functionality:
Makes a pool play bracket or team schedule
'''
import abc
from abc import ABCMeta
from pool import Pool
from bracket import Bracket
from formatBracket import FormatBracket
#the user interface of the software
class User:
def __init__(self):
self.tmpBracket = Bracket()
self.formattedBracket = FormatBracket(self.tmpBracket)
#the user interface for the user
def beginning(self):
into = 0
while(into != 6):
into = input("Options:\n"
"1. Make New Bracket:\n"
"2. Print Team Schedules:\n"
"3. Print Tourament Schedule:\n"
"4. Change a Team Name: \n"
"5. Output to a file: \n"
"6. End the Session\n")
if(into == 1):
self.useBracket()
elif(into == 2):
self.printSchedules(into)
elif(into == 3):
self.printSchedules(into)
elif(into == 4):
self.changeTeamName()
elif(into == 5):
self.outputToFile()
#making a formatting bracket
def useBracket(self):
try:
gamesNum = input("Number of games per team to play: ")
teamsNum = input("Number of teams in the tournament: ")
poolsNum = input("Number of pools in the tourament: ")
self.tmpBracket.makeBracket(gamesNum,teamsNum,poolsNum)
tmpFB = FormatBracket(self.tmpBracket)
self.formattedBracket = tmpFB
except:
print "Please give a valid information."
#changes the name of a team
#teamNum: the team number to replace
#teamName: The name that the team will be replaced to.
def changeTeamName(self):
teamNum = input("Enter the Team Number to change: ")
teamName = str(raw_input("Please enter the Team Name: "))
self.formattedBracket.__changeTeamName__(teamNum,teamName)
#printType: 2 for Full Tournament Schedule
#printType: 3 for Pools Schedule per Team
#prints all of the Schedules
def printSchedules(self,printType):
if(printType == 2):
print "Full Tournament Schedule: "
self.formattedBracket.printSchedule("A")
print
elif(printType == 3):
print "Pool Play for each Team:"
self.formattedBracket.printSchedule("s")
self.outputToFile()
#outputs the formatted table to a file
def outputToFile(self):
self.formattedBracket.fileOutput()
if(__name__ == "__main__"):
U = User()
U.beginning()