-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
57 lines (46 loc) · 1.39 KB
/
main.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
import datetime
import sys
from typing import Optional
from board import build_board, mark_date
from bricks import Brick, build_bricks, get_transform
from solver import Records, solve
from output_utils import PALLATES, RESET_COLOR
def display_records(
bricks: list[Brick], records: Records, colormap: Optional[dict[int, str]] = None
):
for brick, (pos, t) in zip(bricks, records):
blocks = get_transform(brick.blocks, t)
if colormap:
print(colormap[brick.id])
blocks.display()
if colormap:
print(RESET_COLOR)
print(pos)
print()
def main():
month: int
day: int
weekday: int
if len(sys.argv) == 1:
today = datetime.date.today()
month = today.month
day = today.day
weekday = (today.weekday() + 1) % 7
else:
raise NotImplementedError
board = build_board()
board = mark_date(board, month, day, weekday)
bricks = build_bricks()
for b in bricks:
b.blocks.display()
print()
colormap: dict[int, str] = {
b.id: c for b, c in zip(bricks, PALLATES[: len(bricks)])
}
colormap[-1] = RESET_COLOR
board, records = solve(board, bricks, colormap)
board.display(colormap)
print(records)
# display_records(bricks, records, colormap)
if __name__ == "__main__":
main()