utilize aoc_ocr

This commit is contained in:
Stefan Harmuth 2022-12-10 10:29:55 +01:00
parent 27cdaafef7
commit f63a3623d4
2 changed files with 7 additions and 11 deletions

View File

@ -1,4 +1,5 @@
from tools.aoc import AOCDay from tools.aoc import AOCDay
from tools.aoc_ocr import convert_6
from typing import Any from typing import Any
@ -8,7 +9,7 @@ class Day(AOCDay):
(2806, "input08") (2806, "input08")
], ],
[ [
("see image above", "input08") ("ZBJAB", "input08")
] ]
] ]
@ -57,14 +58,11 @@ class Day(AOCDay):
while layers[z][y][x] == "2": while layers[z][y][x] == "2":
z += 1 z += 1
line += " " if layers[z][y][x] == "0" else "#" line += "." if layers[z][y][x] == "0" else "#"
rows.append(line) rows.append(line)
for x in rows: return convert_6("\n".join(rows))
print(x)
return "see image above"
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1,7 +1,7 @@
from intcode import IntCode from intcode import IntCode
from tools.aoc import AOCDay from tools.aoc import AOCDay
from tools.coordinate import Coordinate from tools.coordinate import Coordinate
from tools.grid import Grid, GridTransformation from tools.grid import Grid
from typing import Any from typing import Any
MOVEMENTS = [Coordinate(0, -1), Coordinate(1, 0), Coordinate(0, 1), Coordinate(-1, 0)] MOVEMENTS = [Coordinate(0, -1), Coordinate(1, 0), Coordinate(0, 1), Coordinate(-1, 0)]
@ -13,7 +13,7 @@ class Day(AOCDay):
(2373, "input11") (2373, "input11")
], ],
[ [
("see image above", "input11") ("PCKRLPUK", "input11")
] ]
] ]
@ -50,9 +50,7 @@ class Day(AOCDay):
face += 1 if comp.getOutput() else -1 face += 1 if comp.getOutput() else -1
pos = pos + MOVEMENTS[face % 4] pos = pos + MOVEMENTS[face % 4]
hull.print(true_char='#', false_char=' ') return hull.get_aoc_ocr_string(x_shift=1)
return "see image above"
if __name__ == '__main__': if __name__ == '__main__':