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,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: careyi4
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j06mkyf
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j06mkyf
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,22 +9,22 @@
|
|
9
9
|
Video Walkthrough: [YouTube](https://youtu.be/PTmSGQnGoXM)
|
10
10
|
:replies:
|
11
11
|
- :author: mizunomi
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j06qhj0
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j06qhj0
|
13
13
|
:body: Well done with the solution, but please, as suggested, do not upload your inputs to public repositories.
|
14
14
|
:replies:
|
15
15
|
- :author: skagedal
|
16
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j06zveq
|
16
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j06zveq
|
17
17
|
:body: Where is this suggested? I've read through the posting rules but probably missed something. Or is it suggested somewhere on the AoC site itself..?
|
18
18
|
:replies:
|
19
19
|
- :author: mizunomi
|
20
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j075a64
|
20
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j075a64
|
21
21
|
:body: |-
|
22
22
|
This is visible in the subreddit wiki. Usually, the moderator reminds posters about this.
|
23
23
|
|
24
24
|
[Link](https://www.reddit.com/r/adventofcode/wiki/troubleshooting/no_asking_for_inputs/)
|
25
25
|
:replies: []
|
26
26
|
- :author: mathem17
|
27
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j05q56v
|
27
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j05q56v
|
28
28
|
:body: |-
|
29
29
|
[Ruby](https://github.com/jzhang113/adventofcode/blob/01b815bbd93a405f590095393867beed301cd3db/2022/solutions/14.rb) 2010 / 3400
|
30
30
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: "[deleted]"
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0ed50d
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0ed50d
|
4
4
|
:body: |-
|
5
5
|
Ruby, Part 2.
|
6
6
|
|
@@ -60,7 +60,7 @@
|
|
60
60
|
```
|
61
61
|
:replies: []
|
62
62
|
- :author: kateba72
|
63
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0atlef
|
63
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0atlef
|
64
64
|
:body: |-
|
65
65
|
## Ruby ~13 ms
|
66
66
|
|
@@ -80,11 +80,11 @@
|
|
80
80
|
[https://github.com/Kateba72/advent\_of\_code/blob/main/2022/day15.rb](https://github.com/Kateba72/advent_of_code/blob/main/2022/day15.rb)
|
81
81
|
:replies:
|
82
82
|
- :author: captainAwesomePants
|
83
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0audhv
|
83
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0audhv
|
84
84
|
:body: Love the diagonal coordinates!
|
85
85
|
:replies: []
|
86
86
|
- :author: mathem17
|
87
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0alfzg
|
87
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0alfzg
|
88
88
|
:body: |-
|
89
89
|
[Ruby](https://github.com/jzhang113/adventofcode/blob/d95083d71d99277c0cac5b4ba2b07d6cb58df892/2022/solutions/15.rb) 953/408
|
90
90
|
|
@@ -96,11 +96,11 @@
|
|
96
96
|
This mean we can work entirely with ranges, which is much faster than enumerating all the possible points. (Technically, the point could be on the edges, which would result in one range not covering the whole row, but I didn't run into that in my input)
|
97
97
|
:replies: []
|
98
98
|
- :author: akanet
|
99
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0bexon
|
99
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0bexon
|
100
100
|
:body: 'I spent some time trying to think of a very elegant, simple, and fast algorithm in Ruby. I''m very pleased with this result: [https://twitter.com/fulligin/status/1603369386085036032/photo/1](https://twitter.com/fulligin/status/1603369386085036032/photo/1), which basically finds the y-intercepts for all lines drawn on the map as if they were infinitely long, and then simply checks each of the rows for the missing beacon.'
|
101
101
|
:replies: []
|
102
102
|
- :author: careyi4
|
103
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0cral9
|
103
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zmcn64/2022_day_15_solutions/j0cral9
|
104
104
|
:body: |-
|
105
105
|
Ruby
|
106
106
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: akanet
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0tmzbw
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0tmzbw
|
4
4
|
:body: |-
|
5
5
|
After long thought, I've got my [Ruby solution](https://gist.github.com/vincentwoo/db6cf426bc3f5f6a23ad21e89315c383) running in a few seconds. I tried lots of different tricks, like running each search independently of the other on different subsets of nodes, but eventually got a full search working with both agents. A few things that were important were conceiving of each valve opening of having a total upfront value based on the current time, modelling the whole graph as just direct pairs between all valves, building in the opening time into those edges, and most importantly, having a good estimation function for being able to early terminate subtree searches. For example, if you have [20m, 10m] left for your agents, you can calculate an upper bound of pressure that can be released by looking at the minimum edge lengths remaining for each unvisited valve, and multiplying each of those valve values by the highest of your agent times, while decrementing that time by that minimum edge length.
|
6
6
|
|
7
7
|
I got 48th on part one, and 1935th on part two, lmao.
|
8
8
|
:replies: []
|
9
9
|
- :author: ingOmar
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0ns731
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0ns731
|
11
11
|
:body: |-
|
12
12
|
I was stumped on this until I reread Prof. O'Neil's comment a few more times along with his Perl code. And then I finally got it, and solved part 1 using a straightforward BFS in an iterative loop.
|
13
13
|
|
@@ -26,14 +26,14 @@
|
|
26
26
|
Am I doomed to spend retirement doing programming puzzles (not that I'm anywhere near there yet)? If so, I know I'll be coming back to part2 to work out a faster solution. Please don't delete this thread for another 30 years.
|
27
27
|
:replies: []
|
28
28
|
- :author: damyvv
|
29
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0gkcxc
|
29
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0gkcxc
|
30
30
|
:body: |-
|
31
31
|
Ruby Part 1 and 2 have a combined runtime of **278ms**.
|
32
32
|
|
33
33
|
The [code](https://github.com/damyvv/advent-of-code-2022/blob/master/solutions/day16.rb) is horrible, but performance is great.The basic idea of the algorithm is to consider all the valves we can move to. We compute how long it will take to move to a valve, and we also precompute how much pressure will be released in total by this valve using the remaining time. Then, if there are paths that have an equal distance, we only have to consider the path that has the highest potential pressure release. This drastically reduces the iterations needed, hence the low runtime. Also, the distances are not precomputed, but they are cached. This is more efficient, since we don't need all paths (for example we can skip all paths that have 0 flow rate, as we will never move to them, only pass them).
|
34
34
|
:replies:
|
35
35
|
- :author: Laugarhraun
|
36
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0goxqz
|
36
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0goxqz
|
37
37
|
:body: |-
|
38
38
|
Your solution does not look correct.
|
39
39
|
|
@@ -44,6 +44,6 @@
|
|
44
44
|
Your solution happens to work for your specific input, but it's not a correct solution.
|
45
45
|
:replies: []
|
46
46
|
- :author: Healthy-Chemistry664
|
47
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0gmv8g
|
47
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zn6k1l/2022_day_16_solutions/j0gmv8g
|
48
48
|
:body: I tried your code and it didn't produce the right answer for me?
|
49
49
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: careyi4
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/znykq2/2022_day_17_solutions/j0p56hx
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/znykq2/2022_day_17_solutions/j0p56hx
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
Video Walkthrough: [YouTube](https://youtu.be/uwQoa2xkbfA)
|
10
10
|
:replies: []
|
11
11
|
- :author: SnooConfections2453
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/znykq2/2022_day_17_solutions/j0maq3b
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/znykq2/2022_day_17_solutions/j0maq3b
|
13
13
|
:body: |-
|
14
14
|
140 lines of readable ruby code. Runs in a bit over half a second.
|
15
15
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: careyi4
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0uweyj
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0uweyj
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
Video Walkthrough: [YouTube](https://youtu.be/2L8gHiNnZ9w)
|
10
10
|
:replies: []
|
11
11
|
- :author: "[deleted]"
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0s1vh0
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0s1vh0
|
13
13
|
:body: |-
|
14
14
|
Ruby, part 2. But it is annoyingly slow–takes about 12 minutes on my machine. Is it possible to speed it up without changing the approach?
|
15
15
|
|
@@ -72,11 +72,11 @@
|
|
72
72
|
```
|
73
73
|
:replies:
|
74
74
|
- :author: "[deleted]"
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0ti4hn
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0ti4hn
|
76
76
|
:body: 'Ok, to speed up 100 times: use a set to store cubes instead of an array.'
|
77
77
|
:replies: []
|
78
78
|
- :author: whezya
|
79
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0ryg57
|
79
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0ryg57
|
80
80
|
:body: |-
|
81
81
|
**Ruby**
|
82
82
|
|
@@ -87,7 +87,7 @@
|
|
87
87
|
I never used a flood algorithm before, so this is my first attempt, benchmark gave me 2 sec on my computer. [Readme](https://github.com/rbellec/advent_of_code_2022/blob/main/README.md) explain how to use it. Would be happy to discuss about it.
|
88
88
|
:replies: []
|
89
89
|
- :author: SwampThingTom
|
90
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0qht6f
|
90
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0qht6f
|
91
91
|
:body: |-
|
92
92
|
I'm solving each of this year's problems in a different language, roughly in the order in which I learned them.
|
93
93
|
|
@@ -96,7 +96,7 @@
|
|
96
96
|
https://github.com/SwampThingTom/AoC2022/tree/main/18-BoilingBoulders
|
97
97
|
:replies: []
|
98
98
|
- :author: jstanley0
|
99
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0op0zl
|
99
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zoqhvy/2022_day_18_solutions/j0op0zl
|
100
100
|
:body: |-
|
101
101
|
_Ruby_
|
102
102
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: careyi4
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zpihwi/2022_day_19_solutions/j142h8c
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zpihwi/2022_day_19_solutions/j142h8c
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,14 +9,14 @@
|
|
9
9
|
Video Walkthrough: [YouTube](https://youtu.be/FdZ_vpf-VEU)
|
10
10
|
:replies: []
|
11
11
|
- :author: akanet
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zpihwi/2022_day_19_solutions/j0tkaz7
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zpihwi/2022_day_19_solutions/j0tkaz7
|
13
13
|
:body: |-
|
14
14
|
[Ruby](https://topaz.github.io/paste/#XQAAAQCBBAAAAAAAAAAlkUd1JxEvDhwoUT5C66Qze8FtdpxEzJYhvPke6qNjV4PA2OeOLQPreA1+6lfcYrgKm8Gq8wrgh9XN9tGh8PMAOkjwJbmMaPbeGa2JFbYbiQ9McQIo3cw3qvh1Ji/22fPb0wr9vMpep2wgEA1+U4iQ3Crqe3cPNymc83HiUEohFqNv8Xg552dPBw4BR0Zse85imqqc402jEEOFD+9eBeF78t17Gb7iPGWpbsLJMkhOmVDskfeJauN0Klgg92Ii31gLjD8SzUCMtf7r8k+cqVxs3JWlHxj77Ym79mEJ3EElGn7vHRaEAyCvRMW2+zv2JmPLdTAUbxpncHZRgO3sfqfgks74ao6TpJCHN0uvp5ZZQ5nK2S5xWa8tjet0lpE1TSzA6hZI6xWrY1c35XuBQjaAKus+VJb/2T9CpbzT/n8Eb3FtjdpAbaXrHJs/30B8y7ZlyebOsE4Nxe3q/z6Bd7Wa4N3csq8aljVrp3ZJgqMTKxW6pyPMmfdE2fQ/gGoIR5RDh7/br3yFbpubCzFSR1k0WbW8j/t37lS/O4qw2/xwwEqaAt3tyMz82sWehuuJWPY5WF9YyZ4WXTY9Tl0l+vEo3VcZ1xv1isgwwJarX/XUEalpLaT+Mv8LH614rIMpIGB9NlLS0zM32BNKpt7/+fl6OA==), 777/485.
|
15
15
|
|
16
16
|
Here's a very elegant and terse Ruby solution that runs quickly with only one, incredibly hacky optimization: do BFS search but rank each successor generation by their resources and robots, from geodes down to ore, and just keep the 5000 best ones. This is sufficient and sort of a marvel to behold.
|
17
17
|
:replies: []
|
18
18
|
- :author: globalreset
|
19
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zpihwi/2022_day_19_solutions/j0v1i6m
|
19
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zpihwi/2022_day_19_solutions/j0v1i6m
|
20
20
|
:body: |-
|
21
21
|
[Ruby](https://github.com/globalreset/advent_of_code_2022/blob/main/day19/dayNineteen.rb)
|
22
22
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: careyi4
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j18nj2y
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j18nj2y
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
7
7
|
Code: [Github](https://github.com/careyi3/aoc_2022/tree/master/solutions/20)Video Walkthrough: [YouTube](https://youtu.be/szXQTRybPAI)
|
8
8
|
:replies: []
|
9
9
|
- :author: dtinth
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j12cr45
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j12cr45
|
11
11
|
:body: |-
|
12
12
|
**Ruby** , with rotating arrays:
|
13
13
|
|
@@ -26,7 +26,7 @@
|
|
26
26
|
```
|
27
27
|
:replies: []
|
28
28
|
- :author: whezya
|
29
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j10t1i9
|
29
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j10t1i9
|
30
30
|
:body: |-
|
31
31
|
**Ruby**
|
32
32
|
|
@@ -37,7 +37,7 @@
|
|
37
37
|
https://github.com/rbellec/advent\_of\_code\_2022/blob/main/app/daily\_problems/day\_20.rb
|
38
38
|
:replies: []
|
39
39
|
- :author: jstanley0
|
40
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0xw35j
|
40
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0xw35j
|
41
41
|
:body: |-
|
42
42
|
# Ruby, 437/334
|
43
43
|
|
@@ -65,14 +65,14 @@
|
|
65
65
|
```
|
66
66
|
:replies:
|
67
67
|
- :author: "[deleted]"
|
68
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0yin0g
|
68
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0yin0g
|
69
69
|
:body: |-
|
70
70
|
Exactly the same idea to use the number + original position.
|
71
71
|
|
72
72
|
There is a guy who uses Python and often uses complex numbers to store information. I wonder if he used them today, seems to fit well :)
|
73
73
|
:replies:
|
74
74
|
- :author: 4HbQ
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0yxzqw
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0yxzqw
|
76
76
|
:body: |-
|
77
77
|
[Maybe](https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyug6hl/)[I](https://www.reddit.com/r/adventofcode/comments/zgnice/2022_day_9_solutions/izhzxb6/)[am](https://www.reddit.com/r/adventofcode/comments/zjnruc/2022_day_12_solutions/izw63we/)[that](https://www.reddit.com/r/adventofcode/comments/zli1rd/2022_day_14_solutions/j061f6z/)[guy](https://www.reddit.com/r/adventofcode/comments/znykq2/2022_day_17_solutions/j0kdnnj/)?
|
78
78
|
|
@@ -81,18 +81,18 @@
|
|
81
81
|
In case you're interested, it does work and looks like [this](https://topaz.github.io/paste/#XQAAAQADAQAAAAAAAAA8HMAC0B10JGvJxk1ICqx0YTnnfz/f4KkcTEpfucim8ULWQSRYZBfXObTE2OdlMYGbQsY7+p1vB9dTESMHaog9kTvMa09i7wJBCx3J5GHdmWv98l/yxeHO65EExHVDflnmMdr0EygoA80iMjB2s7L6j8Tyo0WuMGummilYRJx1sJT+ptMYHKLSDQP/6DLmiXSNjNvx4HBrHWGB5W7K/8MkepJ8LYJK0gRTKP/Q5KxSJWG5b0+gBdrhpx/EqiylybH/+LazgA==).
|
82
82
|
:replies:
|
83
83
|
- :author: "[deleted]"
|
84
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0z6eiz
|
84
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0z6eiz
|
85
85
|
:body: |-
|
86
86
|
That guy: [https://www.youtube.com/watch?v=w9Sk7lvyGZI](https://www.youtube.com/watch?v=w9Sk7lvyGZI) :)
|
87
87
|
|
88
88
|
No complex numbers today, a linked list :(
|
89
89
|
:replies: []
|
90
90
|
- :author: jstanley0
|
91
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j114qpe
|
91
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j114qpe
|
92
92
|
:body: ooh, putting the original index in an imaginary part is delightfully perverse. I love it
|
93
93
|
:replies: []
|
94
94
|
- :author: Elavid
|
95
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0xyhwz
|
95
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0xyhwz
|
96
96
|
:body: |-
|
97
97
|
I used Ruby too! I used a doubly-linked list where each node is a hash that contains the value, and links to the previous and next nodes. Each node also contains an extra pointer to the node that was originally after it in the input ~~(I didn't realize the input numbers would be unique, like you did)~~.
|
98
98
|
|
@@ -101,15 +101,15 @@
|
|
101
101
|
I thought my approach should be faster than the simple array style because it requires very little writing of data, but I guess I'm getting slowed down by having a big data structure that I have to read a whole lot. I have to traverse through nodes one at a time to find my insert positions every time I move a node.
|
102
102
|
:replies:
|
103
103
|
- :author: jstanley0
|
104
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0xzk4s
|
104
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0xzk4s
|
105
105
|
:body: My solution doesn’t depend on the numbers being unique. Are they? I just paired each number with its original position and searched for that to find which number to move. I’m sure it could have been done more efficiently but I was up very late doing the previous problem…
|
106
106
|
:replies:
|
107
107
|
- :author: Elavid
|
108
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0y1df3
|
108
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0y1df3
|
109
109
|
:body: Oh yeah, you're right.
|
110
110
|
:replies: []
|
111
111
|
- :author: Nnnes
|
112
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0y2lsg
|
112
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zqezkn/2022_day_20_solutions/j0y2lsg
|
113
113
|
:body: |-
|
114
114
|
# Ruby
|
115
115
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: careyi4
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j1czuwm
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j1czuwm
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
Video Walkthrough: [YouTube](https://youtu.be/8_LvF2C4myo)
|
10
10
|
:replies: []
|
11
11
|
- :author: "[deleted]"
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j16ddx9
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j16ddx9
|
13
13
|
:body: |-
|
14
14
|
Ruby, part 2. The code is horrible, but I am kind of proud of myself, seeing how others used binary search, o some online equation solvers.
|
15
15
|
|
@@ -109,7 +109,7 @@
|
|
109
109
|
```
|
110
110
|
:replies: []
|
111
111
|
- :author: tgoesh
|
112
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j163fyh
|
112
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j163fyh
|
113
113
|
:body: |-
|
114
114
|
# [Ruby](https://topaz.github.io/paste/#XQAAAQCfBQAAAAAAAAARiEJHiiMzw3cPM/1Vl+2nyBa63n8Kt1xH5HTAZ5BobIVaNmvr5uBT8lIWMVDPZEFxdcpn3Nj9lGXzliPRlIkeaE/uxw0eRYNQ0wHIgpqPDGvjVfR4EKOziEs6xQZ45nkYjc9RLRFCQt6D781H8E6UUKqPEZDvik3xRVWko1Oy0Ub+/OXUWd6N4CU6dt57vEYuOkjUl+8Br7Fqb6iNscVaYLIVFAQnOBCNq58vf9S7JAMlPRPLpvMuviy3kcQA/4McodaSdOMSfK3INWV1Jn8n1kI4FAN3O0ONmLb+Qz8sMiEkcIH5qA7tU4V/Q1BQynqWFGrAvGjWTigKhdwrgdLEqtlPNXjKas/he+1UL4NDu2g2C8HznNtS4U7tr5H8TSf7SwySjWiXKvlhyqnT4MZ2hRuOwQckAmUgQYXIY1fCZyi+bZE0lcZ72p9ZnBTPnnWd7ztLjvhpNT9uvJ56pUzEMks7b/y7GtQN8do7nxva1zvKNydtg2vEkQ3JTMRi5MudW7vUzUuOObK6bPblyvnCT7rWcCTxFh/dZOS3yGTzJJvFGBYLMNme26xv923It0J8sg6+loG7WsHOnF+XJ1hNyfISyBHIxm3+DVSs4eUSVSx9Uvt4s8Hg9FmKwIVSQoN1W0U0dVOPInwIHeR4RfckEAJZfbdIsxS3tTaHP4sq4NuHF7velg9GPBjEqxU8R7EL0iXUX4EkxG/Ch5FpMGk+x+VGOOX5tNgTvLRorC9z+TduRZlbeagxryvyOawx6+YB81wA8cG38f5u5e3IxVmMKwT8vQkVdbeeG1RHagPjlSvrt+BUTtU9gvaMoyTslaNzWbamfgTLyJD9pNbRSlPu7JHB449pTr0F+wQSr7h+XgopbP8CyBOpzYq4GN8Om5021qgHC0kDHv/fWVUJ)
|
115
115
|
|
@@ -120,7 +120,7 @@
|
|
120
120
|
Works great, though.
|
121
121
|
:replies: []
|
122
122
|
- :author: shandley256
|
123
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j15orhb
|
123
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j15orhb
|
124
124
|
:body: |-
|
125
125
|
Quite pleased with my Ruby solution for part 1:
|
126
126
|
|
@@ -130,7 +130,7 @@
|
|
130
130
|
```
|
131
131
|
:replies: []
|
132
132
|
- :author: Elavid
|
133
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12tsyo
|
133
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12tsyo
|
134
134
|
:body: |-
|
135
135
|
## Bit-based binary search!
|
136
136
|
|
@@ -163,7 +163,7 @@
|
|
163
163
|
```
|
164
164
|
:replies: []
|
165
165
|
- :author: riffraff
|
166
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12v3v6
|
166
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12v3v6
|
167
167
|
:body: |-
|
168
168
|
evals galore! Ruby + Z3
|
169
169
|
|
@@ -197,7 +197,7 @@
|
|
197
197
|
```
|
198
198
|
:replies: []
|
199
199
|
- :author: jstanley0
|
200
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12rghz
|
200
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12rghz
|
201
201
|
:body: |-
|
202
202
|
## [Ruby](https://github.com/jstanley0/advent-2022/blob/main/21.rb) 540/1917
|
203
203
|
|
@@ -208,7 +208,7 @@
|
|
208
208
|
I decided to solve it for real. I essentially built a binary tree for the side of the equation containing `humn` and I simplified it one step at a time. For instance if I had 3 - (...) = 5150 I turned that into (...) = -5147 and then repeated until the left side contained only `humn`
|
209
209
|
:replies:
|
210
210
|
- :author: mynt
|
211
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12rmnr
|
211
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12rmnr
|
212
212
|
:body: |-
|
213
213
|
Similar approach except wolfram Alpha worked!
|
214
214
|
|
@@ -219,11 +219,11 @@
|
|
219
219
|
((((92540050790154-(9\*(((((280+(((((((2\*(264+((516+(((660+(2\*((2\*(530+((((313+(((((3\*(615+(((8\*(915+((((246+(4\*(((483+(((((((80+(((((8\*((((3\*(789+((107+((x-745)/3))\*11)))-695)/4)-486))+570)/5)-757)/3))\*5)+411)\*2)-885)+552)+802))/2)-686)))/5)-175)/3)))-66)/2)))-319)\*2)+133)+570))/2)-955)/2)))-768)))/3)-223))/5)))-933)/5)+765)\*9)-193)\*2))/2)+689)/6)-230)))\*2)+138)/12)=5697586809113
|
220
220
|
:replies: []
|
221
221
|
- :author: Pakosh
|
222
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12sq66
|
222
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12sq66
|
223
223
|
:body: Natural language complains for me as well but once I switch to the math input, its ok.
|
224
224
|
:replies: []
|
225
225
|
- :author: p_tseng
|
226
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12szc6
|
226
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j12szc6
|
227
227
|
:body: |-
|
228
228
|
In both Ruby and Haskell, you can define a map that's defined in terms of itself! This allows you to resolve the "monkeys might need to wait for other monkeys to compute their values" situation, without worrying about the code taking forever by repeatedly recomputing values that you've already computed in the past. In Ruby, you do this:
|
229
229
|
|
@@ -253,7 +253,7 @@
|
|
253
253
|
Oh yeah I managed to just barely sneak into the top 100 for part 2 today, great. I used binary search to do part 2. The difference is that i[n Ruby binary search is built-in](https://www.rubydoc.info/stdlib/core/Array:bsearch) whereas in Haskell you have to write it yourself.
|
254
254
|
:replies: []
|
255
255
|
- :author: whezya
|
256
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j14dptm
|
256
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zrav4h/2022_day_21_solutions/j14dptm
|
257
257
|
:body: |-
|
258
258
|
[**Ruby solution**](https://github.com/rbellec/advent_of_code_2022/blob/main/app/daily_problems/day_21.rb)
|
259
259
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Elavid
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17o4by
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17o4by
|
4
4
|
:body: |-
|
5
5
|
## Ruby, 546/476
|
6
6
|
|
@@ -19,11 +19,11 @@
|
|
19
19
|
When I didn't get the right answer for part 2, I added a **sanity check** : after doing one of these special cases I made sure that I could turn around and get back to the location where I was previously (and be facing the opposite direction). The sanity check revealed two or three bugs and allowed me to get the right answer. This one was the longest one yet, I think! Took me 110 minutes to finish and it was very repetitive.
|
20
20
|
:replies:
|
21
21
|
- :author: silxikys
|
22
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17os2m
|
22
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17os2m
|
23
23
|
:body: I tried this and it helped me debug my part2! I had a `x` where I should have put a `y`...
|
24
24
|
:replies: []
|
25
25
|
- :author: dtinth
|
26
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17l4fq
|
26
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17l4fq
|
27
27
|
:body: |-
|
28
28
|
**Ruby** (16/50)
|
29
29
|
|
@@ -49,6 +49,6 @@
|
|
49
49
|
```
|
50
50
|
:replies:
|
51
51
|
- :author: riffraff
|
52
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17ng8x
|
52
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zsct8w/2022_day_22_solutions/j17ng8x
|
53
53
|
:body: oh, incrementing both in one go is clever, I wish I had thought of that.
|
54
54
|
:replies: []
|
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: jstanley0
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1gv7tr
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1gv7tr
|
4
4
|
:body: |-
|
5
5
|
[Ruby](https://github.com/jstanley0/advent-2022/blob/main/24.rb) 369/332
|
6
6
|
|
7
7
|
This one was fun! Figuring out a trick that would let me treat this like other A\* searches I've done in the past was very rewarding. Essentially instead of operating on a fixed map, each search state stores a time value and calculates what the map will look like at decision time. Each blizzard's location is computable at any arbitrary time _t_ using modulo math. \>!it helps that there are no vertical blizzards in the entry/exit columns.!\< Maps are memoized for performance. I probably could have saved some memory had I realized the map state starts repeating, but it performs well enough (part 2 takes about 2 seconds in total).
|
8
8
|
:replies: []
|
9
9
|
- :author: Elavid
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1gwew0
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1gwew0
|
11
11
|
:body: |-
|
12
12
|
## [Ruby](https://github.com/DavidEGrayson/adventofcode/blob/434f2b4693f1e1b1b4add4b279c69acc4b3fde65/2022_24/advent.rb), 1107/988, 85 lines
|
13
13
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
Another observation that helped me is that you should **solve part 2 by just doing the same search you did in part 1, but doing it three times with different parameters**. There are no blizzards passing through the start or end points, so you always want to reach those points as fast as possible. (You can always spend some time waiting _after_ you get there.)
|
21
21
|
:replies:
|
22
22
|
- :author: lbl_ye
|
23
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h65q2
|
23
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h65q2
|
24
24
|
:body: |-
|
25
25
|
for faster code you must change to simpler algorithm
|
26
26
|
|
@@ -31,7 +31,7 @@
|
|
31
31
|
it would be simpler if you stepped for each minute, and computed/fetched "phase" one time only for all states and moved all states together to time+1
|
32
32
|
:replies:
|
33
33
|
- :author: Elavid
|
34
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h79r4
|
34
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h79r4
|
35
35
|
:body: |-
|
36
36
|
Wow, it's right! The code is taking about 2 seconds now if I do a simple breadth-first search:
|
37
37
|
|
@@ -51,7 +51,7 @@
|
|
51
51
|
```
|
52
52
|
:replies: []
|
53
53
|
- :author: sigmazero13
|
54
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h33hm
|
54
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h33hm
|
55
55
|
:body: |-
|
56
56
|
**Ruby**
|
57
57
|
|
@@ -72,25 +72,25 @@
|
|
72
72
|
EDIT: Forgot to mention: running part 2 takes about 4.5s. So about 1.5 seconds per leg.
|
73
73
|
:replies:
|
74
74
|
- :author: johnpeters42
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h5vpx
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h5vpx
|
76
76
|
:body: I tried to approach it that way, but it seemed to slow down by a lot more than what you describe, up to where I killed it and went back to the drawing board. I'm vaguely curious how far off the mark I really was (I ended up using A\* instead).
|
77
77
|
:replies:
|
78
78
|
- :author: sigmazero13
|
79
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1j2ivm
|
79
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1j2ivm
|
80
80
|
:body: Can you post your code? Maybe I can help see what might be slowing it down
|
81
81
|
:replies:
|
82
82
|
- :author: johnpeters42
|
83
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1jle0s
|
83
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1jle0s
|
84
84
|
:body: I didn't keep a copy. I think maybe I was wasting time on BFS backward from the end location at any possible blizzard state, rather than forward from t = 0.
|
85
85
|
:replies: []
|
86
86
|
- :author: globalreset
|
87
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h7cxs
|
87
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1h7cxs
|
88
88
|
:body: |-
|
89
89
|
[Ruby](https://github.com/globalreset/advent_of_code_2022/blob/main/day24/dayTwentyFour.rb)
|
90
90
|
|
91
91
|
For part 1, I did a simple BFS and simulated the entire board of blizzards every minute (caching the result for that minute). In part 2, this was taking way too long. So I realized that I'm simulating the entire board when I only care about the row/col the expedition is on, plus/minus one row/col. So I rewrote it to create a lookup for all of the blizzards indexed by their row/col and their direction. Then when I wanted to check whether a position was open, I got only the relevant blizzards, shifted them by the amount of time that had passed, and checked for collision. Whole thing runs both parts in 30s.
|
92
92
|
:replies: []
|
93
93
|
- :author: crazywulf
|
94
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1hbbuv
|
94
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zu28ij/2022_day_24_solutions/j1hbbuv
|
95
95
|
:body: "[Ruby](https://gist.github.com/rolfschmidt/a4cb3722b9339ea4691d586a43d09f78), 12 sec for both parts."
|
96
96
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: jstanley0
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1miman
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1miman
|
4
4
|
:body: |-
|
5
5
|
**Ruby**. Code golf coming full circle. ~~134 bytes~~ (EDIT: see replies, down to **111** so far). The first line converts and adds the input and the second line converts the answer to SNAFU. I feel like I should be able to tighten it.
|
6
6
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
```
|
11
11
|
:replies:
|
12
12
|
- :author: jstanley0
|
13
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1my0v1
|
13
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1my0v1
|
14
14
|
:body: |-
|
15
15
|
132 bytes. I could eliminate a comma on line one by using `_1` and `_2` in the block with two variables, and I could eliminate the parens on line 2 by moving the `tr` outside the loop, although I had to replace `$><<` with `puts` due to operator precedence so I just saved one byte there.
|
16
16
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
```
|
21
21
|
:replies:
|
22
22
|
- :author: jstanley0
|
23
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1mzmlr
|
23
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1mzmlr
|
24
24
|
:body: |-
|
25
25
|
for `r` in `0..4`, that horrible ternary `(r>2?1:0)` is equivalent to `r/3`. that saves me _six bytes_, bringing my total to **126** :
|
26
26
|
|
@@ -30,7 +30,7 @@
|
|
30
30
|
```
|
31
31
|
:replies:
|
32
32
|
- :author: jstanley0
|
33
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1w31h7
|
33
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1w31h7
|
34
34
|
:body: |-
|
35
35
|
simplifying part 2 and using the same digit string as the first line: **111**
|
36
36
|
|
@@ -41,7 +41,7 @@
|
|
41
41
|
```
|
42
42
|
:replies: []
|
43
43
|
- :author: careyi4
|
44
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1mbzpd
|
44
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1mbzpd
|
45
45
|
:body: |-
|
46
46
|
Ruby
|
47
47
|
|
@@ -50,7 +50,7 @@
|
|
50
50
|
Video Walkthrough: [YouTube](https://youtu.be/54WUMyWJars)
|
51
51
|
:replies: []
|
52
52
|
- :author: Elavid
|
53
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1l0sak
|
53
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1l0sak
|
54
54
|
:body: |-
|
55
55
|
## [Ruby](https://github.com/DavidEGrayson/adventofcode/blob/2e4ade3ec9de6690e62559daba758ebe02fa0689/2022_25/advent.rb), adding the SNAFU numbers directly without converting to integers
|
56
56
|
|
@@ -59,21 +59,21 @@
|
|
59
59
|
**Update:** The version I posted above converts individual SNAFU digits to integers and back to SNAFU, but that's not very cool. [Here is a new version that uses _no integers at all_.](https://github.com/DavidEGrayson/adventofcode/blob/327b66c17407f0398666af1ee9a6c4c0fc18aae5/2022_25/advent.rb)
|
60
60
|
:replies:
|
61
61
|
- :author: e_blake
|
62
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1pzwur
|
62
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1pzwur
|
63
63
|
:body: |-
|
64
64
|
Looks similar to [mine](https://www.reddit.com/r/adventofcode/comments/zvduql/2022_day_25m4_solution_without_doing_any_addition/?utm_source=share&utm_medium=web2x&context=3), except I coded my lookup table with DMZOT to avoid even the appearance of integers in my table ;)
|
65
65
|
|
66
66
|
And yes, the technique of building up adder/carry on smaller chunks from right to left is how arbitrary-precision big integer libraries work; it's just a tradeoff of whether the smaller adds can be performed directly by lookup table (as is possible with base-5 SNAFU) or utilizes smaller-precision integer math while building up to the larger precision.
|
67
67
|
:replies: []
|
68
68
|
- :author: dong_chinese
|
69
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1l15ai
|
69
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1l15ai
|
70
70
|
:body: Awesome, most creative solution I've seen so far.
|
71
71
|
:replies:
|
72
72
|
- :author: Elavid
|
73
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1lbib2
|
73
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1lbib2
|
74
74
|
:body: Well, I'm more deserving of that comment now that I've posted a new version with no integers being used at all.
|
75
75
|
:replies: []
|
76
76
|
- :author: Nnnes
|
77
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1l1d2h
|
77
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zur1an/2022_day_25_solutions/j1l1d2h
|
78
78
|
:body: "# Ruby\n\n116/100 I got my first point since day 1 \U0001F389\n\n```ruby\ndef s2d(s) = s.tr('=\\-012', '01234').to_i(5).then{ |x|\n x - ('2' * x.to_s(5).size).to_i(5) }\ndef d2s(d) = (('2' * d.to_s(5).size).to_i(5) + d).to_s(5).tr('01234', '=\\-012')\n\nputs d2s(STDIN.readlines.map{ |x| s2d(x) }.sum)\n```\n\nDon't need any modulos or iterating over digits with this method. Just some conversion in and out of normal base 5.\n\n> !my actual solution was to manually change digits until it matched lol. I wrote this afterwards!\\<"
|
79
79
|
:replies: []
|