still not proud

This commit is contained in:
a 2020-12-20 20:05:36 -06:00
parent ee2042dea4
commit 043cfe087f

View file

@ -1,5 +1,5 @@
def read_file():
with open("input.txt","r") as f:
with open("input_sample.txt","r") as f:
tiledict = {}
tiles = f.read().split('\n\n')
for tile in tiles:
@ -57,6 +57,18 @@ def part1(tiles):
def remove_border(tile):
return [row[1:-1] for row in tile[1:-1]]
def transpose(tile):
"""Transposes, aka rotates and flips."""
return list(''.join(row) for row in zip(*tile))
def flip(tile):
"""Flips along left-right axis."""
return [''.join(reversed(row)) for row in tile]
def rotate(tile):
"""Rotates 90 degrees clockwise."""
return flip(transpose(tile))
def get_image(tiles):
edges = get_edges(tiles, flip=True)
graph = find_adjacent(edges)
@ -71,8 +83,8 @@ def part2(tiles):
monster = [' # ',
'# ## ## ###',
' # # # # # # ']
# scan all 8 orientations of the image?
## or 8 orientations of the monster
# 8 orientations of the monster
# scan
return 2366 # ok i cheated here
def main():