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.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/bin/arb +1 -1
  3. data/data/solutions/reddit/ruby/2015/02.yml +5 -5
  4. data/data/solutions/reddit/ruby/2015/03.yml +6 -6
  5. data/data/solutions/reddit/ruby/2015/04.yml +7 -7
  6. data/data/solutions/reddit/ruby/2015/05.yml +6 -6
  7. data/data/solutions/reddit/ruby/2015/06.yml +14 -14
  8. data/data/solutions/reddit/ruby/2015/07.yml +15 -15
  9. data/data/solutions/reddit/ruby/2015/08.yml +6 -6
  10. data/data/solutions/reddit/ruby/2015/09.yml +11 -11
  11. data/data/solutions/reddit/ruby/2015/10.yml +18 -18
  12. data/data/solutions/reddit/ruby/2015/11.yml +19 -19
  13. data/data/solutions/reddit/ruby/2015/12.yml +10 -10
  14. data/data/solutions/reddit/ruby/2015/13.yml +9 -9
  15. data/data/solutions/reddit/ruby/2015/14.yml +11 -11
  16. data/data/solutions/reddit/ruby/2015/15.yml +9 -9
  17. data/data/solutions/reddit/ruby/2015/16.yml +7 -7
  18. data/data/solutions/reddit/ruby/2015/17.yml +10 -10
  19. data/data/solutions/reddit/ruby/2015/18.yml +4 -4
  20. data/data/solutions/reddit/ruby/2015/19.yml +1 -1
  21. data/data/solutions/reddit/ruby/2015/20.yml +2 -2
  22. data/data/solutions/reddit/ruby/2015/21.yml +4 -4
  23. data/data/solutions/reddit/ruby/2015/22.yml +5 -5
  24. data/data/solutions/reddit/ruby/2015/23.yml +3 -3
  25. data/data/solutions/reddit/ruby/2015/24.yml +11 -11
  26. data/data/solutions/reddit/ruby/2015/25.yml +5 -5
  27. data/data/solutions/reddit/ruby/2016/01.yml +5 -5
  28. data/data/solutions/reddit/ruby/2016/02.yml +3 -3
  29. data/data/solutions/reddit/ruby/2016/03.yml +1 -1
  30. data/data/solutions/reddit/ruby/2016/04.yml +4 -4
  31. data/data/solutions/reddit/ruby/2016/05.yml +3 -3
  32. data/data/solutions/reddit/ruby/2016/06.yml +4 -4
  33. data/data/solutions/reddit/ruby/2016/07.yml +3 -3
  34. data/data/solutions/reddit/ruby/2016/08.yml +6 -6
  35. data/data/solutions/reddit/ruby/2016/09.yml +1 -1
  36. data/data/solutions/reddit/ruby/2016/10.yml +3 -3
  37. data/data/solutions/reddit/ruby/2016/11.yml +1 -1
  38. data/data/solutions/reddit/ruby/2016/12.yml +3 -3
  39. data/data/solutions/reddit/ruby/2016/14.yml +4 -4
  40. data/data/solutions/reddit/ruby/2016/15.yml +11 -11
  41. data/data/solutions/reddit/ruby/2016/16.yml +1 -1
  42. data/data/solutions/reddit/ruby/2016/17.yml +3 -3
  43. data/data/solutions/reddit/ruby/2016/18.yml +3 -3
  44. data/data/solutions/reddit/ruby/2016/20.yml +2 -2
  45. data/data/solutions/reddit/ruby/2016/21.yml +7 -7
  46. data/data/solutions/reddit/ruby/2016/22.yml +10 -10
  47. data/data/solutions/reddit/ruby/2017/01.yml +7 -7
  48. data/data/solutions/reddit/ruby/2017/02.yml +15 -15
  49. data/data/solutions/reddit/ruby/2017/03.yml +9 -9
  50. data/data/solutions/reddit/ruby/2017/04.yml +4 -4
  51. data/data/solutions/reddit/ruby/2017/05.yml +12 -12
  52. data/data/solutions/reddit/ruby/2017/06.yml +16 -16
  53. data/data/solutions/reddit/ruby/2017/07.yml +5 -5
  54. data/data/solutions/reddit/ruby/2017/08.yml +18 -18
  55. data/data/solutions/reddit/ruby/2017/09.yml +7 -7
  56. data/data/solutions/reddit/ruby/2017/10.yml +9 -9
  57. data/data/solutions/reddit/ruby/2017/11.yml +1 -1
  58. data/data/solutions/reddit/ruby/2017/12.yml +6 -6
  59. data/data/solutions/reddit/ruby/2017/13.yml +6 -6
  60. data/data/solutions/reddit/ruby/2017/14.yml +1 -1
  61. data/data/solutions/reddit/ruby/2017/15.yml +3 -3
  62. data/data/solutions/reddit/ruby/2017/16.yml +5 -5
  63. data/data/solutions/reddit/ruby/2017/17.yml +6 -6
  64. data/data/solutions/reddit/ruby/2017/18.yml +7 -7
  65. data/data/solutions/reddit/ruby/2017/19.yml +2 -2
  66. data/data/solutions/reddit/ruby/2017/20.yml +5 -5
  67. data/data/solutions/reddit/ruby/2017/21.yml +11 -11
  68. data/data/solutions/reddit/ruby/2017/22.yml +1 -1
  69. data/data/solutions/reddit/ruby/2017/23.yml +1 -1
  70. data/data/solutions/reddit/ruby/2017/25.yml +3 -3
  71. data/data/solutions/reddit/ruby/2018/01.yml +20 -20
  72. data/data/solutions/reddit/ruby/2018/02.yml +16 -16
  73. data/data/solutions/reddit/ruby/2018/03.yml +12 -12
  74. data/data/solutions/reddit/ruby/2018/04.yml +6 -6
  75. data/data/solutions/reddit/ruby/2018/05.yml +15 -15
  76. data/data/solutions/reddit/ruby/2018/06.yml +4 -4
  77. data/data/solutions/reddit/ruby/2018/07.yml +11 -11
  78. data/data/solutions/reddit/ruby/2018/08.yml +9 -9
  79. data/data/solutions/reddit/ruby/2018/09.yml +13 -13
  80. data/data/solutions/reddit/ruby/2018/10.yml +10 -10
  81. data/data/solutions/reddit/ruby/2018/11.yml +9 -9
  82. data/data/solutions/reddit/ruby/2018/12.yml +2 -2
  83. data/data/solutions/reddit/ruby/2018/13.yml +14 -14
  84. data/data/solutions/reddit/ruby/2018/14.yml +5 -5
  85. data/data/solutions/reddit/ruby/2018/15.yml +2 -2
  86. data/data/solutions/reddit/ruby/2018/16.yml +7 -7
  87. data/data/solutions/reddit/ruby/2018/17.yml +1 -1
  88. data/data/solutions/reddit/ruby/2018/18.yml +6 -6
  89. data/data/solutions/reddit/ruby/2018/19.yml +1 -1
  90. data/data/solutions/reddit/ruby/2018/20.yml +1 -1
  91. data/data/solutions/reddit/ruby/2018/21.yml +4 -4
  92. data/data/solutions/reddit/ruby/2018/22.yml +3 -3
  93. data/data/solutions/reddit/ruby/2018/23.yml +11 -11
  94. data/data/solutions/reddit/ruby/2018/24.yml +4 -4
  95. data/data/solutions/reddit/ruby/2018/25.yml +6 -6
  96. data/data/solutions/reddit/ruby/2019/01.yml +11 -11
  97. data/data/solutions/reddit/ruby/2019/02.yml +13 -13
  98. data/data/solutions/reddit/ruby/2019/03.yml +7 -7
  99. data/data/solutions/reddit/ruby/2019/04.yml +11 -11
  100. data/data/solutions/reddit/ruby/2019/05.yml +10 -10
  101. data/data/solutions/reddit/ruby/2019/06.yml +7 -7
  102. data/data/solutions/reddit/ruby/2019/07.yml +8 -8
  103. data/data/solutions/reddit/ruby/2019/08.yml +8 -8
  104. data/data/solutions/reddit/ruby/2019/09.yml +4 -4
  105. data/data/solutions/reddit/ruby/2019/10.yml +4 -4
  106. data/data/solutions/reddit/ruby/2019/11.yml +7 -7
  107. data/data/solutions/reddit/ruby/2019/12.yml +17 -17
  108. data/data/solutions/reddit/ruby/2019/13.yml +6 -6
  109. data/data/solutions/reddit/ruby/2019/14.yml +2 -2
  110. data/data/solutions/reddit/ruby/2019/15.yml +3 -3
  111. data/data/solutions/reddit/ruby/2019/16.yml +6 -6
  112. data/data/solutions/reddit/ruby/2019/17.yml +3 -3
  113. data/data/solutions/reddit/ruby/2019/18.yml +1 -1
  114. data/data/solutions/reddit/ruby/2019/20.yml +9 -9
  115. data/data/solutions/reddit/ruby/2019/21.yml +3 -3
  116. data/data/solutions/reddit/ruby/2019/22.yml +3 -3
  117. data/data/solutions/reddit/ruby/2019/23.yml +1 -1
  118. data/data/solutions/reddit/ruby/2019/25.yml +2 -2
  119. data/data/solutions/reddit/ruby/2020/01.yml +30 -30
  120. data/data/solutions/reddit/ruby/2020/02.yml +25 -25
  121. data/data/solutions/reddit/ruby/2020/03.yml +17 -17
  122. data/data/solutions/reddit/ruby/2020/04.yml +26 -26
  123. data/data/solutions/reddit/ruby/2020/05.yml +35 -35
  124. data/data/solutions/reddit/ruby/2020/06.yml +40 -40
  125. data/data/solutions/reddit/ruby/2020/07.yml +16 -16
  126. data/data/solutions/reddit/ruby/2020/08.yml +13 -13
  127. data/data/solutions/reddit/ruby/2020/09.yml +21 -21
  128. data/data/solutions/reddit/ruby/2020/10.yml +29 -29
  129. data/data/solutions/reddit/ruby/2020/11.yml +8 -8
  130. data/data/solutions/reddit/ruby/2020/12.yml +22 -22
  131. data/data/solutions/reddit/ruby/2020/13.yml +15 -15
  132. data/data/solutions/reddit/ruby/2020/14.yml +11 -11
  133. data/data/solutions/reddit/ruby/2020/15.yml +9 -9
  134. data/data/solutions/reddit/ruby/2020/16.yml +13 -13
  135. data/data/solutions/reddit/ruby/2020/17.yml +11 -11
  136. data/data/solutions/reddit/ruby/2020/18.yml +19 -19
  137. data/data/solutions/reddit/ruby/2020/19.yml +18 -18
  138. data/data/solutions/reddit/ruby/2020/20.yml +4 -4
  139. data/data/solutions/reddit/ruby/2020/21.yml +4 -4
  140. data/data/solutions/reddit/ruby/2020/22.yml +8 -8
  141. data/data/solutions/reddit/ruby/2020/23.yml +4 -4
  142. data/data/solutions/reddit/ruby/2020/24.yml +6 -6
  143. data/data/solutions/reddit/ruby/2020/25.yml +6 -6
  144. data/data/solutions/reddit/ruby/2021/01.yml +74 -74
  145. data/data/solutions/reddit/ruby/2021/02.yml +45 -45
  146. data/data/solutions/reddit/ruby/2021/03.yml +43 -43
  147. data/data/solutions/reddit/ruby/2021/04.yml +23 -23
  148. data/data/solutions/reddit/ruby/2021/05.yml +16 -16
  149. data/data/solutions/reddit/ruby/2021/06.yml +35 -35
  150. data/data/solutions/reddit/ruby/2021/07.yml +26 -26
  151. data/data/solutions/reddit/ruby/2021/08.yml +15 -15
  152. data/data/solutions/reddit/ruby/2021/09.yml +11 -11
  153. data/data/solutions/reddit/ruby/2021/10.yml +9 -9
  154. data/data/solutions/reddit/ruby/2021/11.yml +12 -12
  155. data/data/solutions/reddit/ruby/2021/12.yml +8 -8
  156. data/data/solutions/reddit/ruby/2021/13.yml +13 -13
  157. data/data/solutions/reddit/ruby/2021/14.yml +10 -10
  158. data/data/solutions/reddit/ruby/2021/15.yml +10 -10
  159. data/data/solutions/reddit/ruby/2021/16.yml +8 -8
  160. data/data/solutions/reddit/ruby/2021/17.yml +6 -6
  161. data/data/solutions/reddit/ruby/2021/18.yml +5 -5
  162. data/data/solutions/reddit/ruby/2021/19.yml +3 -3
  163. data/data/solutions/reddit/ruby/2021/20.yml +5 -5
  164. data/data/solutions/reddit/ruby/2021/21.yml +5 -5
  165. data/data/solutions/reddit/ruby/2021/22.yml +4 -4
  166. data/data/solutions/reddit/ruby/2021/23.yml +7 -7
  167. data/data/solutions/reddit/ruby/2021/24.yml +8 -8
  168. data/data/solutions/reddit/ruby/2021/25.yml +4 -4
  169. data/data/solutions/reddit/ruby/2022/01.yml +29 -29
  170. data/data/solutions/reddit/ruby/2022/02.yml +21 -21
  171. data/data/solutions/reddit/ruby/2022/03.yml +35 -35
  172. data/data/solutions/reddit/ruby/2022/04.yml +42 -42
  173. data/data/solutions/reddit/ruby/2022/05.yml +29 -29
  174. data/data/solutions/reddit/ruby/2022/06.yml +38 -38
  175. data/data/solutions/reddit/ruby/2022/07.yml +25 -25
  176. data/data/solutions/reddit/ruby/2022/08.yml +9 -9
  177. data/data/solutions/reddit/ruby/2022/09.yml +18 -18
  178. data/data/solutions/reddit/ruby/2022/10.yml +14 -14
  179. data/data/solutions/reddit/ruby/2022/11.yml +7 -7
  180. data/data/solutions/reddit/ruby/2022/12.yml +2 -2
  181. data/data/solutions/reddit/ruby/2022/13.yml +9 -9
  182. data/data/solutions/reddit/ruby/2022/14.yml +5 -5
  183. data/data/solutions/reddit/ruby/2022/15.yml +6 -6
  184. data/data/solutions/reddit/ruby/2022/16.yml +5 -5
  185. data/data/solutions/reddit/ruby/2022/17.yml +2 -2
  186. data/data/solutions/reddit/ruby/2022/18.yml +6 -6
  187. data/data/solutions/reddit/ruby/2022/19.yml +3 -3
  188. data/data/solutions/reddit/ruby/2022/20.yml +12 -12
  189. data/data/solutions/reddit/ruby/2022/21.yml +11 -11
  190. data/data/solutions/reddit/ruby/2022/22.yml +4 -4
  191. data/data/solutions/reddit/ruby/2022/24.yml +10 -10
  192. data/data/solutions/reddit/ruby/2022/25.yml +10 -10
  193. data/data/solutions/reddit/ruby/2023/01.yml +52 -52
  194. data/data/solutions/reddit/ruby/2023/02.yml +21 -21
  195. data/data/solutions/reddit/ruby/2023/03.yml +18 -18
  196. data/data/solutions/reddit/ruby/2023/04.yml +31 -31
  197. data/data/solutions/reddit/ruby/2023/05.yml +14 -14
  198. data/data/solutions/reddit/ruby/2023/06.yml +24 -24
  199. data/data/solutions/reddit/ruby/2023/07.yml +32 -32
  200. data/data/solutions/reddit/ruby/2023/08.yml +20 -20
  201. data/data/solutions/reddit/ruby/2023/09.yml +32 -32
  202. data/data/solutions/reddit/ruby/2023/10.yml +18 -18
  203. data/data/solutions/reddit/ruby/2023/11.yml +16 -16
  204. data/data/solutions/reddit/ruby/2023/12.yml +5 -5
  205. data/data/solutions/reddit/ruby/2023/13.yml +6 -6
  206. data/data/solutions/reddit/ruby/2023/14.yml +14 -14
  207. data/data/solutions/reddit/ruby/2023/15.yml +13 -13
  208. data/data/solutions/reddit/ruby/2023/16.yml +8 -8
  209. data/data/solutions/reddit/ruby/2023/18.yml +5 -5
  210. data/data/solutions/reddit/ruby/2023/19.yml +6 -6
  211. data/data/solutions/reddit/ruby/2023/20.yml +9 -9
  212. data/data/solutions/reddit/ruby/2023/21.yml +5 -5
  213. data/data/solutions/reddit/ruby/2023/22.yml +2 -2
  214. data/data/solutions/reddit/ruby/2023/23.yml +1 -1
  215. data/data/solutions/reddit/ruby/2023/25.yml +1 -1
  216. data/data/solutions/reddit/ruby/2024/01.yml +15 -15
  217. data/data/solutions/reddit/ruby/2024/02.yml +17 -17
  218. data/data/solutions/reddit/ruby/2024/03.yml +43 -43
  219. data/data/solutions/reddit/ruby/2024/04.yml +18 -18
  220. data/data/solutions/reddit/ruby/2024/05.yml +29 -29
  221. data/data/solutions/reddit/ruby/2024/06.yml +19 -19
  222. data/data/solutions/reddit/ruby/2024/07.yml +26 -26
  223. data/data/solutions/reddit/ruby/2024/08.yml +15 -15
  224. data/data/solutions/reddit/ruby/2024/09.yml +5 -5
  225. data/data/solutions/reddit/ruby/2024/10.yml +9 -9
  226. data/data/solutions/reddit/ruby/2024/11.yml +15 -15
  227. data/data/solutions/reddit/ruby/2024/12.yml +9 -9
  228. data/data/solutions/reddit/ruby/2024/13.yml +10 -10
  229. data/data/solutions/reddit/ruby/2024/14.yml +6 -6
  230. data/data/solutions/reddit/ruby/2024/15.yml +5 -5
  231. data/data/solutions/reddit/ruby/2024/16.yml +4 -4
  232. data/data/solutions/reddit/ruby/2024/17.yml +11 -11
  233. data/data/solutions/reddit/ruby/2024/18.yml +9 -9
  234. data/data/solutions/reddit/ruby/2024/19.yml +16 -16
  235. data/data/solutions/reddit/ruby/2024/20.yml +8 -8
  236. data/data/solutions/reddit/ruby/2024/21.yml +3 -3
  237. data/data/solutions/reddit/ruby/2024/22.yml +8 -8
  238. data/data/solutions/reddit/ruby/2024/23.yml +13 -13
  239. data/data/solutions/reddit/ruby/2024/24.yml +7 -7
  240. data/data/solutions/reddit/ruby/2024/25.yml +14 -14
  241. data/lib/arb/api/aoc.rb +2 -2
  242. data/lib/arb/cli/run.rb +2 -3
  243. data/lib/arb/version.rb +1 -1
  244. data/lib/download_solutions/api/reddit/get_serial_comments.rb +1 -1
  245. metadata +2 -2
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  - :author: comforttiger
3
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kcauzex/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kcauzex
4
4
  :body: |-
5
5
  i started teaching myself ruby a few days ago, so i've been doing advent of code in it too.
6
6
 
@@ -9,21 +9,21 @@
9
9
  https://github.com/comforttiger/advent_of_code/blob/main/2023/ruby/day6.rb
10
10
  :replies: []
11
11
  - :author: HAEC_EST_SPARTA
12
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6z2sf/
12
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6z2sf
13
13
  :body: |-
14
14
  ##### [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2023-ruby/item/lib/day06.rb)
15
15
 
16
16
  I did some basic algebra to compute the bounds of the hold times that would result in winning distances, but I'm now seeing from other posts here that I could have just brute-forced the result. Engineers, always making everything more difficult than it needs to be :)
17
17
  :replies:
18
18
  - :author: glebm
19
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc741f1/
19
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc741f1
20
20
  :body: |-
21
21
  The algebraic solution also has a bug because it solves for \>= distance but the problem asks for strict inequality. Example input: time = 8, distance = 12, answer = 3.
22
22
 
23
23
  Noticed this in my own algebraic solution after seeing u/maths222 answer in https://www.reddit.com/r/adventofcode/comments/18bwe6t/comment/kc6y799/
24
24
  :replies:
25
25
  - :author: HAEC_EST_SPARTA
26
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc75kx3/
26
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc75kx3
27
27
  :body: |-
28
28
  My solution does give the correct result in this case:
29
29
 
@@ -37,7 +37,7 @@
37
37
  Thanks for the shout regardless: this comment made me do some more analysis regarding exactly why the root adjustment scheme works, which was fun to work through!
38
38
  :replies:
39
39
  - :author: glebm
40
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc76e58/
40
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc76e58
41
41
  :body: |-
42
42
  Ah, got you!
43
43
 
@@ -56,11 +56,11 @@
56
56
  by u/mebeim in https://www.reddit.com/r/adventofcode/comments/18bwe6t/comment/kc74csg/?utm_source=share&utm_medium=web2x&context=3
57
57
  :replies:
58
58
  - :author: HAEC_EST_SPARTA
59
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc76to8/
59
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc76to8
60
60
  :body: 'Oh nice! I hadn''t thought about adjusting the roots beyond the range of the inequality: thanks for pointing that out!'
61
61
  :replies: []
62
62
  - :author: dhruvasagar
63
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7c7ag/
63
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7c7ag
64
64
  :body: |-
65
65
  ```ruby
66
66
  def read_input
@@ -88,7 +88,7 @@
88
88
  ```
89
89
  :replies: []
90
90
  - :author: careyi4
91
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7zfqj/
91
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7zfqj
92
92
  :body: |-
