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: Frizkie
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eazkl9g
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eazkl9g
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -48,14 +48,14 @@
|
|
48
48
|
This one kicked my ass. I barked up the wrong tree for a long time, took me over an hour to debug everything.
|
49
49
|
:replies:
|
50
50
|
- :author: "[deleted]"
|
51
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb2rsqp
|
51
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb2rsqp
|
52
52
|
:body: |-
|
53
53
|
Rances can actually be made inclusive simply by adding `...` instead of `..` as the range operator.
|
54
54
|
|
55
55
|
Great solution!
|
56
56
|
:replies: []
|
57
57
|
- :author: daybreaker
|
58
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0b4bm
|
58
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0b4bm
|
59
59
|
:body: |-
|
60
60
|
Went in sort of the same route for Part 1, using .times instead of .each
|
61
61
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
```
|
79
79
|
:replies: []
|
80
80
|
- :author: moomaka
|
81
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0dv9v
|
81
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0dv9v
|
82
82
|
:body: |-
|
83
83
|
# Ruby
|
84
84
|
|
@@ -109,11 +109,11 @@
|
|
109
109
|
```
|
110
110
|
:replies:
|
111
111
|
- :author: ZoDalek
|
112
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb11gyo
|
112
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb11gyo
|
113
113
|
:body: Shame the struct definition is a little verbose because man the solution itself is so beautifully compact!
|
114
114
|
:replies:
|
115
115
|
- :author: moomaka
|
116
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb141fd
|
116
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb141fd
|
117
117
|
:body: |-
|
118
118
|
The Struct was just for readability, but you can code golf it down a bit and still keep it fairly easy to read:
|
119
119
|
|
@@ -131,7 +131,7 @@
|
|
131
131
|
```
|
132
132
|
:replies: []
|
133
133
|
- :author: rock_neurotiko
|
134
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eazomdx
|
134
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eazomdx
|
135
135
|
:body: |-
|
136
136
|
Day 3 in Ruby:
|
137
137
|
|
@@ -185,7 +185,7 @@
|
|
185
185
|
```
|
186
186
|
:replies: []
|
187
187
|
- :author: CommanderViral
|
188
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0a1zv
|
188
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0a1zv
|
189
189
|
:body: |-
|
190
190
|
Crystal (both parts 1 and 2 computed together)
|
191
191
|
|
@@ -234,7 +234,7 @@
|
|
234
234
|
And what's fun is it's valid Ruby with a line added and 3 lines changed.
|
235
235
|
:replies: []
|
236
236
|
- :author: jschulenklopper
|
237
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0s050
|
237
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0s050
|
238
238
|
:body: |-
|
239
239
|
Ruby... but in a single pass over the claims. (I see a lot of double passes; one processing all the claims for marking the fabric, one processing all the claims again or the fabric to look for single-marked spots.)
|
240
240
|
|
@@ -268,11 +268,11 @@
|
|
268
268
|
```
|
269
269
|
:replies: []
|
270
270
|
- :author: omegaxLoL
|
271
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0txje
|
271
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb0txje
|
272
272
|
:body: "[My solution in Ruby](https://github.com/aosousa/AdventOfCode2018/blob/master/day3.rb). Using Advent of Code to learn Ruby this year so any tips are welcome!"
|
273
273
|
:replies: []
|
274
274
|
- :author: vanderzee94
|
275
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb1q783
|
275
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eb1q783
|
276
276
|
:body: |-
|
277
277
|
Ruby Solution for both parts
|
278
278
|
|
@@ -306,7 +306,7 @@
|
|
306
306
|
```
|
307
307
|
:replies: []
|
308
308
|
- :author: 121lazz
|
309
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eccbxf3
|
309
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2lesz/2018_day_3_solutions/eccbxf3
|
310
310
|
:body: |-
|
311
311
|
Later than late to the party, but a party 'twas.
|
312
312
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb2drs1
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb2drs1
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -33,7 +33,7 @@
|
|
33
33
|
```
|
34
34
|
:replies:
|
35
35
|
- :author: oezi13
|
36
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb3exp2
|
36
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb3exp2
|
37
37
|
:body: |-
|
38
38
|
Yeah for Ruby!
|
39
39
|
|
@@ -73,7 +73,7 @@
|
|
73
73
|
```
|
74
74
|
:replies: []
|
75
75
|
- :author: Unihedron
|
76
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb1xcir
|
76
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb1xcir
|
77
77
|
:body: |-
|
78
78
|
Yeah!!! I have no idea what I'm doing anymore!!! Ruby
|
79
79
|
|
@@ -160,7 +160,7 @@
|
|
160
160
|
Edit: Changed the layout of the code so you can run it without any hassle and it will just work. If you're reading this, bless you
|
161
161
|
:replies: []
|
162
162
|
- :author: Frizkie
|
163
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb21dgj
|
163
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb21dgj
|
164
164
|
:body: |-
|
165
165
|
Ruby
|
166
166
|
|
@@ -211,14 +211,14 @@
|
|
211
211
|
```
|
212
212
|
:replies: []
|
213
213
|
- :author: charismotron
|
214
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb1ym65
|
214
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb1ym65
|
215
215
|
:body: |-
|
216
216
|
**Ruby**
|
217
217
|
|
218
218
|
[https://github.com/chrismo/adventofcode2018/blob/master/day4/script.rb](https://github.com/chrismo/adventofcode2018/blob/master/day4/script.rb)
|
219
219
|
:replies: []
|
220
220
|
- :author: morfi717
|
221
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb2c2f5
|
221
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2xef8/2018_day_4_solutions/eb2c2f5
|
222
222
|
:body: |-
|
223
223
|
Ruby
|
224
224
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4digq
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4digq
|
4
4
|
:body: |-
|
5
5
|
Ruby, reporting in.
|
6
6
|
|
@@ -34,7 +34,7 @@
|
|
34
34
|
Edit: Yeah okay, after reading others' solutions, I get it, a less wasteful way to do it would be to add letters left-to-right and therefore I know I only need to delete from the right end of the string. Let this be a lesson on there being a huge difference between what I write if I want to go as fast as possible versus what I might write if I actually have time to think about it.
|
35
35
|
:replies:
|
36
36
|
- :author: Karl_Marxxx
|
37
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb576m4
|
37
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb576m4
|
38
38
|
:body: |-
|
39
39
|
As someone learning ruby for the first time, this is an excellent code snippet to study. Mind if I ask a few questions?
|
40
40
|
|
@@ -51,7 +51,7 @@
|
|
51
51
|
Sorry for the noob q's but this language is fascinating.
|
52
52
|
:replies:
|
53
53
|
- :author: p_tseng
|
54
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb5mrpo
|
54
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb5mrpo
|
55
55
|
:body: |-
|
56
56
|
Hey there, don't hesitate to ask any more question if you have any!
|
57
57
|
|
@@ -80,11 +80,11 @@
|
|
80
80
|
That would be because of the `if` afterward. You may see this used in some pieces of code like `raise SomeError if something`. It would be "unfortunate" if that raised an error every time. Thus, it doesn't happen unless the condition is true. For more information you could read about "modifier if"
|
81
81
|
:replies: []
|
82
82
|
- :author: _liquidlemon
|
83
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb5t4em
|
83
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb5t4em
|
84
84
|
:body: I'm also solving in Ruby and I have to say that I absolutely love your solutions. They're all really smart and checking out your solution is as interesting as solving it on my own, because every day you seem to include something that I didn't even know existed in the language (like taking array slices with `[x, y]`, symbol arrays in the form of `%i()`, the safe navigation operator that you had in your refined solution for today, `Hash#to_proc`, being able to group statements in parentheses to use the modifier syntax). I really appreciate that you're publishing all your solutions so that others can learn from them. Even if I end up refactoring my solutions so that they end up looking a little bit too much like yours ;)
|
85
85
|
:replies:
|
86
86
|
- :author: p_tseng
|
87
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb6c82q
|
87
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb6c82q
|
88
88
|
:body: |-
|
89
89
|
Thanks for writing in. Indeed one of my hopes is that I can show some interesting things that can be done in the language.
|
90
90
|
|
@@ -93,14 +93,14 @@
|
|
93
93
|
Just some interesting thoughts when I consider how others might make use of my code.
|
94
94
|
:replies:
|
95
95
|
- :author: _liquidlemon
|
96
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb6e4d6
|
96
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb6e4d6
|
97
97
|
:body: |-
|
98
98
|
They did stand out to me as well but I think in this kind of scenario where concise code is valued they are perfectly fine. Especially the second one I've used before and not felt too bad about it. Being able to save a value while using it at the same time can be really useful at times. Heck, even Python introduced a way to do that recently (although it didn't happen without controversy).
|
99
99
|
|
100
100
|
I look forward to seeing your future solutions (and hope I can still understand them :P). Good luck with staying on top of the leaderboard!
|
101
101
|
:replies: []
|
102
102
|
- :author: Frizkie
|
103
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4fpde
|
103
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4fpde
|
104
104
|
:body: |-
|
105
105
|
Ruby
|
106
106
|
|
@@ -148,7 +148,7 @@
|
|
148
148
|
```
|
149
149
|
:replies: []
|
150
150
|
- :author: jazzido
|
151
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4ec3w
|
151
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4ec3w
|
152
152
|
:body: |-
|
153
153
|
Part 1, in Ruby:
|
154
154
|
|
@@ -168,15 +168,15 @@
|
|
168
168
|
```
|
169
169
|
:replies:
|
170
170
|
- :author: "[deleted]"
|
171
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4g72j
|
171
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4g72j
|
172
172
|
:body: Ooh clever use of character codes!
|
173
173
|
:replies: []
|
174
174
|
- :author: reacher
|
175
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4i3ms
|
175
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4i3ms
|
176
176
|
:body: This is a nice solution, but it breaks when the first 2 characters have matching polarity. adding "and !stack.empty?" to that first condition fixes it
|
177
177
|
:replies: []
|
178
178
|
- :author: charismotron
|
179
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4j96r
|
179
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4j96r
|
180
180
|
:body: |-
|
181
181
|
**Ruby**
|
182
182
|
|
@@ -240,7 +240,7 @@
|
|
240
240
|
```
|
241
241
|
:replies: []
|
242
242
|
- :author: Schaulustiger
|
243
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb5t6ic
|
243
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb5t6ic
|
244
244
|
:body: |-
|
245
245
|
**Ruby from the command line**
|
246
246
|
|
@@ -249,7 +249,7 @@
|
|
249
249
|
```
|
250
250
|
:replies: []
|
251
251
|
- :author: morfi717
|
252
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb60kp7
|
252
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb60kp7
|
253
253
|
:body: |-
|
254
254
|
Ruby
|
255
255
|
|
@@ -267,7 +267,7 @@
|
|
267
267
|
```
|
268
268
|
:replies: []
|
269
269
|
- :author: juzmark
|
270
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/ec71qi0
|
270
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/ec71qi0
|
271
271
|
:body: |-
|
272
272
|
Ruby - Looking for feedback. Thank you!
|
273
273
|
|
@@ -306,7 +306,7 @@
|
|
306
306
|
|
307
307
|
:replies: []
|
308
308
|
- :author: Unihedron
|
309
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4d97q
|
309
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3912m/2018_day_5_solutions/eb4d97q
|
310
310
|
:body: |-
|
311
311
|
Had two bugs... Fixed one, couldn't find the other one fast enough :p Ruby
|
312
312
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: daybreaker
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb74i3j
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb74i3j
|
4
4
|
:body: |-
|
5
5
|
While we wait for the bug fix, here's my theoretically working part 1 and 2 in completely non-optimized horrible ruby
|
6
6
|
|
@@ -72,7 +72,7 @@
|
|
72
72
|
```
|
73
73
|
:replies: []
|
74
74
|
- :author: Unihedron
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb765k8
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb765k8
|
76
76
|
:body: |-
|
77
77
|
Ruby
|
78
78
|
|
@@ -99,7 +99,7 @@
|
|
99
99
|
```
|
100
100
|
:replies: []
|
101
101
|
- :author: charismotron
|
102
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb74hkg
|
102
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb74hkg
|
103
103
|
:body: |-
|
104
104
|
_Ruby_
|
105
105
|
|
@@ -181,7 +181,7 @@
|
|
181
181
|
```
|
182
182
|
:replies: []
|
183
183
|
- :author: Frizkie
|
184
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb9fmta
|
184
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3kr4r/2018_day_6_solutions/eb9fmta
|
185
185
|
:body: |-
|
186
186
|
Ruby
|
187
187
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Frizkie
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/eb9xtuf
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/eb9xtuf
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -97,7 +97,7 @@
|
|
97
97
|
```
|
98
98
|
:replies:
|
99
99
|
- :author: aoc_throwaway
|
100
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebbg934
|
100
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebbg934
|
101
101
|
:body: |-
|
102
102
|
check out my part 1 ruby solution:
|
103
103
|
|
@@ -123,19 +123,19 @@
|
|
123
123
|
--kss
|
124
124
|
:replies: []
|
125
125
|
- :author: Larkenx
|
126
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebc0qie
|
126
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebc0qie
|
127
127
|
:body: here’s my part 1 ruby solution as well, after learning ruby for a couple hours https://github.com/Larkenx/AdventOfCode2018/blob/master/7/parta.rb
|
128
128
|
:replies:
|
129
129
|
- :author: craigontour
|
130
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebkkqqn
|
130
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebkkqqn
|
131
131
|
:body: Which site did you use to learn Ruby so fast?
|
132
132
|
:replies:
|
133
133
|
- :author: Larkenx
|
134
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebl4ws1
|
134
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebl4ws1
|
135
135
|
:body: Pretty much the Ruby docs exclusively. I had just learned Perl 6 and Lua, which are quite similar in ways
|
136
136
|
:replies: []
|
137
137
|
- :author: Dee_Jiensai
|
138
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/eba5rfj
|
138
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/eba5rfj
|
139
139
|
:body: |-
|
140
140
|
ruby 2.5.1
|
141
141
|
|
@@ -247,7 +247,7 @@
|
|
247
247
|
```
|
248
248
|
:replies:
|
249
249
|
- :author: aoc_throwaway
|
250
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebbhb9y
|
250
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebbhb9y
|
251
251
|
:body: |-
|
252
252
|
check out my part 1 ruby solution:
|
253
253
|
|
@@ -271,7 +271,7 @@
|
|
271
271
|
```
|
272
272
|
:replies: []
|
273
273
|
- :author: aoc_throwaway
|
274
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebazkui
|
274
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebazkui
|
275
275
|
:body: |-
|
276
276
|
Short Ruby solution for part 1, takes \<1ms to run (usually around 0.3ms):
|
277
277
|
|
@@ -297,7 +297,7 @@
|
|
297
297
|
-kss
|
298
298
|
:replies:
|
299
299
|
- :author: wzkx
|
300
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebchy1a
|
300
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebchy1a
|
301
301
|
:body: |-
|
302
302
|
Very good solution! I translated it into Python to see if it looks the same there.
|
303
303
|
|
@@ -321,11 +321,11 @@
|
|
321
321
|
```
|
322
322
|
:replies:
|
323
323
|
- :author: aoc_throwaway
|
324
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebfgin4
|
324
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebfgin4
|
325
325
|
:body: Nice! Probably faster in python too. Ruby is slow.
|
326
326
|
:replies: []
|
327
327
|
- :author: morfi717
|
328
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebcrskf
|
328
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a3wmnl/2018_day_7_solutions/ebcrskf
|
329
329
|
:body: |-
|
330
330
|
Ruby (0.08s)
|
331
331
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebc8pi3
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebc8pi3
|
4
4
|
:body: |-
|
5
5
|
Ruby... and factoring out as much of the common code between parts 1 and 2 as is possible
|
6
6
|
|
@@ -27,11 +27,11 @@
|
|
27
27
|
```
|
28
28
|
:replies:
|
29
29
|
- :author: BluFoot
|
30
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebc9drb
|
30
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebc9drb
|
31
31
|
:body: A work of art.
|
32
32
|
:replies: []
|
33
33
|
- :author: justjarvo
|
34
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcsq2r
|
34
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcsq2r
|
35
35
|
:body: |-
|
36
36
|
Part 1 Ruby golf:
|
37
37
|
|
@@ -45,7 +45,7 @@
|
|
45
45
|
```
|
46
46
|
:replies: []
|
47
47
|
- :author: Sharparam
|
48
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcytm4
|
48
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcytm4
|
49
49
|
:body: |-
|
50
50
|
**Ruby** (2.5.3p105)
|
51
51
|
|
@@ -59,7 +59,7 @@
|
|
59
59
|
But did [an OO approach](https://github.com/Sharparam/advent-of-code/blob/master/2018/day8/part2.rb) for part 2 as it felt more natural to me.
|
60
60
|
:replies: []
|
61
61
|
- :author: Unihedron
|
62
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebc97go
|
62
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebc97go
|
63
63
|
:body: |-
|
64
64
|
I'm getting old... and slow :D Ruby
|
65
65
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
```
|
87
87
|
:replies: []
|
88
88
|
- :author: Frizkie
|
89
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcbdl3
|
89
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcbdl3
|
90
90
|
:body: |-
|
91
91
|
Ruby
|
92
92
|
|
@@ -124,7 +124,7 @@
|
|
124
124
|
```
|
125
125
|
:replies:
|
126
126
|
- :author: Sharparam
|
127
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcxwe0
|
127
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcxwe0
|
128
128
|
:body: |-
|
129
129
|
For your shifting, you could save a bit of space by doing
|
130
130
|
|
@@ -133,7 +133,7 @@
|
|
133
133
|
```
|
134
134
|
:replies: []
|
135
135
|
- :author: ShorrockIn
|
136
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcsa65
|
136
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebcsa65
|
137
137
|
:body: |-
|
138
138
|
**Ruby** : The OO approach worked out pretty well with this one.
|
139
139
|
|
@@ -181,7 +181,7 @@
|
|
181
181
|
```
|
182
182
|
:replies: []
|
183
183
|
- :author: morfi717
|
184
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebenbhc
|
184
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a47ubw/2018_day_8_solutions/ebenbhc
|
185
185
|
:body: |-
|
186
186
|
Ruby
|
187
187
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebepxns
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebepxns
|
4
4
|
:body: |-
|
5
5
|
RUBY
|
6
6
|
|
@@ -41,29 +41,29 @@
|
|
41
41
|
```
|
42
42
|
:replies:
|
43
43
|
- :author: GeneralYouri
|
44
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/eberm2j
|
44
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/eberm2j
|
45
45
|
:body: |-
|
46
46
|
I don't know Ruby at all, but I had the exact same bug, which caused one of the provided test cases to fail. The reason was stupid simple: my iteration used `<` instead of `<=`, making it skip the last marble.
|
47
47
|
|
48
48
|
**Edit:** `b.times` seems to be your 'loop', right? Could you do something like `(b + 1).times` to solve the bug?
|
49
49
|
:replies:
|
50
50
|
- :author: Unihedron
|
51
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebes9zz
|
51
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebes9zz
|
52
52
|
:body: |-
|
53
53
|
Absolutely! I was planning to fix this alongside the edit where I put in my rewritten solution that is quick for part 2, but you beat me to it :) My input was lucky and was not divisible by 23.
|
54
54
|
|
55
55
|
x.times is an iterator that does something x times but calls the loop with the intervals 0-indexed, so another fix could be just `(1..b).each` which would remove the `next if _==0` skip case in the loop. (In general it's a good idea not to use `.times` with the parameter since it's, as demonstrated, not exactly intuitive. Looping through numbers is generally done with ranges and not `.times`.)
|
56
56
|
:replies: []
|
57
57
|
- :author: Aquamoogle
|
58
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebessxz
|
58
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebessxz
|
59
59
|
:body: A quick Google (I don't know Ruby, but didn't believe that ruby didn't support linked lists.) Turns out much like other languages these days objects are passed as pointers which allows LINKED LISTS. One sample walk through I found here. http://www.jessespevack.com/blog/2018/2/2/lets-make-a-linked-list-in-ruby
|
60
60
|
:replies:
|
61
61
|
- :author: Unihedron
|
62
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebesyzq
|
62
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebesyzq
|
63
63
|
:body: Ruby does a good job keeping the abstraction of objects away from actually complicating space, so it will recognize and respect what you're trying to do with a Node class and actually play well with your linked list. However of course you actually have to write it (there's no standard library module with it, you can't just load something like `require 'matrix'`). And I'm writing one just so I can also use it in case it shows up in the future.
|
64
64
|
:replies: []
|
65
65
|
- :author: tomthecool
|
66
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebhhk72
|
66
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebhhk72
|
67
67
|
:body: |-
|
68
68
|
You're right... But it's quite easy to create a basic implementation via a custom class:
|
69
69
|
|
@@ -111,7 +111,7 @@
|
|
111
111
|
```
|
112
112
|
:replies: []
|
113
113
|
- :author: dtinth
|
114
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebeqjn6
|
114
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebeqjn6
|
115
115
|
:body: |-
|
116
116
|
## Ruby (#122, #18)
|
117
117
|
|
@@ -152,7 +152,7 @@
|
|
152
152
|
```
|
153
153
|
:replies: []
|
154
154
|
- :author: hluk
|
155
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebex92k
|
155
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebex92k
|
156
156
|
:body: |-
|
157
157
|
Ruby. Took me a while to realize that `Array#insert` is no go because it's very slow.
|
158
158
|
|
@@ -204,7 +204,7 @@
|
|
204
204
|
```
|
205
205
|
:replies:
|
206
206
|
- :author: justinhj
|
207
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebgwbnq
|
207
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebgwbnq
|
208
208
|
:body: |-
|
209
209
|
I am amazed how slow my solution was on part 2 using a simple array approach with insert. It took over 2 hours.
|
210
210
|
|
@@ -215,11 +215,11 @@
|
|
215
215
|
[https://github.com/justinhj/adventofcode2018/blob/master/day9ruby/day9part2.rb](https://github.com/justinhj/adventofcode2018/blob/master/day9ruby/day9part2.rb)
|
216
216
|
:replies: []
|
217
217
|
- :author: WalrusTusks_are_funk
|
218
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebwbd5o
|
218
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebwbd5o
|
219
219
|
:body: 'This is a pretty nice, simple implementation of a double-linked list. Worked great for me. I found a c++ deque implementation here for Ruby, but it didn''t work properly for me: [https://github.com/wyhaines/deque](https://github.com/wyhaines/deque)'
|
220
220
|
:replies: []
|
221
221
|
- :author: ChronJob
|
222
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebexx35
|
222
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebexx35
|
223
223
|
:body: |-
|
224
224
|
Ruby. Wrote my own doubly linked list which was many orders of magnitude faster than my original Array based approach.
|
225
225
|
|
@@ -273,7 +273,7 @@
|
|
273
273
|
```
|
274
274
|
:replies: []
|
275
275
|
- :author: nuvan
|
276
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebeqqlu
|
276
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebeqqlu
|
277
277
|
:body: |-
|
278
278
|
**Ruby** , 67/242.
|
279
279
|
|
@@ -328,7 +328,7 @@
|
|
328
328
|
```
|
329
329
|
:replies: []
|
330
330
|
- :author: Frizkie
|
331
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebf3a63
|
331
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4i97s/2018_day_9_solutions/ebf3a63
|
332
332
|
:body: |-
|
333
333
|
Ruby
|
334
334
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhaqcb
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhaqcb
|
4
4
|
:body: |-
|
5
5
|
Ruby. Top 100 in both parts, yay!
|
6
6
|
|
@@ -29,22 +29,22 @@
|
|
29
29
|
```
|
30
30
|
:replies:
|
31
31
|
- :author: teddim
|
32
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhf89i
|
32
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhf89i
|
33
33
|
:body: Congrats!!
|
34
34
|
:replies: []
|
35
35
|
- :author: HeyItsBATMANagain
|
36
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhjjnm
|
36
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhjjnm
|
37
37
|
:body: |-
|
38
38
|
> if j['###### ###### #### ##### #### #### #### ###']
|
39
39
|
|
40
40
|
Not a ruby dude, but doesn't this only work if you already know that this string will be part of the answer?
|
41
41
|
:replies:
|
42
42
|
- :author: Unihedron
|
43
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhjtgv
|
43
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhjtgv
|
44
44
|
:body: Yes. I copied it from the end of part 1 since I haven't closed my terminal window yet. Calling `[other_string]` on a string will perform a match - if it exists, it allows you to write to it (e.g. `'abc'['b']='d'`) but in this case it just returns a non-nil value. I don't know how to generalize this in a fast enough way that can be done in speedcoding.
|
45
45
|
:replies: []
|
46
46
|
- :author: ChronJob
|
47
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhayvp
|
47
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhayvp
|
48
48
|
:body: |-
|
49
49
|
Ruby 196/194! It was fun to watch the animation on my terminal.
|
50
50
|
|
@@ -85,7 +85,7 @@
|
|
85
85
|
```
|
86
86
|
:replies: []
|
87
87
|
- :author: p_tseng
|
88
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhc17x
|
88
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhc17x
|
89
89
|
:body: |-
|
90
90
|
Ruby
|
91
91
|
|
@@ -137,7 +137,7 @@
|
|
137
137
|
```
|
138
138
|
:replies: []
|
139
139
|
- :author: jtgorn
|
140
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhk89a
|
140
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhk89a
|
141
141
|
:body: |-
|
142
142
|
I kind of like this Ruby code
|
143
143
|
|
@@ -164,7 +164,7 @@
|
|
164
164
|
My heuristic was quite simple - wait until height of the cluster gets small enough and than present iterations to user and let him decide which one gives readable text.
|
165
165
|
:replies: []
|
166
166
|
- :author: dtinth
|
167
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhawi5
|
167
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhawi5
|
168
168
|
:body: |-
|
169
169
|
## Ruby (#13,#16)
|
170
170
|
|
@@ -208,7 +208,7 @@
|
|
208
208
|
```
|
209
209
|
:replies: []
|
210
210
|
- :author: HeyItsBATMANagain
|
211
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhr634
|
211
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebhr634
|
212
212
|
:body: |-
|
213
213
|
# Crystal
|
214
214
|
|
@@ -279,7 +279,7 @@
|
|
279
279
|
```
|
280
280
|
:replies: []
|
281
281
|
- :author: Frizkie
|
282
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebj2o9o
|
282
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a4skra/2018_day_10_solutions/ebj2o9o
|
283
283
|
:body: |-
|
284
284
|
Ruby
|
285
285
|
|