day16: main class code beautification
This commit is contained in:
parent
c4db3e5192
commit
09d316941e
16
day16.py
16
day16.py
@ -101,16 +101,12 @@ class Day(AOCDay):
|
||||
test_solutions_p1 = [16, 12, 23, 31, 1007]
|
||||
test_solutions_p2 = [3, 54, 7, 9, 1, 0, 0, 1, 834151779165]
|
||||
|
||||
def part1(self) -> Any:
|
||||
bit_rep = ""
|
||||
for c in self.getInput():
|
||||
bit_rep += "{0:04b}".format(int(c, 16))
|
||||
def getBits(self) -> str:
|
||||
bits = bin(int(self.getInput(), 16))[2:]
|
||||
return "0" * (len(self.getInput()) * 4 - len(bits)) + bits
|
||||
|
||||
return get_versions(bit_rep)
|
||||
def part1(self) -> Any:
|
||||
return get_versions(self.getBits())
|
||||
|
||||
def part2(self) -> Any:
|
||||
bit_rep = ""
|
||||
for c in self.getInput():
|
||||
bit_rep += "{0:04b}".format(int(c, 16))
|
||||
|
||||
return get_value(bit_rep)
|
||||
return get_value(self.getBits())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user