-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_single.py
32 lines (26 loc) · 1.03 KB
/
generate_single.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
import naive_generate
import piece
import utils
import sys
import time
import calendar
# take two command line arguments and generate the answer
if __name__ == '__main__':
if len(sys.argv) != 3:
print('Usage: python generate_single.py <month_number> <day_number>')
print('Using December 25th as default')
month_number = 12
day_number = 25
else:
month_number = int(sys.argv[1])
day_number = int(sys.argv[2])
start_time = time.time()
print(f'\nAnswer for {calendar.month_name[month_number]} {day_number}\n')
field = naive_generate.generate_date_field(month_number, day_number)
field_id = utils.field_to_int64(field)
result = naive_generate.naive_recursion(field_id,
piece.return_all_calendar_pieces_default(),
verbose=False)
readable_result = naive_generate.readable_result(result)
print(readable_result)
print(f'\nTotal time: {time.time() - start_time}')