forked from hccheng/py-mcr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto_max_all.py
More file actions
executable file
·35 lines (31 loc) · 988 Bytes
/
auto_max_all.py
File metadata and controls
executable file
·35 lines (31 loc) · 988 Bytes
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
from informat import *
from maxpoints import *
import pprint
def main():
sit_lines = []
for file_name in ['inex.txt', 'extra_inex.txt']:
f = open(file_name)
sit_lines.extend(get_sits_from_file(f))
for sit_line in sit_lines:
sit = parse_command_line(sit_line)
print "\n Situation line: %s" % sit_line
opts = get_options(sit)
for i, option in enumerate(opts):
print 'Option #%d' % i
pprint.pprint(option)
selected_fans = option_max_points(option)
print 'Selected fans: '
pprint.pprint(selected_fans)
print 'Points: %d' % get_total_points(selected_fans)
def get_sits_from_file(f):
sits = []
try:
for line in f:
if not line.startswith('#'):
line = line[:-1]
sits.append(line)
finally:
f.close()
return sits
if __name__ == "__main__":
main()