still not proud
This commit is contained in:
parent
ee2042dea4
commit
043cfe087f
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue