diff options
author | Leah Neukirchen <leah@vuxu.org> | 2020-12-25 14:35:55 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2020-12-25 14:35:55 +0100 |
commit | 1047a8d0c88fc686fb3aba8495167b97a80bab8d (patch) | |
tree | 084284cb9a52e37856b91014c2474f885c19df69 | |
parent | 69a013313ee0399e797363bbe76d9b32747c723f (diff) | |
download | adventofcode2020-1047a8d0c88fc686fb3aba8495167b97a80bab8d.tar.gz adventofcode2020-1047a8d0c88fc686fb3aba8495167b97a80bab8d.tar.xz adventofcode2020-1047a8d0c88fc686fb3aba8495167b97a80bab8d.zip |
day24
-rw-r--r-- | day24 | 432 | ||||
-rw-r--r-- | day24.clj | 57 | ||||
-rw-r--r-- | day24.ijs | 6 |
3 files changed, 495 insertions, 0 deletions
diff --git a/day24 b/day24 new file mode 100644 index 0000000..e75d6f9 --- /dev/null +++ b/day24 @@ -0,0 +1,432 @@ +eweneeewwneeeneneseweeeee +eenweesewseweene +nenwnenenenenenenwewnwwwnenwnwnwese +seseseeneseseseswneeswseseseseseseesese +nwsewewwwwewwwwwnwnwwwnwwsww +weseeewwnwwwswnwswnwewneswnwnwswsw +eeeweneeeeneeeee +eneswswneswwsenwwsenweswnwswswswsesw +nwseeeeewneswswsesenweeenweeee +swswnwnwseswneseswswnwsenenwsenwswwese +nwswsenesewnwwnwnewnenwwwwwnwwse +swwsesesesenwseswswswswseseseseeeswnwse +neneneeneenenenwnenenenwseswnenee +swnenwnenenwnenwewwswnweenwnwnwnwnese +swsewseseswseeswswseswsese +wnewnweneenenenwsenenenesweswwneswnw +nwenenwnenwnwnwnwswnenw +esesesesesesesesesesesesesesesenwsese +nenwnwnwnwenwnenwnwnwnwsenenwnwswnenwse +eewnenesenwneswenewneneneeeewne +ewwneseeeeneneeneneneneenenenenene +eweseseeneneneeswnwwnenewneneenee +sesweswnenwwnwsewnwnwnweewseeswwe +seeeseneeweeseee +swseneneewwnenwwwwnwsesese +neenweeseneswseseswwwnweneeweese +eeeseswseseeeeeeeeneeeenwese +wnenenenewneeneneenenenesenene +nwnwnewwsesenenwnwwwewwwwwwnw +wneswswwswswswwswswswwseswsww +nenenesenwneswwwnwnwnwswswwnwenewse +neenenenenenenenenwswnenwnwsenenenenewnene +wwswwsewnenewsewwwwwwwnwswse +wwwwwwwwwewewwwwwwwsw +nwneweseeseeneseeeneesewewwe +swwenwnenwnwewwseeesenwswnwwwsw +wwswwwsewweswswwneneewswwswwsww +swnwswenwseswswswswswnwswseswswswswsese +eeeneeneswnenwneenenesee +enwnwnenwnesenwnwwenwnwswswnwwe +nwnenenenenwnwnwswswseneneneswnwnwswnene +seseeenweweenenwneeneneeeeseene +nenwnenenenwneeenenwnewswnenw +wswneewswswneneswsewswseneseswswseswsw +wewenesweeeeeneneweneneeenese +senwnwnenwenwnwwnenwsesenwnwnwnwnwsenw +seneeneeswseneenwenwnwswneeneenwe +senenwsenesewswwseseswseneseswswnenwswe +wwswewwenweewwwwwswneswww +swwnwnwneneneneeneneneneenwswnenenww +nwwnwwsenwnwnwswnwwwsenwwnewwww +nwswswnwenwseeeewsenwseenese +eweeseeeswenwnweswenwnewwsew +neeswenweseeeeeeseeeee +nesenwenenwnesenwwneneneneneneneswnene +swswswswswswseswswneswwswneneswswsewsw +eeeenweesweeeseeeeee +nwenesenwneswnewsenenwwnwsewswwnewse +seeeseseenwseeswwseseswwenesesese +wewnwnwwwwwwenwwwwwwwwww +enwswswswnwnwneeeewseeseeeseseese +newenwnenwewswnenwnwnwnwnwnwnenenwnenw +wwnwnwnwswnwnwwwnwnwsenwnwewnwnwww +nwnwswnwnwwwwwwwnwwwnwnewsewww +swsenweeeseseseweneeeseseswseseenw +sesenwseeneseseweseseseseesewnweese +seeneweesewseneeeseseeseseesee +swswswswswswswswnwsweswswswswswseswswsw +nwseeeseseseesweeeseenwsweseseeee +seseseneseseseseseseswnesesesesewsenww +wwnewwnwwsewnwewwnw +wwwnwwwwswwswwwswsesenw +nwnwwwsenwwnwnwnwnwnwnwnwnwwswnwnwe +newnenwnenenenwseneneswnenwnenene +esweeeneswneneweneseneewwenese +sesewnwseseswsesenewseneseeneswsenwe +seeeeeeeeeenenenweneeesweene +seeswenwseeswswweeenweneneseenene +nenwnenenwnenenwnwnenwnwnenwnenenwsw +nesenewswsewnwswwswweswswswwswnwewse +nwsweswswswwenewwswswwswwswnewsww +sewseseswswseseseeseseswseswswesewsw +nenenenenenwnwsenwnenenewnwsenwnenwnenw +sewwwsewnewweswsenenwwwswenwnenww +eewwswwwwwswwwe +nwsenwswwnwseenwnwnwnwnwnenwnwwnwww +nenwnwnenwnwnenenwnwwseneenwnwnwne +neneswswsweswsewswnesewneswwswnenewnw +wnwewnwwwwwwwwwneswnwnwnwwwse +eswswswswswswswswswswseswnwswswnwswsesw +nenenwnenwnenwnenwnwnenenenenenwnwsenenwse +nwnwnwnwnesenenwswnwnwnenwnwnenwnwnwnwnenw +swswwwwswwwwweswsww +enewswwwswwwwswsewwwwwwwswsw +wsesesesesesesesewneweswewseswseese +neeneneneneenenenweeneneneeeeesw +swneneenenenwswewnweneeneneneneneenwsw +wwwnwwnwwwnwweweewnwwwwsw +nwwsewwnwwwnwnwewwwnwnenwwww +enwnenwnenwnenewnwewne +nwewseneswneeewnwswenwswsenwswwne +wwswnewswswwwswwnwwswseesww +swnwnwenwnwnenwswneenwne +newnwswwswswswswswwseswseswneswswswsw +wswseeswswneswswwswwsweewwwswe +neeeeseenwswewweeneneenenenenee +wswwewneswswwwwwwnwwwsenwwww +swswneswsewewseneesweenwnwseneee +swswnwswswwwsewswwwwwwwwww +wnwsesesesesesesesesenese +nwseeeseneeswsenenweseseeswsesewe +esesewewnwseseeeseseeseesee +neswnweseswswswnwswswswswnwwneseeswnw +enwnwnwwseenenwnwsenwnwwswnwwwnwne +swseswseneswneswwnwweswnwwnwseswswse +nwneneenenwswnwsewsenwswnwnwnesw +swneswseseseswswseseseswseswsesesesenewse +swesweeswswswsenwswswnwnwswseswswswsw +senenwswnwseseseeseswseenwnwwnwenwe +enweneneneswneeneneneneeneneeene +sweswseeeeeeeseeesenwnwnwse +neneneneeneneneeneneneenewneneneneswne +wnesewnwneswwsenwnesenwwswnwenesenww +neenewsweweeeeeseeeeeesee +nwnwnenwnenwswneewnenenwnenenenwnwsewene +eseweseseeeeeeseseeeeeneese +swswswswenwwswswswsweswswswswswswnenw +wsenenewnenenenenenesenenenenenenenwne +enewnwneswnenesewnesenwne +wnwwwenwnwnwnwnwnwwnw +eeseseswswwnweneweneeeneeeswe +nwnesewswswswwwsww +eeewnweeeeeeeeneneesesweee +wnweswnwnwnwneseswnwnwnwnw +nenenenwnenenwnenesenenwsw +nwswnewwswsewneswnesewwwwsewswnw +eneseeneswneneneeeeenwneeneeene +nenenwenenwneenenenwnwnewnwneswnenenwne +wseswseswenwneeneseeeseseseesewsenese +wnwnwwwwnwswnwenwnwswwwnwwewwww +neneeeneneneseeneneneneeeneneeswnenw +neneneeeneswneneneeneenenenenesenenew +nwwwwnwnwnwnwwnwswnwnwnwwenwnwnww +wsewwwwwwnwwwwewwnenwswwwww +nwneneesenenenwswnwnewswnenenenenwnenenw +seseswsesesenewwnwseswseswneeswnesee +eswneneneswnwnenenwsenwnwnenenwnwnenwnwnenw +seneesenenweeswwneeneswneswneseenwnw +wwwnwnwewnwnwnwnwnwnwnwewnwnwnwnwnw +enenewneneneneseneewnwneeewenese +enenenenenenenwneneeseneneenenenewswne +esesenwseseseseseseseseseswsenwsesesese +nwnwwwnwnwwwnwsewneseseswnwnwnwsewne +eswnwweeswnenweneseee +nwnenwnwsenwnwnwnwsewnwnwnwnwnenwnenenw +eneeneswnenenesenenenenenw +sesewweseseseeeseseewseneseseee +swesenwnwwneeenenwswsweswswwnwnwnww +nwnwnwnenwnenenenwwnwnwnenwnwnwnwsenwswnwnw +seseseswseswseswswseseswnwseeswswswsenw +swseswseswswwswseeneseswseseseseseswsesw +sesewseesewneswneesesesenw +sesenesweseseseseswwseseswswnwsenesewsw +nenenwsenwnwwnwwnwnenwnwnwnwnwnwenwnw +swneswswwswwwswswswseswswswswswwwsw +seneseseeweeeseeweeseweneese +sesenwseseseneseseseesesenwneswswnwnwse +swseswwswseswseseswswswseswswneswsesenwsese +wnwwwsenewswswswnewswswse +nwnwenwnenenwnwneenenwwwnwnenwswnwe +eeesweseeeeeeeeeeenewnee +swnwnwnwnwneneenenenenwnwnenenenwnenwnw +nenwwnwnwwsenenwnesenwswnwwwwewww +senenwswnewnwnwnewwnwsenwneneneneneenene +swseswseswswswsweswswswswswseswnwswsese +ewneesweneneeswneeneeneneneenwewne +wsewwnwwwnewnwnwswwwnwnewwwww +sewseneswseseeswneesewnweenwsweeese +swswswweswswwswwnwswneswswswswwwswsw +neswswswsewswwswswenwswsw +swswwenesesenwnwswswseenwse +nwnenwnwnwswenwnwnwnenwnwnwnwnwnwsenwnwsw +swenwnenwseeenweeeneneeeeeesw +nwnwnwnwnwsenwnwnwnwnwnwnwwnwwnwsenwnwne +eseeeseenwewseeeeeesenweeese +wwwwnwwwnewwwwwwwwwse +seswnesewwneseseseseseseseswsesesesese +seswswswswswswswswseseswswwneswswseswsw +nwnwenenwnenwnwnwenwnwnwnwnwnwnwnwswswnwnw +sesesesenesenwseseseneswwseswsenesewse +neswneswswswwseswwswswwwsenwswneswsww +nwnwwwnwnwwnwsewenwswnenenwnwswsenw +eseseeseseseeneeseseseseeswsese +nwwwnwenwnwnwwnwnwwnwwnwswwnenwnwnw +nwnwnwnwnwnwnwnwnwnwnwnwenwnwwnwwnwsesw +nwneswneneeeeeneseneeeeeesweene +seeseseseweseseeeseseeeesenwse +swneseswswseseeswswneseswswnwswswsewsw +wwnwnwswnwnwnewewnwwwnwwwwswwnwnw +nenenenewnenenwenenene +seseseswswswseseswseswnwsesesesw +senenesweseseweswswswseswsewneesenww +nwsewnwnwnwnwnwnwnwnwnwnenwnenwnwnwnwnw +seeeneenwesweeeese +wswwswwneswwswwswswwwwwsw +eeeseeeeeneneeeeweswnwneeswnwse +senwnenwnenenenwnwnwnwnenenwwnenenw +wwseswswswewnwwewwwwwwneswsw +eeeswseswseenweenweseeseswnenee +eeeeeeeeseeeeeeweneeese +eewenwneneneneswneneswnwsenenw +wenenenenwnwnwnenwswnenwnenwnwnwnwnenwnw +esesesesesenwsewsesesesesesenesesesese +wwwwweswswswww +weswswswswswswwswswswswswneswwswesw +eseseseseswnesesewseseenwswneswseww +seseesewseneeseseeseeseenewsesee +eeneeswenweeneeneeneeswseweene +eneenwnweeeeseeese +neneneneewneneseneneneeneenenewenene +eewsesweneweswnwnesese +ewwswswneswsenwswneswswswseswswwwsw +wnwsenwnwwnewwnwwseswswwewnwwwe +wswwwwwswswswswneswwswswswswwswe +wnwnwnwwwewwwwnwnwnwnw +nwesesenwwenwnwsewneswnenew +nenenenwswnenenenwnwnenenwneneneenenene +nwseswnwwnwnwwnwwnwnwnwnwnwseenwnwnwne +neneenwswwswnenesenwne +seswwseswwweswneswnenenwswsenwswwsw +nwseswswwswswswswnwseswnwwswseswswswsww +wwnewwwewwwwwwnwnwswwwwww +neneswnenwnenenenenenenwneneswnenwnenene +wwnwnwsesenwnwenwnwnwnwnwewnwnwnww +eneenwneneneneeeeneenesweesweee +swsewswwseseswswswseswseseeswswneswswsesw +swewwwwwwnwwswwwewwwnwnwwww +eeesenesewweseneseswweseeeesee +wnwweseenwwwwwnwwnwnwnesenewswse +nenenenenenesewnenenenenenenene +swseswneswneswsewswsesenwswswseseswswsw +wnwwwnwwenwnwswnwnwwnwwnwnwnwww +sewsenweeeseeseeeeeeeesesesee +enwsweweeeeneneeeeneeneswse +nwnwnewnwwnwwnwnwnwwnwnwnwsenwnwnwnw +swswwnesesewnwswswnwswswsewswswnewsw +swnesenwnwnwnwnenenwnw +neseeseseswwnwsenwswseswswnw +swswswneweswnwswwwwwseswwswsw +neneneswnwneneneneneswnenesenenenwnenwne +swseseeewneeseswseseeseneenweese +eseseeeenwseseeesesesee +wwnwwwwwnwwwwwnwwwswnwweew +newneeeneneeneene +swswwwswweswnwswswswswswswswwseswswsw +nwnwnwnwnwnenwneswnwnwsenwenwnwnwnwwnwnwnw +seswwwwwwwnwswwswneswswwswswswsw +neneenesenenweneesewenenweeswee +seseseseseseseseseseseswesesesesenwswse +neeneneenenenenenenesenesweneneeneenw +nwwswseeseewenwnwwewwnwnenwew +neswneneeneneenwnwnenenenwnwnewnenesw +nwesewnwnwnwnwnwnenwnwnw +nwnwnenwewenwnwnesewseswswnwnwenese +swsweswnwswseswnwswswswsweswswswswsesw +eweeneseeneeeeeeseeesweeee +ewsenwnwnwnwswnwnwswsenwnenwswnwnwnwnenw +enesenewwnwwseseswnwseesenenwseesese +wwwwnenwewwnwwwwwwnwwsewwesw +swwswwwseswnesewnew +neewswwsenwwsenwsewnwwnwnenwnwenw +eneneneesweeneneeneeneneenwneee +swswewswswwwswswswswseeswwswswswnwsw +wnenenewwneneesenesenwwsenwenwwsene +nweeswnwnwnwnwswnwnwenwwnenwsesenewnw +enwwwwnwwwwnwwnwnwwwnwwnweswnw +swnwwswswewwswswswnwwnesewwswswsw +nwenwnwwnenwswnwnwwnwnwnenenwneenwnw +neneneneewneneneseneeeneeesweneeee +swwseswwwswnwswwneneseswswewnewswswnw +swsenwneseenwnwnwswnwwnenwwswnenwwwse +nwnenwnwneneswnwnesenenw +sesweswswwsesesenwsewenweswswsese +ewswsenwsewnwsesweseneswswswwne +swseeenweeseneenwsewnw +nwwwewwwwnwwwnwwwwwwwewnw +newsenwneswnwnenwnwnwneenwnwnenwnwnenw +wwwewnwnwnwwwwwnwwwsenwwwnwnw +eseeseewnenewweneswneneeeneewe +swswnwswseswswswswswweswswswswswswswswsw +neeeseeeneeeeweseenwneeeee +enenwwenwnewswewwnwswwswnwswnew +wwwsesesewwwwwnwnwwnewwwwwwne +wwwwwwswswwwwwnenewswswwww +enweseeeeeeneneweeeeenenee +senenenenwnenenenenenewneeswnenenenenene +wnwwwwwwwwwwwswnewnwwwnw +eswwesenweneneeneenwenenenewswse +nwnwnwswnwnwneneneneswnwnw +sewswneswwsenwswwswseswwsweswnwswswsw +wseeneeneseseeseswsesweeseeeneese +nwnwnwswnwnwwwnwneswnwnwnwwwweswnew +seseseseswnwseseseesesesesesesesw +swswswswswnewswwswswswse +senwseseseseseswneseswseseseswwsesesesesw +wenwnwswnenwnwnwsewnwnwesenwwsenenesw +eneneweneeswneeseeeenee +sesewswnwseswswswsewswswseeeneswswene +nwwwnwwwwseewwwenwwwswnwwwwnw +wwswsewwwsenwwesewnwnwnwwnwnewww +seswseseewseswseseseswse +wnwwwnwwwwwswwwnesesewnewnew +swseswseseswswswswswsenwswsesweseswswnwsw +neeeseseseneseswseseeseseseswesesesee +eswnewneseeneenenene +wneneenweesenewneeeesenenee +neswnenwwswswswswswwnenwswseswseesww +nesenwnenwnwswnwnwswnenwnwnenwnw +nenenwneswnenenenenenenwnwnwnwnenwnwswenw +eeseseeeesenwsenweeeesee +esenesesesenesewseswsesesesesesesewsesene +swneneneneneneenenenenenenwnwneneswneneene +seswseseswseswseseseseswseneswswnwseswnw +eswnewneneneeneneneneeneswneswwnwne +nwnenwnwsenwnwnwsewnwnwnwnwnwnwsewnenwnw +neneneneswneesewwenwnesesenwswnwnwnenenw +neneswneenwnewnenenenenenwnenenenenenene +swwweswswweswwwswwswnwwwswnwswww +wwwwswnwwwwwswswse +swswswneswswswswswnwswswswswswswseswswwsw +newsenweneswenenenewneenwsenwwnewnw +eeseneeeweneenee +swswswswswswswsweswswswnwswnwsweswswsw +nwsenwnwnwwnwnenwnwwnwnwnwwswswnewne +enewsewneneeeenenenenenenenenesenene +newneeeeneneeseeenweeeeswee +seeewswwseswwneneswswswswwwswswesw +seseenesesesesesesewse +nwswnwnenwnwnesenwnwnwnenwnenene +eseseseeeeseenwseseeeswsesesenwesee +swnwseswseswnwseeenwswswswsewswesesw +wwwwnwwwswseeswnwwwwwwsw +wsenwwneewnwsww +senewswenesesesweseseeswseseseenesese +nwseseseeseseswseeseesesesenesesenwsw +nwnenwenenwnwwnenwswnwsenwnenw +seseeeeeneewweweeseneeeese +wseswswswnweswwwnwwwswswswwewswswsw +newenwnwnenwnenenwnwnenenwsenesenwswnwne +sweeeeeeneneeeeeneweswnwswe +swnwswenwnwswnenenwneenwnwnwnwnwnwnwnw +nwnwnwnwnwenwnwswnwswnwnwenwnwnwwnwnesese +eswneseenewsewwewsenesenesewneesese +neseeeeseseswsesewseseseewsesenesese +nenwwnesweeeneneneenenwnesw +wneeneesweneenene +eseeweeseseeeneeeeeeeeee +neenwneeweswnwswnwneneneneswewnwnwnese +nenenwnenwnenenenenewnwnwnwnesenenenwnw +neneeneweneseeeneeeneneeeeene +wseesweeeeseseenweeeseseeee +eswnwnewwnwswswewswsw +wewewneswsenenwenewwwwseswww +eswnwenwnwseseseenwnwwnenwnwweseswnwse +wswswswswseewneseswswwenwwneswnwswsee +swswswswenwsenwswswswswseswseswsesesw +nwswewwseenwswneeee +swnwwwnwewesewwenwwwnwwswww +nwnwswnwwnwnwnwwnwnwnwnwenwnwnwnwnwnw +eweseenweenesesee +wsenwnwseswwswswwnenwnweswnwseeewswnw +neeneneneeesweswnenwneneenenweneese +swswseswswswwwswswnwswswwweswwwnww +eeeseseneeweeeeeseenweeese +wswwwwnwnwnwsenenwwnwenw +nwnwnwnwnenwnwwwnwnwswnwswswnwewwe +ewewwwnwwswseseseseeeseneeseee +swwswwwwwwswewwwwwwwwew +seseseeesweswwenwnw +nwnwsewweswnwww +wwnewwwswwwsewswsw +seswwwwswewswwsewwwwwwnewwnww +wwwswnwswwnewwsewwwwwwswew +nwswswnenenwnenwsene +swswsesenwseswsesesweswswswswseswswsw +wwsweeswwwswwswswwnesw +nwnwnwsesesewnwewnwwnewnwwnwnwnwesw +enwwnwswwsweswneswnwwswnweeswsesw +neeeneseseeeenwneeneeeweweese +nwwsenwwnwwnwnwnwnwnwnwnw +nwnwnenwwswnwswnwnesenwnwwnweneewse +sweneswnesenenenewnenenenenwenwnwnenesenw +nwnenweeswnwsesenwnwnwnwnenwwenew +nweseeeseseseeeseseswneswseeeswsenwse +eneneeeneweneesene +nwnwswnenwnwnwnwnenwnwnenwnwsenenwnwwnwnwnw +swweswnwwswwswswneswwswnenwneswewsw +wswwwnwswwsewseewswswswwwwswne +nwnesenenenwewwneneseneneneewnenenese +neswwswswnwwwwswesweswwswswnewswnw +newenesenenwnenwwneswneseeenenwnene +nweswnwneswsenweeeesesesewenwee +nwsenenenenenenwwnenwnwnenenenenenwneneswne +swswswswswsenwneseswswswwswseswswswne +swneswswswswswseswsewswsw +senwesenwnwnwnwnwwnwwnewnwneswnwnwnw +seswseswswseswswseseswnwswnwswswseseese +nenenenenenenenwnwnenwneswnenenwne +nwnwnenwnenwnenwnenenwnwnenenenwneneesw +nwswnwnewnenwenenwnwnesenwnwnwnenenenenwnw +wswnwnewwwnwswsewwnwwswnesene +nwnenwnwnwenwnenwnewnwsenwswswnwwnwnwwnw +wwnewwswswwsewwwswwwsewwwnwww +sewnwenwnwsenewnw +seseseweswwswenenwswneswwswneswswsese +wseseseswsenwswwwnwwnenenenewswsww +nwnwenwnwwnwwwnwnwnwnwnwnwnwnwsenww +wsenewenenenenwneenwneswseenwswnww +seseseseseseswseseeseswseseseseswnwsesw +neenwneeeneseeneseneneeneneenenewe +eseswseseseseseseseesesesewneswnewsesw +eswneeesweswneeeeneeenwnweeeee +seseseswseswwswswswswswneseswnwseswswswswsw +swwwswnesewwwswswswswswwswswswnesew +ewsenenwswswwsewsesesenwsenwseneene +neneneneneenenweneneswnenenenenenewsene +wwenwseweswnwnwwwswwswwwewnew +eneeeenwweneeeeneeeneeeneswe +eenewnwswesenwneeseweeseseeswse +senwseesweseeswsesesesesenweeseesese +wswwsenenwewnwwnesewnwswwwsewnwnw +swneseswswweenwwwwwewwwswwsw diff --git a/day24.clj b/day24.clj new file mode 100644 index 0000000..0e57d2a --- /dev/null +++ b/day24.clj @@ -0,0 +1,57 @@ +(def data + (->> (slurp "day24") + (clojure.string/split-lines))) + +; nw ne 1,-1 1,0 +; w . e 0,-1 0,0 0,1 +; sw se -1,0 -1,1 + +(def dirs + {"e" [0 1] + "se" [-1 1] + "sw" [-1 0] + "w" [0 -1] + "nw" [1 -1] + "ne" [1 0]}) + +(defn pos [l] + (->> l + (re-seq #"e|se|sw|w|nw|ne") + (map dirs) + (apply (partial mapv +)))) + +(def black + (set + (map first (filter (fn [[k v]] (odd? v)) (frequencies (map pos data)))))) + +(count black) +;; => 386 + + +(defn all-neighbours [cell] + (for [offset (vals dirs)] + (map + offset cell))) + +(defn alive-neighbours [cells cell] + (filter cells (all-neighbours cell))) + +(defn dead-neighbours [cells cell] + (filter (complement cells) (all-neighbours cell))) + +(defn regulate [cells] + (filter #(#{1 2} (count (alive-neighbours cells %))) cells)) + +(defn dead-neighbour-cells [cells] + (reduce clojure.set/union (map (partial dead-neighbours cells) cells))) + +(defn reproduce [cells] + (filter #(= 2 (count (alive-neighbours cells %))) (dead-neighbour-cells cells))) + +(defn tick [cells] + (clojure.set/union (set (reproduce cells)) (set (regulate cells)))) + +(->> black + (iterate tick) + (#(nth % 100)) + count) +;; => 4214 diff --git a/day24.ijs b/day24.ijs new file mode 100644 index 0000000..4ceb030 --- /dev/null +++ b/day24.ijs @@ -0,0 +1,6 @@ +split =: 13 : '(-.0,}: y e. ''ns'') <;.1 y' +pos =: [:+/[:>(0 1;_1 1;_1 0;0 _1;1 _1;1 0){~(<;._1' e se sw w nw ne') i. split + ++/2|+/"1 = d=: (pos;._2) 1!:1<'day24' + +NB. part2 TBD |