43 lines
904 B
Python
Executable file
43 lines
904 B
Python
Executable file
#!/usr/bin/env python
|
|
# 2021 - Advent Of Code - 15
|
|
# unfinished
|
|
|
|
from typing import NamedTuple
|
|
|
|
|
|
class Color(NamedTuple):
|
|
PURPLE = '\033[95m'
|
|
CYAN = '\033[96m'
|
|
DARKCYAN = '\033[36m'
|
|
BLUE = '\033[94m'
|
|
GREEN = '\033[92m'
|
|
YELLOW = '\033[93m'
|
|
RED = '\033[91m'
|
|
BOLD = '\033[1m'
|
|
UNDERLINE = '\033[4m'
|
|
END = '\033[0m'
|
|
|
|
|
|
def parse_file(file):
|
|
with open(file, encoding="utf-8") as f:
|
|
columns = []
|
|
for line in f.readlines():
|
|
columns.append([int(c) for c in line.strip()])
|
|
|
|
return columns
|
|
|
|
|
|
def print_grid(grid):
|
|
# pylint: disable=unnecessary-list-index-lookup
|
|
for y, _ in enumerate(grid):
|
|
for x, _ in enumerate(grid[y]):
|
|
print(grid[y][x], end='')
|
|
print()
|
|
print()
|
|
|
|
|
|
cave_map = parse_file('input_example.txt')
|
|
print_grid(cave_map)
|
|
|
|
color = Color()
|
|
print(color.BOLD + 'Hello World !' + color.END)
|