93
93
  Quadratic formula for the win!!
94
94
 
@@ -97,7 +97,7 @@
97
97
  [Video Walkthrough](https://youtu.be/ILMuzedm4uA)
98
98
  :replies: []
99
99
  - :author: Symbroson
100
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc806ei/
100
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc806ei
101
101
  :body: |-
102
102
  Disclaimer: I love short and concise code while keeping it relatively readable, And I love messy golf code as well - so this post concludes my journey to the shortest golf code version for todays puzzle, collecting 5 different solving methods on the way. I applied it in ruby but I am certain that this version can be applied to most other languages as well.
103
103
 
@@ -138,7 +138,7 @@
138
138
  Thanks for reading. If you have ideas for optimizing or want to showcase your own shorties feel free to share :)
139
139
  :replies:
140
140
  - :author: petercooper
141
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc88ggj/
141
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc88ggj
142
142
  :body: |-
143
143
  Ooh, I like how you've reused the code and also included multiple approaches. I also golfed it in Ruby but was more just focused on getting the end result so it came out rather differently:
144
144
 
@@ -152,7 +152,7 @@
152
152
  Also `reduce(&:*)` can become `reduce :*`
153
153
  :replies: []
154
154
  - :author: glebm
155
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6wyz0/
155
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6wyz0
156
156
  :body: |-
157
157
  Part 1:
158
158
 
