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: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7jxkiw/2017_day_15_solutions/dr9ystc
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7jxkiw/2017_day_15_solutions/dr9ystc
|
4
4
|
:body: |-
|
5
5
|
Ruby; I'm stupid. I wrote `65535`, thought to myself wait am I right? rewrote it to `1<< ... -1`, ran it, oh yeah it's `65536`, then I freaking went to change it back to 65535 because I **totally have that kind of time**. (silver 101 / gold 60)
|
6
6
|
|
@@ -26,11 +26,11 @@
|
|
26
26
|
```
|
27
27
|
:replies:
|
28
28
|
- :author: raevnos
|
29
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7jxkiw/2017_day_15_solutions/dra1z7s
|
29
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7jxkiw/2017_day_15_solutions/dra1z7s
|
30
30
|
:body: 0xFFFF works too.
|
31
31
|
:replies: []
|
32
32
|
- :author: rkachowski
|
33
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7jxkiw/2017_day_15_solutions/dra48m4
|
33
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7jxkiw/2017_day_15_solutions/dra48m4
|
34
34
|
:body: |-
|
35
35
|
**ruby**
|
36
36
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drbrxaa
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drbrxaa
|
4
4
|
:body: |-
|
5
5
|
This day made me so unsure what I want from Advent of Code. Yesterday, I thought "I really wish the problems made us think more, rather than a contest of who can type the fastest". Today, the problem made us think more and it did not go well: missed part 2 leaderboard because I went with the broken approach of thinking the total relative permutation from one iteration can simply be reapplied multiple times. Nope, because there are absolute permutations too. I think what I ultimately want is to continue to have problems that make us think... but for me to be better at thinking of the right solution in the heat of the moment. Oh well, next time.
|
6
6
|
|
@@ -45,7 +45,7 @@
|
|
45
45
|
Note that I have since scrapped this solution in favour of one that splits up the dance into relative and absolute moves, however I will defer to https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16\_solutions/drbqb27/ to explain how that looks, since it wasn't my idea.
|
46
46
|
:replies: []
|
47
47
|
- :author: Unihedron
|
48
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drbootv
|
48
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drbootv
|
49
49
|
:body: |-
|
50
50
|
Ruby (#23/#44); Pleasant challenge! Part 2 was a shock, but I've actually encountered [a problem with the same mechanic](https://cdn.discordapp.com/attachments/385778069098463232/391459810425700352/unknown.png) before (which handles more details), so I went to look up my solution on that site and re-implemented the relevant parts here. (Also, that problem took me an all-nighter to figure out (maths and I don't get along), so it's nice that it came back to save me here!) I was lucky to have no bugs!
|
51
51
|
|
@@ -83,7 +83,7 @@
|
|
83
83
|
[postscript](https://cdn.discordapp.com/attachments/293355384436162560/391462643325599774/unknown.png)
|
84
84
|
:replies: []
|
85
85
|
- :author: Fluffy_ribbit
|
86
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drbwp49
|
86
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drbwp49
|
87
87
|
:body: |-
|
88
88
|
Ruby. I am like a little baby.
|
89
89
|
|
@@ -153,7 +153,7 @@
|
|
153
153
|
```
|
154
154
|
:replies:
|
155
155
|
- :author: Grimnur87
|
156
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drc03cr
|
156
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drc03cr
|
157
157
|
:body: |-
|
158
158
|
Similar approach here, only I added my methods directly to the Array class:
|
159
159
|
|
@@ -184,7 +184,7 @@
|
|
184
184
|
Bit of a waste of time but I learned something new.
|
185
185
|
:replies: []
|
186
186
|
- :author: rkachowski
|
187
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drc3bi9
|
187
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7k572l/2017_day_16_solutions/drc3bi9
|
188
188
|
:body: |-
|
189
189
|
ruby
|
190
190
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd5y54
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd5y54
|
4
4
|
:body: |-
|
5
5
|
[How I did part 2](#s "zero is ALWAYS at the start of the buffer, so the only time a value after it changes is if the spinlock lands on zero"). Edit: Okay, looks like most people figured this same thing out, figures.
|
6
6
|
|
@@ -37,7 +37,7 @@
|
|
37
37
|
Edit: [figured it out](https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd8b1n/)
|
38
38
|
:replies:
|
39
39
|
- :author: p_tseng
|
40
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd8b1n
|
40
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd8b1n
|
41
41
|
:body: |-
|
42
42
|
> Does anyone know a way to make this faster?
|
43
43
|
|
@@ -95,7 +95,7 @@
|
|
95
95
|
So, correct answer for my input, but a little suspicious it may have an off-by-one error somewhere. Need to verify.
|
96
96
|
:replies:
|
97
97
|
- :author: if0nz
|
98
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drdulxd
|
98
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drdulxd
|
99
99
|
:body: |-
|
100
100
|
I've just implemented your p2's algorithm in Java and the avg execution time is 150 **microseconds**! Kudos (:
|
101
101
|
|
@@ -117,7 +117,7 @@
|
|
117
117
|
```
|
118
118
|
:replies: []
|
119
119
|
- :author: Unihedron
|
120
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd600h
|
120
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd600h
|
121
121
|
:body: |-
|
122
122
|
Ruby, part 1
|
123
123
|
|
@@ -134,10 +134,10 @@
|
|
134
134
|
Part 2 did not run in time, I'm tempted to think optimizations are needed, but I barely understand the problem to do anything. Going to let it run for a few hours to check it works before posting it.
|
135
135
|
:replies:
|
136
136
|
- :author: theyangmaster
|
137
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd62jc
|
137
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd62jc
|
138
138
|
:body: Try observing what the first element in the list is.
|
139
139
|
:replies:
|
140
140
|
- :author: Unihedron
|
141
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd9yx4
|
141
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kc0xw/2017_day_17_solutions/drd9yx4
|
142
142
|
:body: https://cdn.discordapp.com/attachments/293355384436162560/391855738282311681/unknown.png
|
143
143
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dretcuj
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dretcuj
|
4
4
|
:body: |-
|
5
5
|
That was a really fun puzzle, I like the part 2 twist and thought "uh oh, how am I going to do this...". This is good, I hope there are more of these.
|
6
6
|
|
@@ -117,7 +117,7 @@
|
|
117
117
|
```
|
118
118
|
:replies:
|
119
119
|
- :author: p_tseng
|
120
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/drevge6
|
120
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/drevge6
|
121
121
|
:body: |-
|
122
122
|
> do it the right way later
|
123
123
|
|
@@ -234,11 +234,11 @@
|
|
234
234
|
```
|
235
235
|
:replies: []
|
236
236
|
- :author: rdc12
|
237
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dreube7
|
237
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dreube7
|
238
238
|
:body: Probably a real fast way to code it up thou
|
239
239
|
:replies: []
|
240
240
|
- :author: dtinth
|
241
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dretil2
|
241
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dretil2
|
242
242
|
:body: |-
|
243
243
|
# Part 2: JavaScript
|
244
244
|
|
@@ -308,7 +308,7 @@
|
|
308
308
|
```
|
309
309
|
:replies: []
|
310
310
|
- :author: Unihedron
|
311
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dreu6sz
|
311
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/dreu6sz
|
312
312
|
:body: |-
|
313
313
|
Ruby. I've caught more bugs today than in the last five months! Needless to say, I was drastically far from today's leaderboards. Top 200 though!
|
314
314
|
|
@@ -364,7 +364,7 @@
|
|
364
364
|
Notable moments: 1. Ruby really loves giving % additional meaning, such as %w[string string2 string3], which tripped my syntax highlighting even though the code was fine, it drove me in circles for a while, 2. if you're using regex global variables like $2, they get overwritten if you use it again!!! 3. did not anticipate an integer in jump operation, since part 1 solved fine, ended up watching my program run for four minutes before my hinch of something wrong catching up...
|
365
365
|
:replies: []
|
366
366
|
- :author: eregontp
|
367
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/drg10dq
|
367
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/drg10dq
|
368
368
|
:body: |-
|
369
369
|
Ruby, using the builtin deadlock detection mechanism to solve part2 and printing the answer in `ensure`:
|
370
370
|
|
@@ -385,6 +385,6 @@
|
|
385
385
|
Full solution: https://github.com/eregon/adventofcode/commit/a7de4896d493b2be92bba400734d9d1ef7a58f8f
|
386
386
|
:replies:
|
387
387
|
- :author: oantolin
|
388
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/drldvv2
|
388
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kj35s/2017_day_18_solutions/drldvv2
|
389
389
|
:body: Oh, I didn't know about the deadlock detection, cool!
|
390
390
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: dtinth
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kr2ac/2017_day_19_solutions/drgjw1m
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kr2ac/2017_day_19_solutions/drgjw1m
|
4
4
|
:body: |-
|
5
5
|
# Ruby (28th, 22nd)
|
6
6
|
|
@@ -51,7 +51,7 @@
|
|
51
51
|
```
|
52
52
|
:replies: []
|
53
53
|
- :author: Unihedron
|
54
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kr2ac/2017_day_19_solutions/drgk54d
|
54
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kr2ac/2017_day_19_solutions/drgk54d
|
55
55
|
:body: |-
|
56
56
|
Ruby; My sanity decays further as more debugging effort was required. Today's bug was fall-through statements. Almost made it to the leaderboards though :p (~120)
|
57
57
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/dridara
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/dridara
|
4
4
|
:body: |-
|
5
5
|
Ruby; strong language warning
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
[highlight](https://i.stack.imgur.com/PyJNQ.png)
|
10
10
|
:replies: []
|
11
11
|
- :author: p_tseng
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/dricrsg
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/dricrsg
|
13
13
|
:body: |-
|
14
14
|
Silly mistake. Forgot to include negative signs in my input parser. Still got correct answer for part 1, but delayed part 2 significantly since I assumed part 1 correct meant my input parser was correct. Shouldn't happen again...
|
15
15
|
|
@@ -60,15 +60,15 @@
|
|
60
60
|
```
|
61
61
|
:replies:
|
62
62
|
- :author: phongvis
|
63
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/drie3nr
|
63
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/drie3nr
|
64
64
|
:body: Same here! Feel so strange that no duplicated coordinates are found! Finally got it when printed the coordinates in each iteration and compare with the input.
|
65
65
|
:replies: []
|
66
66
|
- :author: ephemient
|
67
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/drigydv
|
67
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/drigydv
|
68
68
|
:body: This space intentionally left blank.
|
69
69
|
:replies:
|
70
70
|
- :author: p_tseng
|
71
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/drijgdu
|
71
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7kz6ik/2017_day_20_solutions/drijgdu
|
72
72
|
:body: |-
|
73
73
|
I feel like it should be possible to do something along the lines of... for every pair of particles, calculate their _potential_ collision time by solving for t where position are equal, then we can just just take the maximum t found. Not excited about having to do it against all pairs, but not seeing a better way right now. But I think this way can be done one-time at the beginning, instead of having to recalculate for all pairs at every tick.
|
74
74
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: dtinth
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk4sfe
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk4sfe
|
4
4
|
:body: |-
|
5
5
|
# irb (26th, 23rd)
|
6
6
|
|
@@ -54,7 +54,7 @@
|
|
54
54
|
```
|
55
55
|
:replies:
|
56
56
|
- :author: BumpitySnook
|
57
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk5bmx
|
57
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk5bmx
|
58
58
|
:body: |-
|
59
59
|
> I am solving this problem interatively in the Ruby’s REPL.
|
60
60
|
|
@@ -65,18 +65,18 @@
|
|
65
65
|
Coming from Python: Grrrr :-(.
|
66
66
|
:replies:
|
67
67
|
- :author: dtinth
|
68
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk5w2a
|
68
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk5w2a
|
69
69
|
:body: |-
|
70
70
|
I actually wrote the code in the text editor, and I setup a hotkey (Cmd+Enter) to send the current line into the Terminal. Like what Lisp people like to do ;).
|
71
71
|
|
72
72
|
If I accidentally exited the REPL, I would just reopen it and send each line from the editor to it.
|
73
73
|
:replies:
|
74
74
|
- :author: BumpitySnook
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk6515
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk6515
|
76
76
|
:body: That sounds a lot less stressful :-).
|
77
77
|
:replies: []
|
78
78
|
- :author: znuxor
|
79
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk695e
|
79
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk695e
|
80
80
|
:body: |-
|
81
81
|
> Coming from Python: Grrrr :-(.
|
82
82
|
|
@@ -85,11 +85,11 @@
|
|
85
85
|
> old_pattern_key2 = tuple(map(tuple, old\_pattern2))
|
86
86
|
:replies:
|
87
87
|
- :author: BumpitySnook
|
88
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk7p9y
|
88
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk7p9y
|
89
89
|
:body: Yes, I used the same trick. Still, I'd rather not have to :-).
|
90
90
|
:replies:
|
91
91
|
- :author: dtinth
|
92
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drm9ov7
|
92
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drm9ov7
|
93
93
|
:body: |-
|
94
94
|
When you use an array (or any other object) as a hash key, you must make sure not to mutate the key. Otherwise, really weird things happen. **The hash code of the key changes** causing lookups to fail.
|
95
95
|
|
@@ -108,7 +108,7 @@
|
|
108
108
|
I think it is very reasonable for Python to disallow this. :)
|
109
109
|
:replies:
|
110
110
|
- :author: BumpitySnook
|
111
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drn4jl1
|
111
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drn4jl1
|
112
112
|
:body: |-
|
113
113
|
I understand that, but Python could reasonably handle this in a number of less obnoxious ways:
|
114
114
|
|
@@ -117,18 +117,18 @@
|
|
117
117
|
3. Automatically deepcopy / intern mutable hash keys
|
118
118
|
:replies: []
|
119
119
|
- :author: Unihedron
|
120
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk5cq9
|
120
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk5cq9
|
121
121
|
:body: "`5.times{data=nx[data]}` might be easier to write than that, by the way."
|
122
122
|
:replies:
|
123
123
|
- :author: dtinth
|
124
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk6dm0
|
124
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk6dm0
|
125
125
|
:body: |-
|
126
126
|
I avoided mutating `data`, that’s why I didn’t overwrite the `data` variable. I also did it manually to avoid off-by-one errors (e.g. it ran 4 times or 6 times instead due to logic error).
|
127
127
|
|
128
128
|
If I was in a less hurry, I would have written `5.times.reduce(data) { |c, _| nx[c] }` instead :).
|
129
129
|
:replies: []
|
130
130
|
- :author: Unihedron
|
131
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk4r6h
|
131
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7l78eb/2017_day_21_solutions/drk4r6h
|
132
132
|
:body: |-
|
133
133
|
Ruby; 25/21. I think I got a headache from this, but I managed to get back on the board after a streak of fails, so I'm happy. Functional programming was being a helpful friend day.
|
134
134
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7lf943/2017_day_22_solutions/drlufhn
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7lf943/2017_day_22_solutions/drlufhn
|
4
4
|
:body: |-
|
5
5
|
Ruby; run time: 22 seconds, fun factor: 4/10, I was too worried about bugs and ran on all the sample test cases. Thankfully it worked first time.
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7lms6p/2017_day_23_solutions/drngoc3
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7lms6p/2017_day_23_solutions/drngoc3
|
4
4
|
:body: |-
|
5
5
|
Ruby; rank 80 for part 2. Ruby has continuation (like goto but only backflip) so it made porting the code easier. I actually converted the code pretty quick, but it took a lot of staring to realize what it was actually doing... I blame the lack of sleep!
|
6
6
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7lzo3l/2017_day_25_solutions/drqarsn
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7lzo3l/2017_day_25_solutions/drqarsn
|
4
4
|
:body: "Ruby; 35/33; tfw it was easy but I'm slow\n\n```ruby\ns=:A\na=Hash.new{|x,y|x[y]=0}\nu=0\n12523873.times{v=a[u]\ns=case s\nwhen :A\nv==0 ? (a[u]=1;u+=1;:B) : (a[u]=1;u-=1;:E)\nwhen :B\nv==0 ? (a[u]=1;u+=1;:C) : (a[u]=1;u+=1;:F)\nwhen :C\nv==0 ? (a[u]=1;u-=1;:D) : (a[u]=0;u+=1;:B)\nwhen :D\nv==0 ? (a[u]=1;u+=1;:E) : (a[u]=0;u-=1;:C)\nwhen :E\nv==0 ? (a[u]=1;u-=1;:A) : (a[u]=0;u+=1;:D)\nwhen :F\nv==0 ? (a[u]=1;u+=1;:A) : (a[u]=1;u+=1;:C)\nend\n}\np a.values.sum\n```\n\n✨\U0001F623 Merry christmas! \U0001F384"
|
5
5
|
:replies: []
|
6
6
|
- :author: el_daniero
|
7
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7lzo3l/2017_day_25_solutions/drqot7y
|
7
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7lzo3l/2017_day_25_solutions/drqot7y
|
8
8
|
:body: |-
|
9
9
|
# Ruby, gsub and eval
|
10
10
|
|
@@ -89,7 +89,7 @@
|
|
89
89
|
```
|
90
90
|
:replies:
|
91
91
|
- :author: twinkiac
|
92
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7lzo3l/2017_day_25_solutions/dwz296p
|
92
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7lzo3l/2017_day_25_solutions/dwz296p
|
93
93
|
:body: |-
|
94
94
|
[@tape's latest tweet](https://i.imgur.com/1tB4iOu.jpg)
|
95
95
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: "[deleted]"
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eau8pho
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eau8pho
|
4
4
|
:body: |-
|
5
5
|
Another Ruby.
|
6
6
|
|
@@ -18,30 +18,30 @@
|
|
18
18
|
```
|
19
19
|
:replies:
|
20
20
|
- :author: tbuehlmann
|
21
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauhm5m
|
21
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauhm5m
|
22
22
|
:body: There's also Set#add? which will add the argument and return the set if it wasn't included before. Returns `nil` if the argument was already included.
|
23
23
|
:replies:
|
24
24
|
- :author: "[deleted]"
|
25
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eav6n3j
|
25
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eav6n3j
|
26
26
|
:body: Thanks! I changed it. One line less!
|
27
27
|
:replies: []
|
28
28
|
- :author: Karl_Marxxx
|
29
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eav37m4
|
29
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eav37m4
|
30
30
|
:body: |-
|
31
31
|
> puts data.sum
|
32
32
|
|
33
33
|
Is this not a standard ruby thing? I get `undefined method sum for array`
|
34
34
|
:replies:
|
35
35
|
- :author: "[deleted]"
|
36
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaviujt
|
36
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaviujt
|
37
37
|
:body: "[deleted]"
|
38
38
|
:replies:
|
39
39
|
- :author: Karl_Marxxx
|
40
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaviwk1
|
40
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaviwk1
|
41
41
|
:body: Ah I'm on 2.0. Thanks.
|
42
42
|
:replies: []
|
43
43
|
- :author: vanderzee94
|
44
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaz6nsv
|
44
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaz6nsv
|
45
45
|
:body: |-
|
46
46
|
you can also do
|
47
47
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
instead of sum
|
53
53
|
:replies: []
|
54
54
|
- :author: antigrapist
|
55
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eau5j8f
|
55
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eau5j8f
|
56
56
|
:body: |-
|
57
57
|
Ruby, my puzzle input is in var a.
|
58
58
|
|
@@ -84,7 +84,7 @@
|
|
84
84
|
```
|
85
85
|
:replies:
|
86
86
|
- :author: Cyanogen101
|
87
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eb27ot2
|
87
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eb27ot2
|
88
88
|
:body: |-
|
89
89
|
Hey I was doing something similiar but with an Array instead of a hash, can you look over mine and help explain why it didnt work? (I took out the breaks just to try get at least an output)
|
90
90
|
|
@@ -117,7 +117,7 @@
|
|
117
117
|
```
|
118
118
|
:replies: []
|
119
119
|
- :author: jschulenklopper
|
120
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauu4rn
|
120
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauu4rn
|
121
121
|
:body: |-
|
122
122
|
Had almost the same solution for part 1, but golfed that down to this:
|
123
123
|
|
@@ -126,7 +126,7 @@
|
|
126
126
|
It gets the whole input file in a string, splits that (on whitespace), converts to integers and reduces the array by adding all the values.
|
127
127
|
:replies: []
|
128
128
|
- :author: Frizkie
|
129
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eau7m1y
|
129
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eau7m1y
|
130
130
|
:body: |-
|
131
131
|
Ruby
|
132
132
|
|
@@ -161,7 +161,7 @@
|
|
161
161
|
```
|
162
162
|
:replies: []
|
163
163
|
- :author: alienpirate5
|
164
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaubge7
|
164
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaubge7
|
165
165
|
:body: |-
|
166
166
|
Ruby part 2:
|
167
167
|
|
@@ -194,7 +194,7 @@
|
|
194
194
|
```
|
195
195
|
:replies: []
|
196
196
|
- :author: captainkari
|
197
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauei50
|
197
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauei50
|
198
198
|
:body: |-
|
199
199
|
Solution in Ruby for part one:
|
200
200
|
|
@@ -253,11 +253,11 @@
|
|
253
253
|
(pardon formatting issues, idk how to do formatting and it's 4am)
|
254
254
|
:replies:
|
255
255
|
- :author: DaDiscoBeat
|
256
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauhjk2
|
256
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauhjk2
|
257
257
|
:body: Add 4 spaces in front of each lines :)
|
258
258
|
:replies: []
|
259
259
|
- :author: tbuehlmann
|
260
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauhvyh
|
260
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eauhvyh
|
261
261
|
:body: |-
|
262
262
|
Ruby:
|
263
263
|
|
@@ -288,11 +288,11 @@
|
|
288
288
|
```
|
289
289
|
:replies: []
|
290
290
|
- :author: omegaxLoL
|
291
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaunrqb
|
291
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eaunrqb
|
292
292
|
:body: "[My solution in Ruby](https://github.com/aosousa/AdventOfCode2018/blob/master/day1.rb). Using Advent of Code to learn Ruby this year so any tips are welcome!"
|
293
293
|
:replies: []
|
294
294
|
- :author: lindgrenj6
|
295
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eavk971
|
295
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eavk971
|
296
296
|
:body: |-
|
297
297
|
This is my first time doing advent of code. I'm a bit rusty as I've been doing consulting rather than coding for the last year, nevertheless heres my implmentation in ruby:
|
298
298
|
|
@@ -370,7 +370,7 @@
|
|
370
370
|
```
|
371
371
|
:replies: []
|
372
372
|
- :author: compdog
|
373
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eavxq3s
|
373
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eavxq3s
|
374
374
|
:body: |-
|
375
375
|
**Ruby**
|
376
376
|
|
@@ -434,7 +434,7 @@
|
|
434
434
|
```
|
435
435
|
:replies: []
|
436
436
|
- :author: "[deleted]"
|
437
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eawbkkd
|
437
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/eawbkkd
|
438
438
|
:body: |-
|
439
439
|
Wanted to brush up on Ruby and compare with Perl (which I don't know yet)
|
440
440
|
|
@@ -563,7 +563,7 @@
|
|
563
563
|
```
|
564
564
|
:replies: []
|
565
565
|
- :author: shvetsovdm
|
566
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/ebbq2nh
|
566
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a20646/2018_day_1_solutions/ebbq2nh
|
567
567
|
:body: |-
|
568
568
|
**Day 1 Part 2** solution in **Ruby**
|
569
569
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawj95t
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawj95t
|
4
4
|
:body: |-
|
5
5
|
I mistyped 4 3 instead of 2 3 and got an obviously wrong answer which I wasn't smart enough to double check, so I had to wait one minute. Still got on top 100 though! [Imgur](https://i.imgur.com/ds13ZAy.png)
|
6
6
|
|
@@ -21,15 +21,15 @@
|
|
21
21
|
Doesn't actually compute part 2, you have to manually find and replace the character yourself, but better than nothing
|
22
22
|
:replies:
|
23
23
|
- :author: abnew123
|
24
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjn4w
|
24
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjn4w
|
25
25
|
:body: Man, I'm always so sad when I look at other's solutions lol. While I wasn't particularly slow (177th), my code is 70+ lines lol. Oh well, I blame java
|
26
26
|
:replies:
|
27
27
|
- :author: Unihedron
|
28
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjoq3
|
28
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjoq3
|
29
29
|
:body: Don't worry I got your back, I'll do a java one for you
|
30
30
|
:replies: []
|
31
31
|
- :author: Unihedron
|
32
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawmqct
|
32
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawmqct
|
33
33
|
:body: |-
|
34
34
|
Part 1
|
35
35
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
```
|
87
87
|
:replies: []
|
88
88
|
- :author: "[deleted]"
|
89
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawwe0m
|
89
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawwe0m
|
90
90
|
:body: |-
|
91
91
|
Another Java solution: Part 1:
|
92
92
|
|
@@ -138,15 +138,15 @@
|
|
138
138
|
```
|
139
139
|
:replies: []
|
140
140
|
- :author: DoodleFungus
|
141
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjlyk
|
141
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjlyk
|
142
142
|
:body: Wow, our ruby answers have been remarkably similar both days (but I've barely missed the leaderboard both times, grrrrr)
|
143
143
|
:replies:
|
144
144
|
- :author: Unihedron
|
145
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjna2
|
145
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawjna2
|
146
146
|
:body: Fastest gun in the west!
|
147
147
|
:replies: []
|
148
148
|
- :author: charismotron
|
149
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawnzm8
|
149
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawnzm8
|
150
150
|
:body: |-
|
151
151
|
TIL: Array#count exists
|
152
152
|
|
@@ -155,7 +155,7 @@
|
|
155
155
|
I thought about zip but couldn't think of a way to make it work - forgetting there'd be nested arrays.
|
156
156
|
:replies:
|
157
157
|
- :author: _liquidlemon
|
158
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawvsgw
|
158
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawvsgw
|
159
159
|
:body: |-
|
160
160
|
I managed to do it using zip, you might like it
|
161
161
|
|
@@ -181,19 +181,19 @@
|
|
181
181
|
```
|
182
182
|
:replies: []
|
183
183
|
- :author: Unihedron
|
184
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawp4sp
|
184
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawp4sp
|
185
185
|
:body: It's actually also on Enumerable, so you can directly .count lines on STDIN, except unfortunately we need to use it twice in this case!
|
186
186
|
:replies: []
|
187
187
|
- :author: "[deleted]"
|
188
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eayay2l
|
188
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eayay2l
|
189
189
|
:body: Can you explain the x.join,y.join 1/0?
|
190
190
|
:replies:
|
191
191
|
- :author: Unihedron
|
192
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eayuhrv
|
192
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eayuhrv
|
193
193
|
:body: at this point both `x` and `y` are array of size-1 strings, so `.join` turns them back into non-split strings and feeds them through `p` which prints them. 1/0 crashes the program. it's faster to type than exit
|
194
194
|
:replies: []
|
195
195
|
- :author: Frizkie
|
196
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawl9y6
|
196
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eawl9y6
|
197
197
|
:body: |-
|
198
198
|
Ruby
|
199
199
|
|
@@ -224,7 +224,7 @@
|
|
224
224
|
```
|
225
225
|
:replies:
|
226
226
|
- :author: justinhj
|
227
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eaxf0lv
|
227
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eaxf0lv
|
228
228
|
:body: |-
|
229
229
|
Nice, much more succinct than what I came up with
|
230
230
|
|
@@ -253,11 +253,11 @@
|
|
253
253
|
```
|
254
254
|
:replies: []
|
255
255
|
- :author: omegaxLoL
|
256
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eax092v
|
256
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eax092v
|
257
257
|
:body: "[My solution in Ruby](https://github.com/aosousa/AdventOfCode2018/blob/master/day2.rb). Using Advent of Code to learn Ruby this year so any tips are welcome!"
|
258
258
|
:replies: []
|
259
259
|
- :author: EngCanuck
|
260
|
-
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eayzzlt
|
260
|
+
:url: https://www.reddit.com/r/adventofcode/comments/a2aimr/2018_day_2_solutions/eayzzlt
|
261
261
|
:body: |-
|
262
262
|
Ruby:
|
263
263
|
|