Skip to content

Commit

Permalink
Day 12 solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayfoad committed Dec 12, 2018
1 parent 3bed3ac commit bdbd946
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions p12.dyalog
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
⎕IO0 ⎕PP17
s15p'#'=⎕NGET'p12.txt'1 initial state
u5¨2p v¨2p patterns and replacements
f{v[u0 ¯1(5,5+)0 0 0 0,]} next generation
g{+/()-0.5×()-s} score function
g f20s part 1
tf{/(-/)¨}s iterate until pattern stabilises
(g t)+((g f t)-g t)×50E9-0.25×(t)-s part 2
34 changes: 34 additions & 0 deletions p12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
initial state: .#..##..#.....######.....#....####.##.#.#...#...##.#...###..####.##.##.####..######......#..##.##.##

#.... => .
.##.# => #
#..## => .
....# => .
###.# => #
...#. => #
#...# => #
#.### => .
.#... => #
...## => .
..### => .
####. => .
##.## => .
..##. => .
.#.## => #
#..#. => #
..... => .
#.#.. => .
##.#. => #
.#### => #
##### => .
#.##. => #
.#..# => #
##... => .
..#.# => #
##..# => #
.###. => .
.#.#. => #
#.#.# => #
###.. => .
.##.. => .
..#.. => .

0 comments on commit bdbd946

Please sign in to comment.