@@ -219,7 +219,7 @@
219
219
  ```
220
220
  :replies: []
221
221
  - :author: maths222
222
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6y799/
222
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6y799
223
223
  :body: |-
224
224
  3175/1794
225
225
 
@@ -228,7 +228,7 @@
228
228
  [code](https://gist.github.com/maths22/52163cd7b40e149fc35e7784b8032914)
229
229
  :replies: []
230
230
  - :author: kwitczak
231
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc78khj/
231
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc78khj
232
232
  :body: |-
233
233
  Part 2, attempted the binary search approach. I feel it's overcomplicated and could be simplified/shortened. Execution time is around 0.3 ms, previous brute-force was around 3.5 seconds.
234
234
 
@@ -271,7 +271,7 @@
271
271
  ```
272
272
  :replies: []
273
273
  - :author: Annual-Management613
274
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc797he/
274
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc797he
275
275
  :body: |-
276
276
  Nothing to be proud of xD.
277
277
 
@@ -302,7 +302,7 @@
302
302
  ```
303
303
  :replies: []
304
304
  - :author: vinc686
305
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7ao5c/
305
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7ao5c
306
306
  :body: |-
307
307
  Part 1
308
308
 
@@ -321,7 +321,7 @@
321
321
  This one was fun and easy, a nice way to start the morning in Europe :)
322
322
  :replies: []
323
323
  - :author: Symbroson
324
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7q8zq/
324
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7q8zq
325
325
  :body: |-
326
326
  My lazy ass 6am brain did not realize you could just like _solve_ the problem like a sane person would using basic maths. `sqrt(t^2 - 4 * d)` is all it requires to solve this problem. **Or so I thought**
327
327
 
@@ -347,7 +347,7 @@
347
347
  [Edit] Improved Golf Bytecount
348
348
  :replies: []
349
349
  - :author: swhitt
350
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc8uder/
350
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc8uder
351
351
  :body: |-
352
352
  [day06.rb](https://gist.github.com/swhitt/8b74be95824d43df030887a46e23454d)
353
353
 
@@ -356,7 +356,7 @@
356
356
  I only looked at the input file once completing my initial part 1 solution and was pleasantly surprised.
357
357
  :replies: []
358
358
  - :author: tenderlove
359
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc8zdc2/
359
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc8zdc2
360
360
  :body: |-
361
361
  Part 1:
362
362
 
@@ -394,7 +394,7 @@
394
394
  ```
395
395
  :replies: []
396
396
  - :author: _tfa
397
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc98wxt/
397
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc98wxt
398
398
  :body: |-
399
399
  ```ruby
400
400
  # Time: 51 69 98 78
@@ -415,7 +415,7 @@
415
415
  ```
416
416
  :replies: []
417
417
  - :author: Potential-Series-105
418
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc9pb1q/
418
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc9pb1q
419
419
  :body: |-
420
420
  Part 1 just under a hundred bytes with 99 bytes total:
421
421
 
@@ -424,7 +424,7 @@
424
424
  ```
425
425
  :replies: []
426
426
  - :author: coderhs
427
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6yjzm/
427
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc6yjzm
428
428
  :body: |-
429
429
  Considering the small size of today's input I just typed it in.
430
430
 
@@ -447,7 +447,7 @@
447
447
  ```
448
448
  :replies: []
449
449
  - :author: Symbroson
450
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc72hkn/
450
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc72hkn
451
451
  :body: |-
452
452
  Part 2 can be optimized by searching from the middle to the first distance that is lower than the record. part 2 still takes 2.5 seconds but managable.
453
453
 
@@ -482,7 +482,7 @@
482
482
  ```
483
483
  :replies:
484
484
  - :author: Symbroson
485
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7p1t2/
485
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc7p1t2
486
486
  :body: |-
487
487
  I noticed that the code didnt work for the test input any more. I fixed this and also shortened the code quite a bit by extracting a function and better parsing:
488
488
 
@@ -497,7 +497,7 @@
497
497
  ```
498
498
  :replies: []
499
499
  - :author: Sharparam
500
- :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc758e3/
500
+ :url: https://www.reddit.com/r/adventofcode/comments/18bwe6t/2023_day_6_solutions/kc758e3
501
501
  :body: |-
502
502
  ```ruby
503
503
  times, distances = ARGF.readlines.map { _1.scan(/\d+/).map(&:to_i) }
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  - :author: snowe2010
3
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcgpsmc/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcgpsmc
4
4
  :body: https://github.com/snowe2010/advent-of-code/blob/master/ruby\_aoc/2023/day07/day07.rb
5
5
  :replies: []
6
6
  - :author: Symbroson
7
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kce2h0w/
7
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kce2h0w
8
8
  :body: |-
9
9
  Update to my [previous solution](https://www.reddit.com/r/adventofcode/comments/18cnzbm/comment/kccvf0a/), applying shannons entropy as suggested by u/sinsworth [here](https://www.reddit.com/r/adventofcode/comments/18cnzbm/comment/kccov05/)
10
10
 
@@ -35,7 +35,7 @@
35
35
  ```
36
36
  :replies:
37
37
  - :author: Symbroson
38
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kce8jgl/
38
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kce8jgl
39
39
  :body: |-
40
40
  Another update - feel kinda silly because my strength function returned a char (string), and my sorting function would convert it to a string again. I also realized that I could omit the custom sorting function completely by just prepending the strength char to the initial hand.
41
41
 
@@ -62,7 +62,7 @@
62
62
  ```
63
63
  :replies:
64
64
  - :author: azzal07
65
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kceusyw/
65
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kceusyw
66
66
  :body: |-
67
67
  Neat!
68
68
 
@@ -82,14 +82,14 @@
82
82
  ```
83
83
  :replies:
84
84
  - :author: Symbroson
85
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch4ill/
85
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch4ill
86
86
  :body: |-
87
87
  Very cool. Definitely didnt see how I could optimize the parsing the way you did. Followed you changes by adjusting my code step by step.Did you intentionally use `c=c.tr` instead of `c.tr!` to make it exactly `4x70`?
88
88
 
