diff options
Diffstat (limited to '2015/18')
-rw-r--r-- | 2015/18/Makefile | 4 | ||||
-rw-r--r-- | 2015/18/puzzles.py | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/2015/18/Makefile b/2015/18/Makefile index 9f0c9fb..247194a 100644 --- a/2015/18/Makefile +++ b/2015/18/Makefile @@ -1,6 +1,6 @@ all: - sed '/# START PART 2/,/# END PART 2/d' puzzles.py >puzzle-1.py - sed '/# START PART 1/,/# END PART 1/d' puzzles.py >puzzle-2.py + sed '/START PART 2/,/END PART 2/d' puzzles.py >puzzle-1.py + sed '/START PART 1/,/END PART 1/d' puzzles.py >puzzle-2.py chmod +x puzzle-[12].py .PHONY: clean diff --git a/2015/18/puzzles.py b/2015/18/puzzles.py index 5fbe572..4082ab5 100644 --- a/2015/18/puzzles.py +++ b/2015/18/puzzles.py @@ -28,10 +28,9 @@ def simulate(data: list[list[str]]) -> list[list[str]]: cond = lambda x, y: (data[x][y] == "#" and neighbours(data, x, y) in [2, 3]) or ( data[x][y] == "." and neighbours(data, x, y) == 3 ) - # END PART 1 - # START PART 2 + # END PART 1 START PART 2 cond = lambda x, y: ( - ((i, j) in [(0, 0), (0, 99), (99, 0), (99, 99)]) + ((x, y) in [(0, 0), (0, 99), (99, 0), (99, 99)]) or (data[x][y] == "#" and neighbours(data, x, y) in [2, 3]) or (data[x][y] == "." and neighbours(data, x, y) == 3) ) |