32 lines
758 B
Python
32 lines
758 B
Python
|
def get_fname(day: int) -> str:
|
||
|
import sys
|
||
|
|
||
|
if sys.argv[-1] == "--sample":
|
||
|
return f"samples/day{day:02}.txt"
|
||
|
else:
|
||
|
return f"full/day{day:02}.txt"
|
||
|
|
||
|
|
||
|
def load_file_char_matrix(name):
|
||
|
with open(name, "r") as f:
|
||
|
my_file = []
|
||
|
for line in f:
|
||
|
my_file.append(line.rstrip())
|
||
|
return [list(x) for x in my_file]
|
||
|
|
||
|
|
||
|
def load_file_int_matrix(name):
|
||
|
with open(name, "r") as f:
|
||
|
my_file = []
|
||
|
for line in f:
|
||
|
my_file.append(line.rstrip())
|
||
|
return [list(map(int, x)) for x in my_file]
|
||
|
|
||
|
|
||
|
def load_file_word_matrix(name):
|
||
|
with open(name, "r") as f:
|
||
|
my_file = []
|
||
|
for line in f:
|
||
|
my_file.append(line.rstrip())
|
||
|
return [x.split(" ") for x in my_file]
|