2021-11-04 08:52:41 +01:00
|
|
|
class BaseSolution:
|
|
|
|
|
input_file = None
|
|
|
|
|
trim_input = True
|
|
|
|
|
|
|
|
|
|
def read_input(self, filename):
|
|
|
|
|
filepath = "./inputs/{}".format(filename)
|
|
|
|
|
with open(filepath, "r") as f:
|
|
|
|
|
data = f.read()
|
|
|
|
|
if self.trim_input:
|
|
|
|
|
return data.strip()
|
|
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
def show_results(self):
|
|
|
|
|
data = self.read_input(self.input_file)
|
|
|
|
|
puzzle_input = self.parse_input(data)
|
|
|
|
|
print(
|
2023-12-19 23:42:42 +01:00
|
|
|
"\n--- {} ---\n 1. {}\n 2. {}".format(
|
2021-11-04 08:52:41 +01:00
|
|
|
str(self),
|
|
|
|
|
self.solve(puzzle_input),
|
|
|
|
|
self.solve_again(puzzle_input),
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def solve(self, puzzle_input):
|
2023-12-19 14:47:05 +01:00
|
|
|
raise NotImplementedError
|
2021-11-04 08:52:41 +01:00
|
|
|
|
|
|
|
|
def solve_again(self, puzzle_input):
|
2023-12-19 14:47:05 +01:00
|
|
|
raise NotImplementedError
|
2021-11-04 08:52:41 +01:00
|
|
|
|
|
|
|
|
def parse_input(self, data):
|
2023-12-19 14:47:05 +01:00
|
|
|
raise NotImplementedError
|