89
89
  Edit: Recently found out about more ways to call lambdas. One more byte can be saved by using `c[...]` instead of `c.(...)`
90
90
  :replies:
91
91
  - :author: azzal07
92
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch7z3v/
92
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch7z3v
93
93
  :body: |-
94
94
  Yes, that was very much intentional.
95
95
 
@@ -98,15 +98,15 @@
98
98
  I ended up shrinking that quite a bit further by combining u/Any-Razzmatazz-4792's solution.
99
99
  :replies:
100
100
  - :author: Symbroson
101
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch9kkw/
101
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch9kkw
102
102
  :body: yes that one is insane. I asked him to explain what that sum function does at the end because that expression looks just wild
103
103
  :replies: []
104
104
  - :author: Any-Razzmatazz-4792
105
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcfj1pk/
105
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcfj1pk
106
106
  :body: 'I love golfing in ruby, and I was golfing this one too. I got 125 bytes for pt1 and 165 for pt2 (those counts don''t include the shebang line). Here are my solutions: https://github.com/Nico-Posada/Advent-Of-Code-2023/tree/main/Day-7'
107
107
  :replies:
108
108
  - :author: Symbroson
109
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcgp8r5/
109
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcgp8r5
110
110
  :body: |-
111
111
  Yours look wild. Could you explain your solution a bit?
112
112
 
@@ -119,14 +119,14 @@
119
119
  and how does the sum function at the end work?
120
120
  :replies:
121
121
  - :author: Any-Razzmatazz-4792
122
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcgpyxy/
122
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcgpyxy
123
123
  :body: |-
124
124
  in ruby, regex matching returns the index of where the regex matched in the comparison string. Another weird quirk is that it accepts symbols as strings so thats the second optimization. So using those two in combination, I do a regex match of the symbol to return the index of the character in that symbol to determine its importance.
125
125
 
126
126
  And sum is just like map, but it adds all the values of the array at the very end and returns that. A simpler way to use sum would be to do [1,2,3].sum which returns 6. Doing [1,2,3].sum{\_1+1} would convert the array to [2,3,4], and then it would sum them together.
127
127
  :replies:
128
128
  - :author: Symbroson
129
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch6ypg/
129
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch6ypg
130
130
  :body: |-
131
131
  thanks for the explanation
132
132
 
@@ -135,11 +135,11 @@
135
135
  `_2.to_i * -~$. -= 1`
136
136
  :replies:
137
137
  - :author: Any-Razzmatazz-4792
138
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kchaloo/
138
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kchaloo
139
139
  :body: "$. just contains the number of lines read from the stdin. The next thing i had to do to make this work was reverse my sorting method so that the array will sort from best to worst instead of worst to best. From there, it'll start with the best one (for this example lets say the numbers are 700, 600, 500, 400, 300, 200, 100). In the first case, $. will be 7 since in this fake scenario, we have read from the stdin 7 times. We need to keep in mind that we need to decrement $. by one for the next case, but we also need to preserve the value of it for the current case, and a good solution for doing that is using -~. We can decrement $. by doing $.-=1, and -~ is just a shorthand way of saying +1 (use ~- if you want to do -1). I just went with using -~ because both ~ and - have a higher precedence than any other operator, so instead of needing to do (1+$.-=1), i can omit those parenthesis and just do -~$.-=1. With all that in place, I am able to multiply each hand ID by the proper number to get the solution"
140
140
  :replies: []
141
141
  - :author: azzal07
142
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch7ba8/
142
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kch7ba8
143
143
  :body: |-
144
144
  Got it down to 158 (2 x 79, but the line break is sacrificial) for both parts:
145
145
 
@@ -164,35 +164,35 @@
164
164
  I'm not too familiar with ruby, so there could still be some opportunities left.
165
165
  :replies:
166
166
  - :author: Any-Razzmatazz-4792
167
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kchb63y/
167
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kchb63y
168
168
  :body: |-
169
169
  I'm gonna be honest, I have no clue how this works, but it works. It's even more crazy that you're "not too familiar with ruby" and still pulled this off! I haven't dug too deep, but an immediate 2 byte save would be doing d=\*$\< instead of d=[\*$\<]
170
170
 
171
171
  Edit: And the fact that it prints both answers... wtf
172
172
  :replies:
173
173
  - :author: azzal07
174
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kchfuix/
174
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kchfuix
175
175
  :body: |-
176
176
  I took the hand type evaluation from your part 2 solution and compacted from there (e.g. I compensate `g.size == 0` with the `g.values.max||-1` to save the intermediate and a ternary). For the original hand, I replace the alphabetically out of place characters, so it sorts properly. For part 1 I replace `J` with `J`, and for part 2 with `!` (anything \< 0, 0 won't work because that could affect the bid).
177
177
 
178
178
  That `d=*$<` is nice.
179
179
  :replies: []
180
180
  - :author: Sharparam
181
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc12z0/
181
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc12z0
182
182
  :body: |-
183
183
  A wordy one today, and a bit big to paste here: https://github.com/Sharparam/advent-of-code/blob/main/src/2023/07/solve.rb
184
184
 
185
185
  Not very difficult for an odd day :)
186
186
  :replies: []
187
187
  - :author: Piggelinmannen
188
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kccdu28/
188
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kccdu28
189
189
  :body: |-
190
190
  Struggled a bit with base case (all jokers etc) in part b.
191
191
 
