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_p1 = [16, 12, 23, 31, 1007]
|
||||||
test_solutions_p2 = [3, 54, 7, 9, 1, 0, 0, 1, 834151779165]
|
test_solutions_p2 = [3, 54, 7, 9, 1, 0, 0, 1, 834151779165]
|
||||||
|
|
||||||
def part1(self) -> Any:
|
def getBits(self) -> str:
|
||||||
bit_rep = ""
|
bits = bin(int(self.getInput(), 16))[2:]
|
||||||
for c in self.getInput():
|
return "0" * (len(self.getInput()) * 4 - len(bits)) + bits
|
||||||
bit_rep += "{0:04b}".format(int(c, 16))
|
|
||||||
|
|
||||||
return get_versions(bit_rep)
|
def part1(self) -> Any:
|
||||||
|
return get_versions(self.getBits())
|
||||||
|
|
||||||
def part2(self) -> Any:
|
def part2(self) -> Any:
|
||||||
bit_rep = ""
|
return get_value(self.getBits())
|
||||||
for c in self.getInput():
|
|
||||||
bit_rep += "{0:04b}".format(int(c, 16))
|
|
||||||
|
|
||||||
return get_value(bit_rep)
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user