2022-11-30 02:05:11 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# 2021 - Advent Of Code - 15
|
|
|
|
# unfinished
|
|
|
|
|
2023-12-01 18:48:01 +01:00
|
|
|
from typing import NamedTuple
|
|
|
|
|
|
|
|
|
|
|
|
class Color(NamedTuple):
|
2022-11-30 02:05:11 +01:00
|
|
|
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):
|
2023-12-01 18:48:01 +01:00
|
|
|
# pylint: disable=unnecessary-list-index-lookup
|
|
|
|
for y, _ in enumerate(grid):
|
|
|
|
for x, _ in enumerate(grid[y]):
|
2022-11-30 02:05:11 +01:00
|
|
|
print(grid[y][x], end='')
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
|
|
cave_map = parse_file('input_example.txt')
|
|
|
|
print_grid(cave_map)
|
|
|
|
|
2023-12-01 18:48:01 +01:00
|
|
|
color = Color()
|
2022-11-30 02:05:11 +01:00
|
|
|
print(color.BOLD + 'Hello World !' + color.END)
|