192
192
  [Link to file in github](https://github.com/jlugner/2023-aoc/blob/master/solutions/day7/solution.rb)
193
193
  :replies: []
194
194
  - :author: comforttiger
195
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcceb9r/
195
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcceb9r
196
196
  :body: |-
197
197
  https://github.com/comforttiger/advent_of_code/blob/main/2023/ruby/day7.rb
198
198
 
@@ -201,7 +201,7 @@
201
201
  i didnt think super hard about my part 2 solution, i just kind of assumed that you'll get the best type possible by putting all the jokers in the biggest stack. its very satisfying when an assumption like that turns out correct!
202
202
  :replies: []
203
203
  - :author: glebm
204
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcckjfy/
204
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcckjfy
205
205
  :body: |-
206
206
  Part 1:
207
207
 
@@ -264,7 +264,7 @@
264
264
  All solutions: https://github.com/glebm/advent-of-code
265
265
  :replies: []
266
266
  - :author: SleepingInsomniac
267
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kceqv1x/
267
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kceqv1x
268
268
  :body: |-
269
269
  [Part 1](https://github.com/SleepingInsomniac/adventofcode2023/blob/master/2023-12-07/part_1.rb)
270
270
 
@@ -300,7 +300,7 @@
300
300
  ```
301
301
  :replies: []
302
302
  - :author: maths222
303
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcbyumt/
303
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcbyumt
304
304
  :body: |-
305
305
  465/532
306
306
 
@@ -309,22 +309,22 @@
309
309
  [code](https://gist.github.com/maths22/a723e4576864b244c8dd2d349d817fbb)
310
310
  :replies:
311
311
  - :author: campsight46
312
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc08l9/
312
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc08l9
313
313
  :body: link is to day 6? (and the code is not for day6 of this year?)
314
314
  :replies:
315
315
  - :author: maths222
316
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc36rh/
316
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc36rh
317
317
  :body: Well bleh. Thanks for letting me know; I've now fixed it
318
318
  :replies: []
319
319
  - :author: HAEC_EST_SPARTA
320
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc6kmv/
320
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcc6kmv
321
321
  :body: |-
322
322
  ##### [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2023-ruby/item/lib/day07.rb)
323
323
 
324
324
  This was a fun problem! After solving, I refactored my solution to make it capable of handling both parts with only a one-line change: the fact that Jokers are assigned a relative strength less than 2 made this change somewhat trivial. I'm also somewhat pleased with my encoding of the card type as a sum of powers: that's not a trick you get to use too often!
325
325
  :replies: []
326
326
  - :author: Symbroson
327
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kccvf0a/
327
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kccvf0a
328
328
  :body: |-
329
329
  Took me longer than expected to solve and I spent quite a while to make it as concise as it is right now:
330
330
 
@@ -362,7 +362,7 @@
362
362
  That sub 400 looks just out of reach...
363
363
  :replies: []
364
364
  - :author: careyi4
365
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcd1435/
365
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcd1435
366
366
  :body: |-
367
367
  Nice one today!!
368
368
 
@@ -371,15 +371,15 @@
371
371
  [Video Walkthrough](https://youtu.be/-styZyl2hIA)
372
372
  :replies:
373
373
  - :author: manojlds
374
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcd2nih/
374
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcd2nih
375
375
  :body: I just replaced any occurrence of J with the same character. Why are you checking for J length being 2 etc?
376
376
  :replies:
377
377
  - :author: careyi4
378
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdg135/
378
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdg135
379
379
  :body: I'm not sure what you mean by replace with the same character. However, in my solution, that check is a janky bit of the code to fix the edge case for two pair where it can be either four of a kind or full house. The edge case caught me out, but it was the only one I could think of as I thought about it so I didn't bother changing the overall approach, just hacked in that edge case.
380
380
  :replies: []
381
381
  - :author: RelativeLead5
382
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdxdk5/
382
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdxdk5
383
383
  :body: |-
384
384
  PART 1
385
385
 
@@ -428,15 +428,15 @@
428
428
  ```
429
429
  :replies:
430
430
  - :author: tenderlove
431
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdz93g/
431
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdz93g
432
432
  :body: Nice. This is much shorter than my solution. I love it!
433
433
  :replies:
434
434
  - :author: RelativeLead5
435
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kce0ckh/
435
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kce0ckh
436
436
  :body: Thanks! This is the second iteration after I realized that sort could handle arrays in a way that worked.
437
437
  :replies: []
438
438
  - :author: tenderlove
439
- :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdxifk/
439
+ :url: https://www.reddit.com/r/adventofcode/comments/18cnzbm/2023_day_7_solutions/kcdxifk
440
440
  :body: |-
441
441
  Part1
442
442
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  - :author: carl_omniart
3
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcpelh9/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcpelh9
4
4
  :body: |-
5
5
  [https://github.com/carl-omniart/advent\_of\_code/tree/main/2023](https://github.com/carl-omniart/advent_of_code/tree/main/2023)
6
6
 
@@ -11,14 +11,14 @@
11
11
  P.S. I named this class Syzygy, which is a term for an astronomical conjunction and a title of an X-Files episode that features a young Jack Black. Doesn't _exactly_ make sense as a class name here but what the heck.
12
12
  :replies: []
13
13
  - :author: HAEC_EST_SPARTA
14
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgthv7/
14
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgthv7
15
15
  :body: |-
16
16
  ##### [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2023-ruby/item/lib/day08.rb)
17
17
 
18
18
  Today definitely felt like one of the kindest example inputs so far this year: the additional sample for Part 2 made it abundantly clear that the node sequences were periodic, after which the next step of taking the least common multiple of the periods fell into place nicely.
19
19
  :replies: []
20
20
  - :author: RelativeLead5
21
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcic7ki/
21
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcic7ki
22
22
  :body: |-
23
23
  ```ruby
24
24
  ins, map = File.read('input.txt').split("\n\n")
@@ -46,7 +46,7 @@
46
46
  ```
47
47
  :replies: []
48
48
  - :author: maths222
49
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgs2mm/
49
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgs2mm
50
50
  :body: |-
51
51
  749 / 183
52
52
 
@@ -55,7 +55,7 @@
55
55
  [code](https://gist.github.com/maths22/be1fe3afff5b3d84d91a60b58c8a20c3)
56
56
  :replies:
57
57
  - :author: Alohamori
58
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgshh9/
58
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgshh9
59
59
  :body: |-
60
60
  Just sharing my solution to Part 1 so that today is also the day you get to learn about `#cycle`:
61
61
 
@@ -72,18 +72,18 @@
72
72
  ```
73
73
  :replies:
74
74
  - :author: maths222
75
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgw8hf/
75
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgw8hf
76
76
  :body: Ooh I like that!
77
77
  :replies: []
78
78
  - :author: yourparadigm
79
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgwv80/
79
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgwv80
80
80
  :body: |-
81
81
  One problem with `#cycle` is that it allows you to have an incomplete sequence of the instructions, while the rules state:
82
82
 
83
83
  > repeat the whole sequence of instructions as necessary
84
84
  :replies: []
85
85
  - :author: Any-Razzmatazz-4792
86
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgvug5/
86
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgvug5
87
87
  :body: |-
88
88
  Didn't consider LCM for a while, once I pieced that together I was able to put together a solution. Here's some golfed code for shits and giggles though
89
89
 
@@ -106,14 +106,14 @@
106
106
  ```
107
107
  :replies:
108
108
  - :author: Symbroson
109
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch0lqy/
109
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch0lqy
110
110
  :body: |-
111
111
  Very cool!In [my implementation](https://www.reddit.com/r/adventofcode/comments/18df7px/comment/kcgzr9h/?utm_source=share&utm_medium=web2x&context=3) I split each line on `/\W+/`, group by `:first` and use `1` and `2` as index. I constructed the command array with `d.tr('LR', "\1\2").bytes`. Maybe this could save some bytes for your code?
112
112
 
113
113
  Could you explain how your implementation for calculating the required steps works? I didn't find a suiting function to do it in a single statement but you did it somehow
114
114
  :replies:
115
115
  - :author: Any-Razzmatazz-4792
116
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch3wcq/
116
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch3wcq
117
117
  :body: |-
118
118
  Thanks for the tips, I was able to properly implement them + a few other optimizations to shorten my code!
119
119
 
@@ -127,14 +127,14 @@
127
127
  ```
128
128
  :replies:
129
129
  - :author: Symbroson
130
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch5tsn/
130
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch5tsn
131
131
  :body: |-
132
132
  nice.
133
133
 
134
134
  Thanks for the explanation too but I rather wanted to know how your implementation works. I see you do some infinite range find/filter magic and I'm interested to know how this works :)
135
135
  :replies:
136
136
  - :author: Any-Razzmatazz-4792
137
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch9p5r/
137
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch9p5r
138
138
  :body: |-
139
139
  in my case, the infinite range has 2 use cases. The first case is that i need to iterate from 0 ... a.size to find the connecting index for the given node. Since it's a guarantee that in the array there exists a node that matches that connection, I can use the infinite range syntax 0.. to shorten the code. The second case is that I need to count how many steps it takes to get from from starting point \_\_A to ending point \_\_Z, and by using the infinite range syntax in combination with find, that'll return the number of steps taken once it figures out that we've reached the ending node. Here's what my code looks like "ungolfed" with more readable methods for what I did:
140
140
 
@@ -155,7 +155,7 @@
155
155
  ```
156
156
  :replies: []
157
157
  - :author: yourparadigm
158
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgulb7/
158
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgulb7
159
159
  :body: |-
160
160
  ```ruby
161
161
  DIRECTIONS = $stdin.readline.strip.chars
@@ -187,14 +187,14 @@
187
187
  ```
188
188
  :replies: []
189
189
  - :author: Sharparam
190
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgvx6a/
190
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgvx6a
191
191
  :body: |-
192
192
  https://github.com/Sharparam/advent-of-code/blob/main/src/2023/08/solve.rb
193
193
 
194
194
  Like [pointed out in a different post](https://www.reddit.com/r/adventofcode/comments/18dfpub/2023_day_8_part_2_why_is_spoiler_correct/) I was also surprised that this method worked, but I guess I'll take a win.
195
195
  :replies: []
196
196
  - :author: Symbroson
197
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgzr9h/
197
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcgzr9h
198
198
  :body: |-
199
199
  Can I somehow shorten the move function? Cant think of a useful method that could calculate n in a single statement, looping over the commands and executing the step block all at once..
200
200
 
@@ -218,18 +218,18 @@
218
218
  ```
219
219
  :replies: []
220
220
  - :author: Piggelinmannen
221
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch3w7g/
221
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch3w7g
222
222
  :body: |-
223
223
  [Link to github](https://github.com/jlugner/2023-aoc/blob/master/solutions/day8/solution.rb)
224
224
 
225
225
  Just grabbed LCM on part b out of reflex. Not sure why it even works tbh. Just seems all AoCs have at least one problem where it's the way to go. Really like the way rubys .cycle works for problems like this
226
226
  :replies:
227
227
  - :author: N3m0TheGreat
228
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch4ase/
228
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kch4ase
229
229
  :body: I took the lcm by instinct as well, got the start and then I was like, wait, this shouldn't work. Turns out the inputs are designed such that a -\> z is the length as z -\> z
230
230
  :replies: []
231
231
  - :author: glebm
232
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcheyyc/
232
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kcheyyc
233
233
  :body: |-
234
234
  Part 1:
235
235
 
@@ -268,7 +268,7 @@
268
268
  ```
269
269
  :replies: []
270
270
  - :author: careyi4
271
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kchkut3/
271
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kchkut3
272
272
  :body: |-
273
273
  This was a fun one, one kind of pattern needed to be identified and then a mental leap to solve in the end, nice puzzle!
274
274
 
@@ -277,7 +277,7 @@
277
277
  [Video Walkthrough](https://youtu.be/4C0lC26U6l4)
278
278
  :replies: []
279
279
  - :author: comforttiger
280
- :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kchwj7v/
280
+ :url: https://www.reddit.com/r/adventofcode/comments/18df7px/2023_day_8_solutions/kchwj7v
281
281
  :body: |-
282
282
  https://github.com/comforttiger/advent_of_code/blob/main/2023/ruby/day8.rb
283
283