advent_of_ruby 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/arb +1 -1
- data/data/solutions/reddit/ruby/2015/02.yml +5 -5
- data/data/solutions/reddit/ruby/2015/03.yml +6 -6
- data/data/solutions/reddit/ruby/2015/04.yml +7 -7
- data/data/solutions/reddit/ruby/2015/05.yml +6 -6
- data/data/solutions/reddit/ruby/2015/06.yml +14 -14
- data/data/solutions/reddit/ruby/2015/07.yml +15 -15
- data/data/solutions/reddit/ruby/2015/08.yml +6 -6
- data/data/solutions/reddit/ruby/2015/09.yml +11 -11
- data/data/solutions/reddit/ruby/2015/10.yml +18 -18
- data/data/solutions/reddit/ruby/2015/11.yml +19 -19
- data/data/solutions/reddit/ruby/2015/12.yml +10 -10
- data/data/solutions/reddit/ruby/2015/13.yml +9 -9
- data/data/solutions/reddit/ruby/2015/14.yml +11 -11
- data/data/solutions/reddit/ruby/2015/15.yml +9 -9
- data/data/solutions/reddit/ruby/2015/16.yml +7 -7
- data/data/solutions/reddit/ruby/2015/17.yml +10 -10
- data/data/solutions/reddit/ruby/2015/18.yml +4 -4
- data/data/solutions/reddit/ruby/2015/19.yml +1 -1
- data/data/solutions/reddit/ruby/2015/20.yml +2 -2
- data/data/solutions/reddit/ruby/2015/21.yml +4 -4
- data/data/solutions/reddit/ruby/2015/22.yml +5 -5
- data/data/solutions/reddit/ruby/2015/23.yml +3 -3
- data/data/solutions/reddit/ruby/2015/24.yml +11 -11
- data/data/solutions/reddit/ruby/2015/25.yml +5 -5
- data/data/solutions/reddit/ruby/2016/01.yml +5 -5
- data/data/solutions/reddit/ruby/2016/02.yml +3 -3
- data/data/solutions/reddit/ruby/2016/03.yml +1 -1
- data/data/solutions/reddit/ruby/2016/04.yml +4 -4
- data/data/solutions/reddit/ruby/2016/05.yml +3 -3
- data/data/solutions/reddit/ruby/2016/06.yml +4 -4
- data/data/solutions/reddit/ruby/2016/07.yml +3 -3
- data/data/solutions/reddit/ruby/2016/08.yml +6 -6
- data/data/solutions/reddit/ruby/2016/09.yml +1 -1
- data/data/solutions/reddit/ruby/2016/10.yml +3 -3
- data/data/solutions/reddit/ruby/2016/11.yml +1 -1
- data/data/solutions/reddit/ruby/2016/12.yml +3 -3
- data/data/solutions/reddit/ruby/2016/14.yml +4 -4
- data/data/solutions/reddit/ruby/2016/15.yml +11 -11
- data/data/solutions/reddit/ruby/2016/16.yml +1 -1
- data/data/solutions/reddit/ruby/2016/17.yml +3 -3
- data/data/solutions/reddit/ruby/2016/18.yml +3 -3
- data/data/solutions/reddit/ruby/2016/20.yml +2 -2
- data/data/solutions/reddit/ruby/2016/21.yml +7 -7
- data/data/solutions/reddit/ruby/2016/22.yml +10 -10
- data/data/solutions/reddit/ruby/2017/01.yml +7 -7
- data/data/solutions/reddit/ruby/2017/02.yml +15 -15
- data/data/solutions/reddit/ruby/2017/03.yml +9 -9
- data/data/solutions/reddit/ruby/2017/04.yml +4 -4
- data/data/solutions/reddit/ruby/2017/05.yml +12 -12
- data/data/solutions/reddit/ruby/2017/06.yml +16 -16
- data/data/solutions/reddit/ruby/2017/07.yml +5 -5
- data/data/solutions/reddit/ruby/2017/08.yml +18 -18
- data/data/solutions/reddit/ruby/2017/09.yml +7 -7
- data/data/solutions/reddit/ruby/2017/10.yml +9 -9
- data/data/solutions/reddit/ruby/2017/11.yml +1 -1
- data/data/solutions/reddit/ruby/2017/12.yml +6 -6
- data/data/solutions/reddit/ruby/2017/13.yml +6 -6
- data/data/solutions/reddit/ruby/2017/14.yml +1 -1
- data/data/solutions/reddit/ruby/2017/15.yml +3 -3
- data/data/solutions/reddit/ruby/2017/16.yml +5 -5
- data/data/solutions/reddit/ruby/2017/17.yml +6 -6
- data/data/solutions/reddit/ruby/2017/18.yml +7 -7
- data/data/solutions/reddit/ruby/2017/19.yml +2 -2
- data/data/solutions/reddit/ruby/2017/20.yml +5 -5
- data/data/solutions/reddit/ruby/2017/21.yml +11 -11
- data/data/solutions/reddit/ruby/2017/22.yml +1 -1
- data/data/solutions/reddit/ruby/2017/23.yml +1 -1
- data/data/solutions/reddit/ruby/2017/25.yml +3 -3
- data/data/solutions/reddit/ruby/2018/01.yml +20 -20
- data/data/solutions/reddit/ruby/2018/02.yml +16 -16
- data/data/solutions/reddit/ruby/2018/03.yml +12 -12
- data/data/solutions/reddit/ruby/2018/04.yml +6 -6
- data/data/solutions/reddit/ruby/2018/05.yml +15 -15
- data/data/solutions/reddit/ruby/2018/06.yml +4 -4
- data/data/solutions/reddit/ruby/2018/07.yml +11 -11
- data/data/solutions/reddit/ruby/2018/08.yml +9 -9
- data/data/solutions/reddit/ruby/2018/09.yml +13 -13
- data/data/solutions/reddit/ruby/2018/10.yml +10 -10
- data/data/solutions/reddit/ruby/2018/11.yml +9 -9
- data/data/solutions/reddit/ruby/2018/12.yml +2 -2
- data/data/solutions/reddit/ruby/2018/13.yml +14 -14
- data/data/solutions/reddit/ruby/2018/14.yml +5 -5
- data/data/solutions/reddit/ruby/2018/15.yml +2 -2
- data/data/solutions/reddit/ruby/2018/16.yml +7 -7
- data/data/solutions/reddit/ruby/2018/17.yml +1 -1
- data/data/solutions/reddit/ruby/2018/18.yml +6 -6
- data/data/solutions/reddit/ruby/2018/19.yml +1 -1
- data/data/solutions/reddit/ruby/2018/20.yml +1 -1
- data/data/solutions/reddit/ruby/2018/21.yml +4 -4
- data/data/solutions/reddit/ruby/2018/22.yml +3 -3
- data/data/solutions/reddit/ruby/2018/23.yml +11 -11
- data/data/solutions/reddit/ruby/2018/24.yml +4 -4
- data/data/solutions/reddit/ruby/2018/25.yml +6 -6
- data/data/solutions/reddit/ruby/2019/01.yml +11 -11
- data/data/solutions/reddit/ruby/2019/02.yml +13 -13
- data/data/solutions/reddit/ruby/2019/03.yml +7 -7
- data/data/solutions/reddit/ruby/2019/04.yml +11 -11
- data/data/solutions/reddit/ruby/2019/05.yml +10 -10
- data/data/solutions/reddit/ruby/2019/06.yml +7 -7
- data/data/solutions/reddit/ruby/2019/07.yml +8 -8
- data/data/solutions/reddit/ruby/2019/08.yml +8 -8
- data/data/solutions/reddit/ruby/2019/09.yml +4 -4
- data/data/solutions/reddit/ruby/2019/10.yml +4 -4
- data/data/solutions/reddit/ruby/2019/11.yml +7 -7
- data/data/solutions/reddit/ruby/2019/12.yml +17 -17
- data/data/solutions/reddit/ruby/2019/13.yml +6 -6
- data/data/solutions/reddit/ruby/2019/14.yml +2 -2
- data/data/solutions/reddit/ruby/2019/15.yml +3 -3
- data/data/solutions/reddit/ruby/2019/16.yml +6 -6
- data/data/solutions/reddit/ruby/2019/17.yml +3 -3
- data/data/solutions/reddit/ruby/2019/18.yml +1 -1
- data/data/solutions/reddit/ruby/2019/20.yml +9 -9
- data/data/solutions/reddit/ruby/2019/21.yml +3 -3
- data/data/solutions/reddit/ruby/2019/22.yml +3 -3
- data/data/solutions/reddit/ruby/2019/23.yml +1 -1
- data/data/solutions/reddit/ruby/2019/25.yml +2 -2
- data/data/solutions/reddit/ruby/2020/01.yml +30 -30
- data/data/solutions/reddit/ruby/2020/02.yml +25 -25
- data/data/solutions/reddit/ruby/2020/03.yml +17 -17
- data/data/solutions/reddit/ruby/2020/04.yml +26 -26
- data/data/solutions/reddit/ruby/2020/05.yml +35 -35
- data/data/solutions/reddit/ruby/2020/06.yml +40 -40
- data/data/solutions/reddit/ruby/2020/07.yml +16 -16
- data/data/solutions/reddit/ruby/2020/08.yml +13 -13
- data/data/solutions/reddit/ruby/2020/09.yml +21 -21
- data/data/solutions/reddit/ruby/2020/10.yml +29 -29
- data/data/solutions/reddit/ruby/2020/11.yml +8 -8
- data/data/solutions/reddit/ruby/2020/12.yml +22 -22
- data/data/solutions/reddit/ruby/2020/13.yml +15 -15
- data/data/solutions/reddit/ruby/2020/14.yml +11 -11
- data/data/solutions/reddit/ruby/2020/15.yml +9 -9
- data/data/solutions/reddit/ruby/2020/16.yml +13 -13
- data/data/solutions/reddit/ruby/2020/17.yml +11 -11
- data/data/solutions/reddit/ruby/2020/18.yml +19 -19
- data/data/solutions/reddit/ruby/2020/19.yml +18 -18
- data/data/solutions/reddit/ruby/2020/20.yml +4 -4
- data/data/solutions/reddit/ruby/2020/21.yml +4 -4
- data/data/solutions/reddit/ruby/2020/22.yml +8 -8
- data/data/solutions/reddit/ruby/2020/23.yml +4 -4
- data/data/solutions/reddit/ruby/2020/24.yml +6 -6
- data/data/solutions/reddit/ruby/2020/25.yml +6 -6
- data/data/solutions/reddit/ruby/2021/01.yml +74 -74
- data/data/solutions/reddit/ruby/2021/02.yml +45 -45
- data/data/solutions/reddit/ruby/2021/03.yml +43 -43
- data/data/solutions/reddit/ruby/2021/04.yml +23 -23
- data/data/solutions/reddit/ruby/2021/05.yml +16 -16
- data/data/solutions/reddit/ruby/2021/06.yml +35 -35
- data/data/solutions/reddit/ruby/2021/07.yml +26 -26
- data/data/solutions/reddit/ruby/2021/08.yml +15 -15
- data/data/solutions/reddit/ruby/2021/09.yml +11 -11
- data/data/solutions/reddit/ruby/2021/10.yml +9 -9
- data/data/solutions/reddit/ruby/2021/11.yml +12 -12
- data/data/solutions/reddit/ruby/2021/12.yml +8 -8
- data/data/solutions/reddit/ruby/2021/13.yml +13 -13
- data/data/solutions/reddit/ruby/2021/14.yml +10 -10
- data/data/solutions/reddit/ruby/2021/15.yml +10 -10
- data/data/solutions/reddit/ruby/2021/16.yml +8 -8
- data/data/solutions/reddit/ruby/2021/17.yml +6 -6
- data/data/solutions/reddit/ruby/2021/18.yml +5 -5
- data/data/solutions/reddit/ruby/2021/19.yml +3 -3
- data/data/solutions/reddit/ruby/2021/20.yml +5 -5
- data/data/solutions/reddit/ruby/2021/21.yml +5 -5
- data/data/solutions/reddit/ruby/2021/22.yml +4 -4
- data/data/solutions/reddit/ruby/2021/23.yml +7 -7
- data/data/solutions/reddit/ruby/2021/24.yml +8 -8
- data/data/solutions/reddit/ruby/2021/25.yml +4 -4
- data/data/solutions/reddit/ruby/2022/01.yml +29 -29
- data/data/solutions/reddit/ruby/2022/02.yml +21 -21
- data/data/solutions/reddit/ruby/2022/03.yml +35 -35
- data/data/solutions/reddit/ruby/2022/04.yml +42 -42
- data/data/solutions/reddit/ruby/2022/05.yml +29 -29
- data/data/solutions/reddit/ruby/2022/06.yml +38 -38
- data/data/solutions/reddit/ruby/2022/07.yml +25 -25
- data/data/solutions/reddit/ruby/2022/08.yml +9 -9
- data/data/solutions/reddit/ruby/2022/09.yml +18 -18
- data/data/solutions/reddit/ruby/2022/10.yml +14 -14
- data/data/solutions/reddit/ruby/2022/11.yml +7 -7
- data/data/solutions/reddit/ruby/2022/12.yml +2 -2
- data/data/solutions/reddit/ruby/2022/13.yml +9 -9
- data/data/solutions/reddit/ruby/2022/14.yml +5 -5
- data/data/solutions/reddit/ruby/2022/15.yml +6 -6
- data/data/solutions/reddit/ruby/2022/16.yml +5 -5
- data/data/solutions/reddit/ruby/2022/17.yml +2 -2
- data/data/solutions/reddit/ruby/2022/18.yml +6 -6
- data/data/solutions/reddit/ruby/2022/19.yml +3 -3
- data/data/solutions/reddit/ruby/2022/20.yml +12 -12
- data/data/solutions/reddit/ruby/2022/21.yml +11 -11
- data/data/solutions/reddit/ruby/2022/22.yml +4 -4
- data/data/solutions/reddit/ruby/2022/24.yml +10 -10
- data/data/solutions/reddit/ruby/2022/25.yml +10 -10
- data/data/solutions/reddit/ruby/2023/01.yml +52 -52
- data/data/solutions/reddit/ruby/2023/02.yml +21 -21
- data/data/solutions/reddit/ruby/2023/03.yml +18 -18
- data/data/solutions/reddit/ruby/2023/04.yml +31 -31
- data/data/solutions/reddit/ruby/2023/05.yml +14 -14
- data/data/solutions/reddit/ruby/2023/06.yml +24 -24
- data/data/solutions/reddit/ruby/2023/07.yml +32 -32
- data/data/solutions/reddit/ruby/2023/08.yml +20 -20
- data/data/solutions/reddit/ruby/2023/09.yml +32 -32
- data/data/solutions/reddit/ruby/2023/10.yml +18 -18
- data/data/solutions/reddit/ruby/2023/11.yml +16 -16
- data/data/solutions/reddit/ruby/2023/12.yml +5 -5
- data/data/solutions/reddit/ruby/2023/13.yml +6 -6
- data/data/solutions/reddit/ruby/2023/14.yml +14 -14
- data/data/solutions/reddit/ruby/2023/15.yml +13 -13
- data/data/solutions/reddit/ruby/2023/16.yml +8 -8
- data/data/solutions/reddit/ruby/2023/18.yml +5 -5
- data/data/solutions/reddit/ruby/2023/19.yml +6 -6
- data/data/solutions/reddit/ruby/2023/20.yml +9 -9
- data/data/solutions/reddit/ruby/2023/21.yml +5 -5
- data/data/solutions/reddit/ruby/2023/22.yml +2 -2
- data/data/solutions/reddit/ruby/2023/23.yml +1 -1
- data/data/solutions/reddit/ruby/2023/25.yml +1 -1
- data/data/solutions/reddit/ruby/2024/01.yml +15 -15
- data/data/solutions/reddit/ruby/2024/02.yml +17 -17
- data/data/solutions/reddit/ruby/2024/03.yml +43 -43
- data/data/solutions/reddit/ruby/2024/04.yml +18 -18
- data/data/solutions/reddit/ruby/2024/05.yml +29 -29
- data/data/solutions/reddit/ruby/2024/06.yml +19 -19
- data/data/solutions/reddit/ruby/2024/07.yml +26 -26
- data/data/solutions/reddit/ruby/2024/08.yml +15 -15
- data/data/solutions/reddit/ruby/2024/09.yml +5 -5
- data/data/solutions/reddit/ruby/2024/10.yml +9 -9
- data/data/solutions/reddit/ruby/2024/11.yml +15 -15
- data/data/solutions/reddit/ruby/2024/12.yml +9 -9
- data/data/solutions/reddit/ruby/2024/13.yml +10 -10
- data/data/solutions/reddit/ruby/2024/14.yml +6 -6
- data/data/solutions/reddit/ruby/2024/15.yml +5 -5
- data/data/solutions/reddit/ruby/2024/16.yml +4 -4
- data/data/solutions/reddit/ruby/2024/17.yml +11 -11
- data/data/solutions/reddit/ruby/2024/18.yml +9 -9
- data/data/solutions/reddit/ruby/2024/19.yml +16 -16
- data/data/solutions/reddit/ruby/2024/20.yml +8 -8
- data/data/solutions/reddit/ruby/2024/21.yml +3 -3
- data/data/solutions/reddit/ruby/2024/22.yml +8 -8
- data/data/solutions/reddit/ruby/2024/23.yml +13 -13
- data/data/solutions/reddit/ruby/2024/24.yml +7 -7
- data/data/solutions/reddit/ruby/2024/25.yml +14 -14
- data/lib/arb/api/aoc.rb +2 -2
- data/lib/arb/cli/run.rb +2 -3
- data/lib/arb/version.rb +1 -1
- data/lib/download_solutions/api/reddit/get_serial_comments.rb +1 -1
- metadata +2 -2
@@ -1,42 +1,42 @@
|
|
1
1
|
---
|
2
2
|
- :author: ignurant
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/hocnwwo
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/hocnwwo
|
4
4
|
:body: |-
|
5
5
|
I found this to be a great way to learn and improve recursive functions. I still have a ways to go, but I got there. Barely!
|
6
6
|
|
7
7
|
[Ruby @ github](https://github.com/ttilberg/advent-of-code-2021-rb/blob/main/2021/12/2.rb)
|
8
8
|
:replies: []
|
9
9
|
- :author: JRX71
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho92eff
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho92eff
|
11
11
|
:body: "[Ruby](https://gist.github.com/JX71/3d92a1833fcc26ad96e779213d2e6de8) attempt to be readable (part 2 only)"
|
12
12
|
:replies: []
|
13
13
|
- :author: SnooConfections2453
|
14
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho93rd3
|
14
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho93rd3
|
15
15
|
:body: 'My solution in 50 lines of ruby: https://github.com/ciscou/aoc/blob/master/2021/12.rb'
|
16
16
|
:replies: []
|
17
17
|
- :author: AMusingMule
|
18
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/hoa347u
|
18
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/hoa347u
|
19
19
|
:body: |-
|
20
20
|
# [Ruby](https://gist.github.com/kaine119/8bec5cbe2d97868da16a84744e5b7e38)
|
21
21
|
|
22
22
|
Simple recursive DFS solution. I kinda cheesed part 2 by running it once per lowercase node to allow one duplication of said node; it takes a solid 1s longer to run than part 1. It's not very efficient because of all the duplicate paths, but I couldn't think of anything else.
|
23
23
|
:replies:
|
24
24
|
- :author: ignurant
|
25
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/hocnsge
|
25
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/hocnsge
|
26
26
|
:body: |-
|
27
27
|
Thanks for sharing. I was having a hard time figuring out how to resolve completed routes in the recursive function. I’m not fluent with building up recursive stuff, but I figured it was something like what you had (building up another argument for completed routes). I tried something similar to that, but ended up having an issue where only one route per top level iteration was returning. I couldn’t figure out the “return completed and this route” at the exit clause, and then also return the completed routes at the bottom. Getting closer!
|
28
28
|
|
29
29
|
Anyway, here was my solution where I mapped in order to resolve that problem, and then had to write a recursive “untangle the mess function” haha: https://github.com/ttilberg/advent-of-code-2021-rb/blob/main/2021/12/2.rb
|
30
30
|
:replies: []
|
31
31
|
- :author: frontpageminus
|
32
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho7pzfq
|
32
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho7pzfq
|
33
33
|
:body: |-
|
34
34
|
Ruby 1099/850
|
35
35
|
|
36
36
|
[paste](https://topaz.github.io/paste/#XQAAAQDVBAAAAAAAAAA5GUqKNoFH6SMqoVC09YWR20g6Fjy4njtAfnTDe/6u+Gn6Hao+wfKaqM0wJb78UXSXizCPo0tcdH0rfhLBF6BTkXIFTL6rf7HEcSdt5ZfjquN7hRg1AhqdG//1XW/PovXWc9z7V6w0l8vDPMoWsQzxkK7SDwijpdVfBFBPsvpjfiY2EUF+A3TmE8Pr1J3s3tkCjFbOuNKZ+Clq7D1gkhjTKsfTzUAuJ93MJOwEufcbRVFsz8l3LyL7Citin18CKKZiaqxWbKMTiUiQW+rNncoMojomjGzddZ2upJCmH7xGyf5eXEOv1/xl116tJ1mWxPDzqNAlOAVx3rR4tkskw6EKaGzeIdcy1a9sdgBSqaeIVC5dTWGPW7BzcQf0/mpZUK1/TVeLqNgTK+CEX6ulmeTFQeabAiBHRs4Zr7tOWU2DuYzmPDOPHFKmt8Pkoeobpn8naMoOpO94k2fSPOefcwuTsWdAfrtuvxVgx7ZsuRLeqrNq7Dd1rTVXOmyKLk5mKX20tjcnzlRPwGzXz7Uej5XTgVe5cPzllibf5EZ9/++jv6k=)
|
37
37
|
:replies: []
|
38
38
|
- :author: MuumiJumala
|
39
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho7rg14
|
39
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho7rg14
|
40
40
|
:body: |-
|
41
41
|
Recursive Ruby solution (296/458):
|
42
42
|
|
@@ -69,7 +69,7 @@
|
|
69
69
|
```
|
70
70
|
:replies: []
|
71
71
|
- :author: dhruvasagar
|
72
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho8030p
|
72
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rehj2r/2021_day_12_solutions/ho8030p
|
73
73
|
:body: |-
|
74
74
|
Nice and easy
|
75
75
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: CodeIsTheEnd
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hohjrdx
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hohjrdx
|
4
4
|
:body: |-
|
5
5
|
**Ruby** : _Unofficial_ 5:07/7:04, which would have been good for 49th and 21st on the leaderboard
|
6
6
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
My biggest time loss was from accidentally deleting a line from my stub file.
|
12
12
|
:replies: []
|
13
13
|
- :author: blackbunbun
|
14
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hogogq8
|
14
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hogogq8
|
15
15
|
:body: |-
|
16
16
|
**Ruby**
|
17
17
|
|
@@ -49,7 +49,7 @@
|
|
49
49
|
```
|
50
50
|
:replies: []
|
51
51
|
- :author: tom_collier2002
|
52
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoe3xs1
|
52
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoe3xs1
|
53
53
|
:body: |-
|
54
54
|
[Ruby solution using complex numbers](https://github.com/tcollier/aoc_solutions/blob/main/2021/13/main.rb)
|
55
55
|
|
@@ -72,7 +72,7 @@
|
|
72
72
|
Lots of people were struggling reading the output for part 2 when printing with `#` and `.` characters, so I wrote [my own OCR](https://github.com/tcollier/aoc_solutions/blob/main/2021/13/ocr.rb). Granted I made up a few of the characters (`M` and `W` ain't looking too hot), so I can't guarantee it'll work for every input.
|
73
73
|
:replies:
|
74
74
|
- :author: tom_collier2002
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoe6461
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoe6461
|
76
76
|
:body: |-
|
77
77
|
The complex conjugate reflects the point around the real axis (`a + bi` become `a - bi`). The folding `axis` in my code is either purely real or purely imaginary (`a + 0i` or `0 + bi`) and `2 * axis` is effectively the far end of the paper that will be folded over.
|
78
78
|
|
@@ -81,7 +81,7 @@
|
|
81
81
|
The math for folding in the `x` direction (`axis.real.between?(1, dot.real)`) is similar. However, we need to reflect the dot around the _imaginary_ axis. To accomplish this we can rotate the complex conjugate `π` radians. Multiply a complex number by `i` rotates the number by `π/2` radians, we need to do that twice (`i * i`), which is the same as multiplying by `-1`.
|
82
82
|
:replies: []
|
83
83
|
- :author: tom_collier2002
|
84
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoe7evc
|
84
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoe7evc
|
85
85
|
:body: |-
|
86
86
|
I wrote the OCR code after initially printing out the result using `#` and `.` characters. It felt like reading a Captcha (Is that a `U` or a `V`?! I sweat I'm not a bot!). A few coworkers also posted their part 2 results in a similar format, which gave me examples of roughly half the alphabet to "train" my OCR code with. About half of the remaining letters were pretty easy to guess at (though they could still be wrong).
|
87
87
|
|
@@ -90,7 +90,7 @@
|
|
90
90
|
Edit: the OCR fails on the sample input as the `O` character has a width of 5 pixels :(
|
91
91
|
:replies: []
|
92
92
|
- :author: kejadlen
|
93
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hociv59
|
93
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hociv59
|
94
94
|
:body: |-
|
95
95
|
Ruby:
|
96
96
|
|
@@ -116,7 +116,7 @@
|
|
116
116
|
```
|
117
117
|
:replies: []
|
118
118
|
- :author: ignurant
|
119
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hodvyvn
|
119
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hodvyvn
|
120
120
|
:body: |-
|
121
121
|
**Ruby** :
|
122
122
|
|
@@ -163,7 +163,7 @@
|
|
163
163
|
```
|
164
164
|
:replies: []
|
165
165
|
- :author: dtinth
|
166
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocf83u
|
166
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocf83u
|
167
167
|
:body: |-
|
168
168
|
Ruby, 46 / 10
|
169
169
|
|
@@ -173,11 +173,11 @@
|
|
173
173
|
- I spent quite some time writing the `plot[]` function while working on part 1. Glad to see it came really handy in part 2.
|
174
174
|
:replies: []
|
175
175
|
- :author: dhruvasagar
|
176
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hociz5m
|
176
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hociz5m
|
177
177
|
:body: Yay! [Ruby](https://github.com/dhruvasagar/comp/blob/master/adventofcode/2021/day13/day13.rb)
|
178
178
|
:replies: []
|
179
179
|
- :author: p_tseng
|
180
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocka3h
|
180
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocka3h
|
181
181
|
:body: |-
|
182
182
|
### Ruby
|
183
183
|
|
@@ -209,7 +209,7 @@
|
|
209
209
|
Full code at https://github.com/petertseng/adventofcode-hs-2021/blob/master/bin/13_transparent_origami.hs
|
210
210
|
:replies:
|
211
211
|
- :author: Sharparam
|
212
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocn7yo
|
212
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocn7yo
|
213
213
|
:body: |-
|
214
214
|
TIL about `Hash.transform_keys`.
|
215
215
|
|
@@ -218,7 +218,7 @@
|
|
218
218
|
(The commit history for that file shows a bit of how it changed since initial solve.)
|
219
219
|
:replies: []
|
220
220
|
- :author: scarfaceDeb
|
221
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocqo2l
|
221
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hocqo2l
|
222
222
|
:body: |-
|
223
223
|
**Ruby**
|
224
224
|
|
@@ -227,7 +227,7 @@
|
|
227
227
|
https://github.com/scarfacedeb/advent-of-code/blob/master/2021/day13/run.rb#L3-L80
|
228
228
|
:replies: []
|
229
229
|
- :author: marshalofthemark
|
230
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoctwgk
|
230
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rf7onx/2021_day_13_solutions/hoctwgk
|
231
231
|
:body: |-
|
232
232
|
**Ruby**
|
233
233
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Jomy10
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hy8o0n7
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hy8o0n7
|
4
4
|
:body: |-
|
5
5
|
## Ruby
|
6
6
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
[Script for calculating both parts](https://github.com/Jomy10/Advent-Of-Code-2021/blob/master/day14/main.sh)
|
12
12
|
:replies: []
|
13
13
|
- :author: tom_collier2002
|
14
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hoky675
|
14
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hoky675
|
15
15
|
:body: |-
|
16
16
|
[Ruby solution](https://github.com/tcollier/aoc_solutions/blob/main/2021/14/main.rb) optimized (~8ms to print both parts) by precomputing 41,000 values
|
17
17
|
|
@@ -40,7 +40,7 @@
|
|
40
40
|
With these counts, it's trivial to find the difference between the highest and lowest character counts.
|
41
41
|
:replies: []
|
42
42
|
- :author: el_daniero
|
43
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hokk7yj
|
43
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hokk7yj
|
44
44
|
:body: |-
|
45
45
|
A little late to the party, but when I read today's part 1 I just _knew_ what was comming in part 2. I'm usually not too quick at spotting a fast solution for these kinda problems, but I'm pleased that this one struck me pretty quickly. It's this year's least aesthetically pleasing code so far, though.
|
46
46
|
|
@@ -77,7 +77,7 @@
|
|
77
77
|
```
|
78
78
|
:replies: []
|
79
79
|
- :author: dtinth
|
80
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hoh5uwe
|
80
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hoh5uwe
|
81
81
|
:body: |-
|
82
82
|
Ruby, 45 / 60
|
83
83
|
|
@@ -86,11 +86,11 @@
|
|
86
86
|
`each_cons(2)` helps quite a lot in solving this.
|
87
87
|
:replies: []
|
88
88
|
- :author: mxBug
|
89
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohnxwl
|
89
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohnxwl
|
90
90
|
:body: "[ruby but OOPy](https://topaz.github.io/paste/#XQAAAQAWBAAAAAAAAAA0m4poOBCMftdkRQiciXYGFBdLcr8czW9TZUkh6Ogb11apudi2OZNyqfLGru4I+laPGJe60A1OZ+sy5KmHgPZo3L2nOHKh4zJrxOfv4igKmXz4gkuPfTPs/CmNtvCUbrYio0YiHj7G8qoywgl/zc+Kw4khjnTUe6SEHFCmNmp/R6MOtkRguw9rAScmnMqk7iSFwSr0D9ywr3M3Dhp6XInreVSl6Q2od3zq1Q3iCLPXbKY5mikOYvdUvp3QPA8YGMxy3jIFTf+Li1spvwRWj9pCEHYfzs1Y52bUzm32mL1VQXXXSmKGUbToGXRlEcByeDYdz3J5GeT+r9Npd+8ItLs/XVo68N8IQkT1mcUZN9RXfphWV/C00K4oyNkReR2+zflDyMT1FW1AvoxtlxJHlSpt9n+EaCQzWU/8s9rciVDkkMqOQXcKVN/nvs/sYnS/iVrUL1UL4WDN1EtItA6UNeNr1SuDn2XT1Tv20kq0jPLSE+5HP184vFic7FVjYyNVIXAuVCWeuhJOdi64f4YjxIKJecOtm7P2LG79zwqjswgFXAOlaEP6/5fGdgssK7M0+j/lPv98nzYA)"
|
91
91
|
:replies: []
|
92
92
|
- :author: '442401'
|
93
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohtwll
|
93
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohtwll
|
94
94
|
:body: |-
|
95
95
|
[**Ruby**](https://topaz.github.io/paste/#XQAAAQDHAwAAAAAAAAA4G8nPaRVx/o1ZZYKycGL0SspRCXDQTQUVmHvXfVLEqraSWb0elNeZvnSclxpoFwVtzGktWmOe/XRTtEUmBAOBYzfSLnqEuShWc7DJrSu/wnPgm5XHzf4ctTUjOJhE1iC3FndYgzu3V2InBzTUhniHJP7rQreNtZQB5QWeHZ31bmzByLve13RoeaZt5XSmXhW9Pb/IE1pIlwmTIrQQSKCY0BgD+vhhAtmITSlv3PocxzxYS2LC55RCSGutN6OXlsCCDP/kZ3pIP79XYyqfnmZMgXD7W/6TXztLcx3Dup5qlr8zQxhIJ7C/D1n4o6rQSEDUS5wuY30dvfirzIjzf4pMjifsLJYeaZAyulqxCJBaIZYWP/YFfdWM4JlBKlN+RWgDJYVHvMAyMKsQ34L2HMk8vdB5U9yeFaHJwuCs9qNhumZ1SkclHblRBmB0kFBdWx/Sj/0k5+tGMKPE4+z195Mhn/p1RV9ZJt6wRcFJPo552hzd8IywsjWu+3E1iasGYKOfqHFo3mcjGyTS9IjHisWwqxbTivh6ii//tZt3Pg==)
|
96
96
|
|
@@ -99,7 +99,7 @@
|
|
99
99
|
Thanks to /u/Divritenis for the [hint](https://www.reddit.com/r/adventofcode/comments/rg23lu/2021_day_14_part_2_awk_spoilers_part_2_working/hohm0kb/).
|
100
100
|
:replies: []
|
101
101
|
- :author: weiss_i_net
|
102
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hoikmis
|
102
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hoikmis
|
103
103
|
:body: |-
|
104
104
|
**Ruby**
|
105
105
|
|
@@ -128,7 +128,7 @@
|
|
128
128
|
```
|
129
129
|
:replies: []
|
130
130
|
- :author: CodeIsTheEnd
|
131
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohjjhw
|
131
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohjjhw
|
132
132
|
:body: |-
|
133
133
|
**Ruby** : 4:25/18:50, 63/293
|
134
134
|
|
@@ -139,7 +139,7 @@
|
|
139
139
|
I felt pretty good about Part 2, but then I reused a variable name from Part 1 and so everything was broken for a while and I got pretty mixed up trying to fix that. Oh well.
|
140
140
|
:replies: []
|
141
141
|
- :author: "[deleted]"
|
142
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hojriug
|
142
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hojriug
|
143
143
|
:body: |-
|
144
144
|
Ruby
|
145
145
|
|
@@ -152,7 +152,7 @@
|
|
152
152
|
Range (min … max): 151.7 ms … 291.2 ms 13 runs
|
153
153
|
:replies: []
|
154
154
|
- :author: ni3t
|
155
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohc55j
|
155
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rfzq6f/2021_day_14_solutions/hohc55j
|
156
156
|
:body: |-
|
157
157
|
### Ruby
|
158
158
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: icyFur
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homktk6
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homktk6
|
4
4
|
:body: |-
|
5
5
|
Ruby Dijkstra solution
|
6
6
|
|
7
7
|
[Part One](https://getsturdy.com/advent-of-code-2021-uoeIDQk/browse/day15/kiril/solve.rb)
|
8
8
|
:replies: []
|
9
9
|
- :author: kateba72
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/honpqzq
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/honpqzq
|
11
11
|
:body: |-
|
12
12
|
**Ruby** (the second time I'm posting this, because the first solution didn't work for all inputs)
|
13
13
|
|
@@ -63,7 +63,7 @@
|
|
63
63
|
Full code [here](https://github.com/Kateba72/advent_of_code/blob/main/2021/15.rb) if someone is interested
|
64
64
|
:replies: []
|
65
65
|
- :author: el_daniero
|
66
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/honys08
|
66
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/honys08
|
67
67
|
:body: |-
|
68
68
|
[Pretty straightforward A\* in Ruby](https://github.com/daniero/code-challenges/blob/master/aoc2021/ruby/15.rb#L5) using PQueue.
|
69
69
|
|
@@ -84,7 +84,7 @@
|
|
84
84
|
```
|
85
85
|
:replies: []
|
86
86
|
- :author: groys
|
87
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homgp6o
|
87
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homgp6o
|
88
88
|
:body: |-
|
89
89
|
[Ruby Solution without Dijsktra](https://github.com/groys/AOC/blob/main/2021/day15.rb)
|
90
90
|
|
@@ -99,11 +99,11 @@
|
|
99
99
|
4. mind the 0, 0 vertex to not add its cost
|
100
100
|
:replies:
|
101
101
|
- :author: Tankznor
|
102
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homl7qa
|
102
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homl7qa
|
103
103
|
:body: I was thinking to start at the end, but does it really matter? Ended up with a dynamic programming solution starting at the top.
|
104
104
|
:replies: []
|
105
105
|
- :author: firetech_SE
|
106
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homt4gf
|
106
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homt4gf
|
107
107
|
:body: |-
|
108
108
|
[Ruby](https://github.com/firetech/advent-of-code/blob/%F0%9F%8E%84/2021/15/chitons.rb) (295/399)
|
109
109
|
|
@@ -112,7 +112,7 @@
|
|
112
112
|
\*) Yes, I know that implementation isn't super effective, but it does the job. Not much slower than other implementations I've tried, and it doesn't require any external libraries.
|
113
113
|
:replies: []
|
114
114
|
- :author: CodeIsTheEnd
|
115
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/hom7063
|
115
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/hom7063
|
116
116
|
:body: |-
|
117
117
|
**Ruby** : 14:12/59:50, 703/1949
|
118
118
|
|
@@ -123,14 +123,14 @@
|
|
123
123
|
Initial dynamic programming for Part 1 went not very well, and then my Djikstra half-implementation went even worse - wasn't really sure how to use a heap in Ruby.
|
124
124
|
:replies:
|
125
125
|
- :author: four_father
|
126
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homacx8
|
126
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homacx8
|
127
127
|
:body: recording works but the github is a 404. did you forget to push?
|
128
128
|
:replies:
|
129
129
|
- :author: CodeIsTheEnd
|
130
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homhn7l
|
130
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homhn7l
|
131
131
|
:body: Oops, thanks, fixed.
|
132
132
|
:replies: []
|
133
133
|
- :author: phord
|
134
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homjx56
|
134
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rgqzt5/2021_day_15_solutions/homjx56
|
135
135
|
:body: I noticed the part 1 example was solveable with only right and down, but I assumed that was because of the size and the easing us in. I knew part 2 was going to bring the variety. Actually I was worried they were going to add diagonals.
|
136
136
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: weiss_i_net
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/houksni
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/houksni
|
4
4
|
:body: |-
|
5
5
|
**Ruby**
|
6
6
|
|
@@ -63,7 +63,7 @@
|
|
63
63
|
```
|
64
64
|
:replies: []
|
65
65
|
- :author: CodeIsTheEnd
|
66
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hor34iu
|
66
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hor34iu
|
67
67
|
:body: |-
|
68
68
|
**Ruby** : 16:44/51:50, 37/773
|
69
69
|
|
@@ -76,7 +76,7 @@
|
|
76
76
|
Part 2 was pretty fun! It took me a while I needed to subtract the bits from EVERYTHING in the ancestor stack and then that I might need to pop multiple things off that stack. Great problem with a bunch of separate insights.
|
77
77
|
:replies: []
|
78
78
|
- :author: marshalofthemark
|
79
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hor9ent
|
79
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hor9ent
|
80
80
|
:body: |-
|
81
81
|
**Ruby**
|
82
82
|
|
@@ -154,7 +154,7 @@
|
|
154
154
|
```
|
155
155
|
:replies: []
|
156
156
|
- :author: madethemcry
|
157
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hosv3us
|
157
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hosv3us
|
158
158
|
:body: |-
|
159
159
|
# RUBY
|
160
160
|
|
@@ -169,14 +169,14 @@
|
|
169
169
|
After two frustrating days I had a great success today. The ruby code just reads beautiful ❤️
|
170
170
|
:replies: []
|
171
171
|
- :author: firetech_SE
|
172
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hoqx7pb
|
172
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hoqx7pb
|
173
173
|
:body: |-
|
174
174
|
[Ruby](https://github.com/firetech/advent-of-code/blob/%F0%9F%8E%84/2021/16/decode.rb) (114/114)
|
175
175
|
|
176
176
|
Personal best ranking wise today (while my day job is programming, I'm not a professional _competitive_ programmer), just 46 seconds from top 100 on part 1 and 78 seconds on part 2. :D Might be caused by my inexplicable love for parsing... :P
|
177
177
|
:replies: []
|
178
178
|
- :author: BluFoot
|
179
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hoqy08b
|
179
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hoqy08b
|
180
180
|
:body: |-
|
181
181
|
Ruby
|
182
182
|
|
@@ -235,7 +235,7 @@
|
|
235
235
|
```
|
236
236
|
:replies: []
|
237
237
|
- :author: erikw901
|
238
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hosd6b5
|
238
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hosd6b5
|
239
239
|
:body: |-
|
240
240
|
# Ruby
|
241
241
|
|
@@ -243,7 +243,7 @@
|
|
243
243
|
- [part2.rb](https://github.com/erikw/advent-of-code-solutions/blob/main/2021/16/part2.rb)
|
244
244
|
:replies: []
|
245
245
|
- :author: el_daniero
|
246
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hotgu7a
|
246
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rhj2hm/2021_day_16_solutions/hotgu7a
|
247
247
|
:body: |-
|
248
248
|
# [Ruby](https://github.com/daniero/code-challenges/blob/master/aoc2021/ruby/16.rb)
|
249
249
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: marshalofthemark
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/howcwik
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/howcwik
|
4
4
|
:body: |-
|
5
5
|
**Ruby** (runtime: 40 us / 90 ms)
|
6
6
|
|
@@ -66,7 +66,7 @@
|
|
66
66
|
\*\* Written as end-less methods, which only work in Ruby 3.0+. Earlier versions required you to end a method declaration with `end`.
|
67
67
|
:replies: []
|
68
68
|
- :author: BluFoot
|
69
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/hovte54
|
69
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/hovte54
|
70
70
|
:body: |-
|
71
71
|
**Ruby** 164 bytes
|
72
72
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
```
|
87
87
|
:replies: []
|
88
88
|
- :author: firetech_SE
|
89
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/how2kzp
|
89
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/how2kzp
|
90
90
|
:body: |-
|
91
91
|
[Ruby](https://github.com/firetech/advent-of-code/blob/%F0%9F%8E%84/2021/17/trickshot.rb) (1598/1502)
|
92
92
|
|
@@ -98,15 +98,15 @@
|
|
98
98
|
Curiously ended up submitting the answer for some other input in part 2 at one point when my search space was too small...
|
99
99
|
:replies:
|
100
100
|
- :author: "[deleted]"
|
101
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/how8snj
|
101
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/how8snj
|
102
102
|
:body: "[removed]"
|
103
103
|
:replies:
|
104
104
|
- :author: firetech_SE
|
105
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/howfmtg
|
105
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/howfmtg
|
106
106
|
:body: If it makes you feel better, I didn't realize that until I read it here :P
|
107
107
|
:replies: []
|
108
108
|
- :author: dtinth
|
109
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/hovpzcn
|
109
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ri9kdq/2021_day_17_solutions/hovpzcn
|
110
110
|
:body: |-
|
111
111
|
Today is easier than the past 2 days... done by crude simulation + brute force.
|
112
112
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: Frakols
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp3jadg
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp3jadg
|
4
4
|
:body: |-
|
5
5
|
# Ruby
|
6
6
|
|
7
7
|
[paste](https://topaz.github.io/paste/#XQAAAQAqDwAAAAAAAAA0m4poOBNUDQxDypsC1yr/AYVeQd2XqWHx/Up5/oq2huy31nQ1N2BX0gZ2cccVPEP7L+8wgvKwF7usZRog96EPl6p5hIisI3S+Wnvl0Zt/uWiwWAK7Aqodvozelii07/icWlG2GDtMUcPvnt55MviV12D9ACEO51IdlfNvOiZminvCfFqHG5HfCC2y+Iap0ReWj8Kuzte2hbOa2fsTtVUFFb/W+tQIXFXyie9Sl2N+6ch6C/Fc7I45rEuYVSp4y1uOrPTxx/kE/iGQiraTO6PfkqYrrVj/9h8HMNojy78k87skKdEXdu/ZWe/iOqnyOJX7dQ158yF3G17RnoGtGsAqe0dJjAFqlllkgq+0OSwtddmb2311VEkS27m5nXK5bzrM/lDhrZ3rmtzR4d36L5RT/9RiTBnfF6vUTuB+C2vSmhFy13Mkub/KhFw2IuQzoVmG2h01ygfFc7lNN+4q9VCIR7gtqcT9mSXY9W+fVheRU1tEvvstIQoglWd2104Yn1VOGiA84SmxY+dlLT156CU4gqX8t1ZSq/IyVpcz3YP8fI1lHY4zxVHWAvMMMM+fFMG7OirQwoeLXAwGajUqg45VlypOYvU3L8Ed51Moy2m7e5g4aN3nsf7GsCwkBNRh4pRr+mpcyIclWTiwPX+EWnHYjMw6z5MmHbnb9UtYpPf8soe6MTU00iJlq4e7ylap5mIhD3vGb8IVJaZN9nNG7QFaQWQ4kJVgTzalcPIW202FvgAq5Z+yGU++UoX5jou+h8EXwWbwCgSvz0wFy3/shq/6tXQ3nHh73QW+wtv3mhQtvm5BUEWWrjXZXaYn+06omDKuCW5en+Ym2Lns2qHWAgGyvrjKi2W2ZJsof9XAsRjOJSBWxADjU6T4YZW99CtP2YVjjw6N510b8mu6O0Q51/9AIyqG6UubPLk6//uYTCi3fLn0VXeYCfZ6s3rAz1kW6da8WiygH1LYTKxAwzh007gjz6nvuCUXgT9zSIbyOoOAG8Z80k/m83SOHi3pP7M9F2WrvfQkTfljvnsWrCrPp1bUJUhpjzR3XXLJCsnQ3K6FjO3QKj40crIWY9jDkFB6/r6CYp7KpOcK7AUSO03fK7IfbNqYXkILg/tuPXXxyOfNbX951dHjkuD596arOPGm2Fq1m1qTj9XeSme6hPYL6HHPMbDoq50+Rv3gQ9zHFXJwy+aI83sZWkzAn6CTuWI0ZnWE2oa6gqG2rIgFzGJVxqgcNUEUnxNKzH9Fqs9tN1olcMFUpq/br+J34NLAMyN448Q2Cx5iL2KKvI6GQ6I/1L16To7Ib13SEpARpzwgIe0JW2+rPKd+de3YXIEu/AbQ/wPtHBK7BY7anQ6sOCX2Wh+NiHsazkAfx+B4zNQ6UOuSwyTS5Tx1sS8bHeUJrJ9LAJJTvjUjRBEFz+gp/vvSLIY=)
|
8
8
|
:replies: []
|
9
9
|
- :author: marshalofthemark
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp18eju
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp18eju
|
11
11
|
:body: |-
|
12
12
|
**Ruby**
|
13
13
|
|
@@ -87,15 +87,15 @@
|
|
87
87
|
```
|
88
88
|
:replies:
|
89
89
|
- :author: fcd12
|
90
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp19caa
|
90
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp19caa
|
91
91
|
:body: that is actually such a cool way of solving this problem :)
|
92
92
|
:replies: []
|
93
93
|
- :author: shandley256
|
94
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp2e3az
|
94
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp2e3az
|
95
95
|
:body: Never would have thought of doing it this way - super creative!
|
96
96
|
:replies: []
|
97
97
|
- :author: BaseSlow3701
|
98
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp0w9e4
|
98
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rizw2c/2021_day_18_solutions/hp0w9e4
|
99
99
|
:body: |-
|
100
100
|
Ruby
|
101
101
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: prafster
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rjpf7f/2021_day_19_solutions/hrxvfgt
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rjpf7f/2021_day_19_solutions/hrxvfgt
|
4
4
|
:body: |-
|
5
5
|
## Julia
|
6
6
|
|
@@ -19,11 +19,11 @@
|
|
19
19
|
[Solution](https://github.com/Praful/advent_of_code/blob/main/2021/src/day19.jl).
|
20
20
|
:replies: []
|
21
21
|
- :author: '0x8b'
|
22
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rjpf7f/2021_day_19_solutions/hpg0mnm
|
22
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rjpf7f/2021_day_19_solutions/hpg0mnm
|
23
23
|
:body: Please check out my simple solution in Ruby ;) https://github.com/0x8b/advent.of.code.each/blob/main/src/2021/19.rb
|
24
24
|
:replies: []
|
25
25
|
- :author: akanet
|
26
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rjpf7f/2021_day_19_solutions/hp844vn
|
26
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rjpf7f/2021_day_19_solutions/hp844vn
|
27
27
|
:body: |-
|
28
28
|
[Ruby](https://gist.github.com/vincentwoo/dd1136e151c9035e090dd6401f301dcf)
|
29
29
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
---
|
2
2
|
- :author: oantolin
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hpd67g2
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hpd67g2
|
4
4
|
:body: Another nice and easy one. I represented the infinite image as a pair of the background pixel state and a 2D-array of bits for the pixels. Here's a Common Lisp [program](https://topaz.github.io/paste/#XQAAgAD//////////wAUGQimgx+p6PZhRh7uIO5BVNPIdKEN9R6L6scYP/cAtBpttmBcgWreKz63ht/gJSzjtvO4chAn6ZfcoR0DXWrYkvC8H/QG01B9a4HC8MoJR96YoTr9mETWtJrmJyK0h4tDxxZfRzcOJkqt2/lSGETvOMlvKy/yR95Gw/NQqsA8paa+UNcnqTz8QiQm3Cu0xpJsLZW39bm3IYbrY1pPW0qnEraIm7E3evFhjoQZ4/NzDUNrnfUs+5WWCYsXiHMA55NVYziJt58pcFueeeVD1VUE6EPHEdsft4pobxD/RBl9HHzrROUIWDIVzZ6EUSsygIqIVGEhC5FBIV0spVYtE9nS4qpGxeMoM9l1GfjPawkGrvtrubYnbgJag6laI2/OD4thVrIKNvAZpkEKATVBQiS/+ObhMFrOoL9QOZTkoDjJi/vqgHgS3VvI1DxD6RrRv0riTy//iFV057ir47bomGG2/LZoC13BEetVMfd8UogwunoXYIuc47m4flV/tnlvDVigafmjdgGxnTDwgWe7YPORfvMfuP81Mn9pid4WwsecPagk4GI8M3Th9VMXQF7KseVO7M2PPQtBnBjZtCsN8YJZAiGaZ+z0IiApVeN/t5JA+KqVZvh+9GlqEnOVNB8T35szNHZAfBr++DNqInj/NvxaAjjz8atmdgO5xuOVbDOGwRqnsCKx5oCPbK3bn2U4ZgeirbmS2+YQA/7+j0trTVtZwLBtfEGAPCbL+W4grzL6LS9ze99DarpORC8ueB99ckBWe0OJUnCMux/ivj/YHM62f7wLtoxynLVabMeFEBnPq0eGAExuZAM7T43BcXK596ANAbLkCSXzU9fQqMvNhqcwHO/Be0knOF45ywmwk3NiwvzRdSo=).
|
5
5
|
:replies: []
|
6
6
|
- :author: dtinth
|
7
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hp9gnx3
|
7
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hp9gnx3
|
8
8
|
:body: |-
|
9
9
|
Ruby, 27 / 48
|
10
10
|
|
@@ -24,11 +24,11 @@
|
|
24
24
|
- Using `cache[key] ||= begin … end`, the pixel’s result in each layer is cached, which speeds up the calculation by a lot.
|
25
25
|
:replies:
|
26
26
|
- :author: Floozutter
|
27
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hp9qaw8
|
27
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hp9qaw8
|
28
28
|
:body: Kudos! I tried to do the exact same thing in Python, but I was much slower even with the help of the standard library's `functools.cache`. ([Python](https://github.com/Floozutter/aoc-2021-python/blob/9d9800c94bf66890a0123a744352bf2fd8d7105f/day20/main.py), 1680/1482)
|
29
29
|
:replies: []
|
30
30
|
- :author: marshalofthemark
|
31
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hp9hlzi
|
31
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hp9hlzi
|
32
32
|
:body: |-
|
33
33
|
Ruby, 330/250
|
34
34
|
|
@@ -68,7 +68,7 @@
|
|
68
68
|
```
|
69
69
|
:replies: []
|
70
70
|
- :author: klaustopher
|
71
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hpa1nm8
|
71
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rkf5ek/2021_day_20_solutions/hpa1nm8
|
72
72
|
:body: |-
|
73
73
|
[Ruby](https://github.com/klaustopher/advent-of-code/commit/c26699666014342b17a93d5c8fc332ce4fa6d07a)
|
74
74
|
|
@@ -1,20 +1,20 @@
|
|
1
1
|
---
|
2
2
|
- :author: akanet
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe3ocx
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe3ocx
|
4
4
|
:body: |-
|
5
5
|
[Ruby, 300 something / #40](https://gist.github.com/vincentwoo/7fa2e268e38fb4f24ff574bb7aafa5cf)
|
6
6
|
|
7
7
|
This one has a really straightforward expression in Ruby and I was pleased to hit on the part 2 solution very quickly! My best time this year. Ruby's array#product + a simply DFS formulation with a good base case and memoization makes this one an execution of a classic genre of CS exercises.
|
8
8
|
:replies:
|
9
9
|
- :author: dtinth
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe4a4j
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe4a4j
|
11
11
|
:body: |-
|
12
12
|
Wow, that was short and sweet, congrats!
|
13
13
|
|
14
14
|
I got 126/208 with Ruby but overall approach is similar as yours. [part 1](https://topaz.github.io/paste/#XQAAAQBrAgAAAAAAAAARiAaHkimM1L0GLNx/znbFBIXJUq4OAYq7F5gsWSI/Zf/cROCWdXwSvBaCOGeH7dkU0VjqJgnGDcQAgrt8e8ilKTeF8Wj+TB24EBkFl5j9z7E/CQeCOIEUIChQLjvYHGsRN6mpe2K4dM8/Cykv5JSYkDXvg4dXJ8BTfIFzppQd5jOzUjAkDzPcoSKixeFnEUxyhCjXUK8hNoGsjDrTvKk3l+ZEG9HXBzYrJEm2sD16dtK7SIuy7kDO5XSLYUUr8Xcp33EmnZhfGRDcqoflZ/1QtuCad0TBoJyFdpiMhC4SuunCWEl9RpPKZA6/FQyWWOrKGohmniC1tJnTfBvnE2rwbN6kk+fGfviGaA3SngdP6xXdtdSCMSAKhHOB/+cPXGI=), [part 2](https://topaz.github.io/paste/#XQAAAQDrBgAAAAAAAAARiAaHkimM1L5fGNx/znbFBIXJUq4OAYq7F5gsWSI/ZgRsWLZU530cwM0amFHmyGStC1BzErFR7hOKRgW/uaJYbDQVuNCREoNP+iLglL5pGLhKwxlmKfT2pc4IGe2Flsd73pzSEhNk7doP3k+jTo2Gfz3gVmtGjttC363vHXtKkAWo2i+2vjzFQb+WIxm/3fFvikFewghYM/1OJB3HkzudkCmG4mvVHX9XCHDFpNo6PX8iAW8E+y8BE5LjnOly2HJz2rOpTkZ1o52fHDtw1x5ggxh46XJAupT1S7kUmZaz2sCPbHW5ZXIH+B3Kka3Ovwi0Dz/UeULdUNzZnAonH3YlbozRJlA1yT7Vc1HUn5ndA9a3YYX/YvIh50afOR/Nx9YfwpiLf5EKk/2l4EtdgVx6ZyHZEns8y3rMMq/On5Ma+cw3gAkwg2AnViOnDE5pNJ6Uv0pYBbX7qhR+EkGe3Ve+y0uO4gLIpUfNZLysEhH7A25UFoUrpcK9k5ELLxTEZtr4WeDYT7bLrVcmCxfbHOs44YYz8SVVVc7+q3HRl3EtcL/IpIXuIq0BbqR5u6YRSNZsOURHmXAPIFKHEtBTc7i8gMlTt9xyOfmyYCslbV4Nwa6yEqwOVjjShIFJ7jupallDBWbIvPOzMYRsRDNrY+95bYyOuFdyFO2SF7TgJwsVn77wuWxhVw2MtVGgBrC6pc2+ZeCO8mhrbdPFA9KBkyS+2HBuEXNe3Yzq23m7V46/5iWAqjQKeu8F0AKk1+or8+wnPktxuBPKX6cUmiKPA0TnBKy3e2xUsg89OL63CcV6gztZwR32PIVseXni//aQs/Y=)
|
15
15
|
:replies: []
|
16
16
|
- :author: marshalofthemark
|
17
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe8olo
|
17
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe8olo
|
18
18
|
:body: |-
|
19
19
|
Ruby 520/670
|
20
20
|
|
@@ -25,11 +25,11 @@
|
|
25
25
|
I'm surprised that, unlike the clownfish day, you could still run Part 2 in a reasonable amount of time (~30s) without memoization. With memoization, it runs in 270ms, and even if you set the winning score to 50, it will spit out a 35-digit number for how many universes Player 1 wins in within 5 seconds.
|
26
26
|
:replies:
|
27
27
|
- :author: 1234abcdcba4321
|
28
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe9o8r
|
28
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe9o8r
|
29
29
|
:body: There's never been a puzzle that requires numbers larger than **53** -bit integers. So they'd definitely need to make the question ask for something different if the winning score was any higher than like, 22, unless they decide to break this restriction they've always had.
|
30
30
|
:replies: []
|
31
31
|
- :author: rabuf
|
32
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe8u42
|
32
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rl6p8y/2021_day_21_solutions/hpe8u42
|
33
33
|
:body: |-
|
34
34
|
I like your use of complex numbers for the return. I'm usually very quick to use them for other problems, surprised I didn't think of that today. About to give it a shot and see what impact it has on my performance.
|
35
35
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: dtinth
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpix5qp
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpix5qp
|
4
4
|
:body: |-
|
5
5
|
Ruby, 145 / 45 ([Part 1](https://topaz.github.io/paste/#XQAAAQAVAwAAAAAAAAAyGEruliPhN7cj9y4sPOl/eSs4uSkd5mZOCSu8uBmXEkoNkgiNtw8yNqy281DF4KLR1oO9DUYIGNjSuOdzoZcTAVrDKG3xJhkRhzxhbpPRNzcTb9s6dc2vWNGToQR0qwGEoOdG9MdPQ0pfIYd5QRU9qaKEoKaHLCepEdH5rFR7Lc4zX1tN/5bXESYuudEm16AplawF91xrWX/ZCbIrfRGcLtDDV6HkLkybcvSErDKo1D2Nmnm3OGcuNyscGJv10AdB4R4vFNUvrEpRY6H6+bAxT/9VmRy4e3wekDEOuldZkT7UBgWCwfqyodKqgUX5Dfc7FaMntMhSms7mDvUyIZoZMZ0HiulPVlJqQ2AoDnUnU/GqAmwdBuGFFbTjBlTTInBfv9rbs0wKAbPtlSUKOXKvqnAf//Y4JaQ=), [Part 2](https://topaz.github.io/paste/#XQAAAQByBgAAAAAAAAAhnUhGbrHQXPsQ7Mdo7ZkPpEmH6VBEqcrPU555F7dPhTDZyB3YHrPiTHCDGPZS3zQLgj+SuYga60UYXUu3Pr4KKA5lZ+ah+f6sOZAYO5tsCTg2gEeV5+Bb3+lEdnL7bH/OGqF2jkd8ohf3LpdA4IaqbMKbMEduoIw1+IcV8c98Uo95NWGuUpZt6C37i8OptMuPPlep4DREPfksBh+92S6sQxFF1OSIntiYn8ete9cOtsSTSJP7NIQOTosYEjP/KVHI1x6G8yL9Lo526nRgTXUj52BST9M+4FDcjlbSImYsG1fu3z2iN5t3oMuqCOEZ1ajKiYouBndPUapg7xVV2C4x3h3boFZJNVgJmXR/4uKoTcakKMGj377A3hUCZ3+rLEZ01ZqgAv9xPpkQufxd9u5rvB7xTYOTuaUI0GPSFlYgb88ZXsXwOA69i37l4n3iuY5r01UeGEW+Ko6OrokcJehFZEh/mTKZMXvoR0NlgKvkzQYXbslJZ3pyImvPezUw3H1P/qLA8HTnpEZJ7mle0k2+Ya3YcMcfI2J2lFOuG0gYkGFQmul4livkzwav71+Zb5mCW6eY5UCA2u4RTsBKxNSw9q+IsfDB0ABlt6q6TW8PhHCi+0OJYxsnmJAbd1QqK7KTEMwUTgCoBULCzzUq6Isy2SVe9lc5UgBHxLLVqxNvA3dProx92Q31jWIW9LssWHNoeHGJ7DX8NPM4rHNnp2NXljR5APn0VR9atOFBm9olBZknp9a0Fplg/YpM5OJf/Mz8XJb14F9z7PCV3qkZYyHnKRrEXvfB0XxRDxaCm2fR24qIowEbWj67h1FA2bxI+///uqv2OA==))
|
6
6
|
|
@@ -9,15 +9,15 @@
|
|
9
9
|
Here’s a diagram showing how the above approach was implemented: [https://imgur.com/WHPsnch](https://imgur.com/WHPsnch)
|
10
10
|
:replies: []
|
11
11
|
- :author: '0x623'
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpk0e3o
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpk0e3o
|
13
13
|
:body: "[Ruby3](https://carbon.now.sh/?bg=rgba%2874%2C144%2C226%2C1%29&t=material&wt=none&l=ruby&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=56px&ph=56px&ln=true&fl=1&fm=JetBrains+Mono&fs=14px&lh=152%25&si=false&es=1x&wm=false&code=class%2520Cube%250A%2520%2520%2520%2520attr_reader%2520%253Ax%252C%2520%253Ay%252C%2520%253Az%250A%2520%2520%2520%2520def%2520initialize%28x%252C%2520y%252C%2520z%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2540x%252C%2520%2540y%252C%2520%2540z%2520%253D%2520x%252C%2520y%252C%2520z%250A%2520%2520%2520%2520end%250A%250A%2520%2520%2520%2520def%2520and%28c%29%250A%2520%2520%2520%2520%2520%2520%2520%2520x%2520%253D%2520%2540x%2520.and%2520c.x%250A%2520%2520%2520%2520%2520%2520%2520%2520y%2520%253D%2520%2540y%2520.and%2520c.y%250A%2520%2520%2520%2520%2520%2520%2520%2520z%2520%253D%2520%2540z%2520.and%2520c.z%250A%2520%2520%2520%2520%2520%2520%2520%2520Cube.new%28x%252C%2520y%252C%2520z%29%2520unless%2520x.empty%253F%2520or%2520y.empty%253F%2520or%2520z.empty%253F%250A%2520%2520%2520%2520end%250A%250A%2520%2520%2520%2520def%2520vol%2520%253D%2520%2540x.size%2520*%2520%2540y.size%2520*%2520%2540z.size%250Aend%250A%250Aclass%2520Range%250A%2520%2520%2520%2520def%2520and%28r%29%250A%2520%2520%2520%2520%2520%2520%2520%2520l1%252C%2520r1%2520%253D%2520minmax%250A%2520%2520%2520%2520%2520%2520%2520%2520l2%252C%2520r2%2520%253D%2520r.minmax%250A%2520%2520%2520%2520%2520%2520%2520%2520%255Bl1%252C%2520l2%255D.max%2520..%2520%255Br1%252C%2520r2%255D.min%250A%2520%2520%2520%2520end%250A%250A%2520%2520%2520%2520def%2520empty%253F%2520%253D%2520size.zero%253F%250Aend%250A%250Apos%252C%2520neg%2520%253D%2520%255B%255D%252C%2520%255B%255D%250AINPUT.each_line%2520%257B%2520%257Cln%257C%250A%2520%2520%2520%2520%252F%28%255Cw%252B%29%2520x%253D%28.%252B%29%252Cy%253D%28.%252B%29%252Cz%253D%28.%252B%29%2524%252F%2520%253D%7E%2520ln%250A%2520%2520%2520%2520c%2520%253D%2520Cube.new%2520*%255B%25242%252C%2520%25243%252C%2520%25244%255D.map%2520%257B%2520eval%2520_1%2520%257D%250A%2520%2520%2520%2520p%2520%253D%2520neg.map%2520%257B%2520_1%2520.and%2520c%2520%257D.compact%250A%2520%2520%2520%2520n%2520%253D%2520pos.map%2520%257B%2520_1%2520.and%2520c%2520%257D.compact%250A%2520%2520%2520%2520pos.concat%28p%29%250A%2520%2520%2520%2520neg.concat%28n%29%250A%2520%2520%2520%2520pos%2520%253C%253C%2520c%2520if%2520%25241%2520%253D%253D%2520%27on%27%250A%257D%250A%250Avp%2520%253D%2520pos.sum%2520%2526%253Avol%250Avn%2520%253D%2520neg.sum%2520%2526%253Avol%250Ap%2520vp-vn), algebra of sets."
|
14
14
|
:replies:
|
15
15
|
- :author: veydar_
|
16
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpk37xp
|
16
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpk37xp
|
17
17
|
:body: Your code block doesn't display correctly on https://old.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22\_solutions/ since it doesn't work with backticks.
|
18
18
|
:replies:
|
19
19
|
- :author: '0x623'
|
20
|
-
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpmwb99
|
20
|
+
:url: https://www.reddit.com/r/adventofcode/comments/rlxhmg/2021_day_22_solutions/hpmwb99
|
21
21
|
:body: |-
|
22
22
|
Thanks for noticing.
|
23
23
|
|