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: yjerem
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db36vjr
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db36vjr
|
4
4
|
:body: |-
|
5
5
|
This was really fun! Here's a compiler in Ruby that outputs C.
|
6
6
|
|
@@ -41,11 +41,11 @@
|
|
41
41
|
```
|
42
42
|
:replies:
|
43
43
|
- :author: willkill07
|
44
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db36zjn
|
44
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db36zjn
|
45
45
|
:body: heh, I [did mine in awk](https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db36od6/). Almost identical
|
46
46
|
:replies: []
|
47
47
|
- :author: brantyr
|
48
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db37axs
|
48
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5hus40/2016_day_12_solutions/db37axs
|
49
49
|
:body: |-
|
50
50
|
Ruby assembunny parser. Scraped into the top 100, but have done some heavy refactoring since that
|
51
51
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: yjerem
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db6bfrw
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db6bfrw
|
4
4
|
:body: |-
|
5
5
|
Ruby, took 90 seconds to run for part II:
|
6
6
|
|
@@ -35,7 +35,7 @@
|
|
35
35
|
```
|
36
36
|
:replies:
|
37
37
|
- :author: 3urny
|
38
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db6p8s0
|
38
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db6p8s0
|
39
39
|
:body: |-
|
40
40
|
I did a Ruby solution too. It took about 80s just like yours. One thing that makes the ruby code fast is only checking for hashes with 5 repeated characters at first, and then going back when one is found.
|
41
41
|
|
@@ -46,11 +46,11 @@
|
|
46
46
|
And since I had the forking anyways, I used that too and got it to run in 5s with both C extension and forking.
|
47
47
|
:replies: []
|
48
48
|
- :author: jtbandes
|
49
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db6cm0z
|
49
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db6cm0z
|
50
50
|
:body: "Very neat. TIL that `String#[]` can accept a substring to search for.\n\nI got #3 for part 1 with a much less clean Ruby solution, but it was too slow for part 2...then I made the fatal choice of deciding to rewrite it in C... \U0001F635 let's just say you won't find me on the part 2 leaderboard."
|
51
51
|
:replies: []
|
52
52
|
- :author: el_daniero
|
53
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db758en
|
53
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5i8pzz/2016_day_14_solutions/db758en
|
54
54
|
:body: |-
|
55
55
|
Ruby.
|
56
56
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: jtbandes
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7uj0t
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7uj0t
|
4
4
|
:body: |-
|
5
5
|
Today's a great day for [another](https://www.reddit.com/r/adventofcode/comments/3xjpp2/day_20_solutions/cy59qye/) [Mathematica one-liner](http://reference.wolfram.com/language/ref/ChineseRemainder.html):
|
6
6
|
|
@@ -35,25 +35,25 @@
|
|
35
35
|
- off-by-one errors :(
|
36
36
|
:replies:
|
37
37
|
- :author: Wee2mo
|
38
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7vciq
|
38
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7vciq
|
39
39
|
:body: I had a hunch Mathematica would have an abrupt solution if you happened to know about it.
|
40
40
|
:replies: []
|
41
41
|
- :author: nononopotato
|
42
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/dbalad9
|
42
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/dbalad9
|
43
43
|
:body: |-
|
44
44
|
I tried this with my input: ChineseRemainder[{10, 15, 17, 1, 0, 1}-Range[6], {13, 17, 19, 7, 5, 3}]
|
45
45
|
|
46
46
|
And it gave me 388735, which wasn't the correct answer..? Anything I did wrong?
|
47
47
|
:replies:
|
48
48
|
- :author: jtbandes
|
49
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/dbatom5
|
49
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/dbatom5
|
50
50
|
:body: |-
|
51
51
|
You missed a `-`; it should be `ChineseRemainder[-{10, 15, 17, 1, 0, 1}-Range[6], {13, 17, 19, 7, 5, 3}]`.
|
52
52
|
|
53
53
|
That's because, for instance, for your first disc we want `10+t+1 = 0 (mod 13)`, or `t = -10-1 (mod 13)`.
|
54
54
|
:replies: []
|
55
55
|
- :author: andars_
|
56
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7u0fg
|
56
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7u0fg
|
57
57
|
:body: |-
|
58
58
|
Ruby!
|
59
59
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
```
|
87
87
|
:replies:
|
88
88
|
- :author: jtbandes
|
89
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7uy6u
|
89
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7uy6u
|
90
90
|
:body: |-
|
91
91
|
Quick tip that I've been using for some of these: you can use the `DATA`/` __END__ ` feature to cram everything in one file:
|
92
92
|
|
@@ -98,11 +98,11 @@
|
|
98
98
|
```
|
99
99
|
:replies:
|
100
100
|
- :author: andars_
|
101
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7v4ik
|
101
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7v4ik
|
102
102
|
:body: That's neat, I haven't seen that before. I'll give it a try.
|
103
103
|
:replies: []
|
104
104
|
- :author: mperham
|
105
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7vnz8
|
105
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db7vnz8
|
106
106
|
:body: |-
|
107
107
|
I created the input manually rather than regexp'ing it. Enumerable#all? came in super-handy:
|
108
108
|
|
@@ -127,18 +127,18 @@
|
|
127
127
|
```
|
128
128
|
:replies:
|
129
129
|
- :author: "[deleted]"
|
130
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db805j4
|
130
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db805j4
|
131
131
|
:body: "[deleted]"
|
132
132
|
:replies:
|
133
133
|
- :author: mperham
|
134
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db8c8jb
|
134
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db8c8jb
|
135
135
|
:body: |-
|
136
136
|
Whoa, that first line is amazing. Kudos.
|
137
137
|
|
138
138
|
Side note, I always use #detect because #find clashes with ActiveRecord::Base#find.
|
139
139
|
:replies: []
|
140
140
|
- :author: eregontp
|
141
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db8qn8e
|
141
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ifn4v/2016_day_15_solutions/db8qn8e
|
142
142
|
:body: |-
|
143
143
|
Mine is p (0..Float::INFINITY).find { |t| disks.all? { |dt, n, pos| (t + pos + dt) % n == 0 } }
|
144
144
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: "[deleted]"
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5imh3d/2016_day_16_solutions/db9m64a
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5imh3d/2016_day_16_solutions/db9m64a
|
4
4
|
:body: |-
|
5
5
|
This is one lucky program that runs both in Ruby and Crystal :-)
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: el_daniero
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5isvxv/2016_day_17_solutions/dbb5xbi
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5isvxv/2016_day_17_solutions/dbb5xbi
|
4
4
|
:body: |-
|
5
5
|
Ruby. I made the search into a generator which yields all the paths in the order they are found. Then I could call `first` and `max` on the same object to get the answers for part 1 and 2 respectively.
|
6
6
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
```
|
49
49
|
:replies: []
|
50
50
|
- :author: yjerem
|
51
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5isvxv/2016_day_17_solutions/dbarvjw
|
51
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5isvxv/2016_day_17_solutions/dbarvjw
|
52
52
|
:body: |-
|
53
53
|
Ruby, 13/11!
|
54
54
|
|
@@ -85,7 +85,7 @@
|
|
85
85
|
```
|
86
86
|
:replies:
|
87
87
|
- :author: mperham
|
88
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5isvxv/2016_day_17_solutions/dbbbt1b
|
88
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5isvxv/2016_day_17_solutions/dbbbt1b
|
89
89
|
:body: |-
|
90
90
|
Recursion will clean up your code alot.
|
91
91
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5iyp50/2016_day_18_solutions/dbc4udx
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5iyp50/2016_day_18_solutions/dbc4udx
|
4
4
|
:body: |-
|
5
5
|
My first naive solution takes about 17 seconds to finish part 2. Once again, this is unacceptably slow.
|
6
6
|
|
@@ -81,7 +81,7 @@
|
|
81
81
|
About half a second. Not as good as the compiled C code, which takes about 7 milliseconds, but it'll do.
|
82
82
|
:replies: []
|
83
83
|
- :author: eregontp
|
84
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5iyp50/2016_day_18_solutions/dbcb1ln
|
84
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5iyp50/2016_day_18_solutions/dbcb1ln
|
85
85
|
:body: |-
|
86
86
|
Ruby one-liner. I find it rather readable for a golfed solution.
|
87
87
|
|
@@ -90,7 +90,7 @@
|
|
90
90
|
```
|
91
91
|
:replies: []
|
92
92
|
- :author: johneffort
|
93
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5iyp50/2016_day_18_solutions/dbcpya7
|
93
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5iyp50/2016_day_18_solutions/dbcpya7
|
94
94
|
:body: |-
|
95
95
|
Ruby, quite readable, not very fast, but doable. 30s for part 2
|
96
96
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: el_daniero
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jbeqo/2016_day_20_solutions/dbfo4nb
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jbeqo/2016_day_20_solutions/dbfo4nb
|
4
4
|
:body: |-
|
5
5
|
**Ruby**. Clean as I could and covering any corner cases.
|
6
6
|
|
@@ -36,7 +36,7 @@
|
|
36
36
|
```
|
37
37
|
:replies:
|
38
38
|
- :author: anonymous_4_custody
|
39
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jbeqo/2016_day_20_solutions/dbjdm3n
|
39
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jbeqo/2016_day_20_solutions/dbjdm3n
|
40
40
|
:body: |-
|
41
41
|
> Ruby
|
42
42
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbge41p
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbge41p
|
4
4
|
:body: |-
|
5
5
|
Full disclosure: Of course for the leaderboard placement I will brute force the password by trying every permutation of abcdefgh. It makes sense to do that because we have the forward process programmed and "do not have time" to make the reverse process. At least, it would probably take more time to make the reverse process than to just brute force.
|
6
6
|
|
@@ -74,14 +74,14 @@
|
|
74
74
|
As far as I can tell, there is only one unique solution for any given input (please correct if I am wrong).
|
75
75
|
:replies:
|
76
76
|
- :author: topaz2078
|
77
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbge6w8
|
77
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbge6w8
|
78
78
|
:body: |-
|
79
79
|
> As far as I can tell, there is only one unique solution for any given input
|
80
80
|
|
81
81
|
All of the functions _should_ be perfectly reversible. I tried to be quite careful about that.
|
82
82
|
:replies:
|
83
83
|
- :author: daniel-sd
|
84
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbges98
|
84
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbges98
|
85
85
|
:body: |-
|
86
86
|
For size 8 this is true. But for the sample size (5), rotate around letter is not always reversible.
|
87
87
|
|
@@ -104,18 +104,18 @@
|
|
104
104
|
Unfortunately practicing with the sample input was quite confusing for this one.
|
105
105
|
:replies:
|
106
106
|
- :author: BumpitySnook
|
107
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbgf1py
|
107
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbgf1py
|
108
108
|
:body: Your puzzle input wasn't abcde, though. Topaz controls the inputs and the scrambling recipe.
|
109
109
|
:replies: []
|
110
110
|
- :author: topaz2078
|
111
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbgfoqx
|
111
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbgfoqx
|
112
112
|
:body: For the second part, you can use the example generator you wrote in part 1. Furthermore, your input is the process, not the string - the string you're working on is the same for everyone.
|
113
113
|
:replies: []
|
114
114
|
- :author: bildzeitung
|
115
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbgexsx
|
115
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbgexsx
|
116
116
|
:body: That's the gotcha -- size 8 is key to making that rule work. Eric's mapping function is unique over that string length.
|
117
117
|
:replies: []
|
118
118
|
- :author: eregontp
|
119
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbhak5z
|
119
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5ji29h/2016_day_21_solutions/dbhak5z
|
120
120
|
:body: 'And indeed, for the example output (decab), there are two valid inputs: abcde and deabc.'
|
121
121
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: p_tseng
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhw73s
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhw73s
|
4
4
|
:body: |-
|
5
5
|
Those compatible pairs that we were asked to print out in part 1? [You know something funny about them?](#s "They all involve the empty disk!!!"). So this game devolves into "how can we move the data with only one disk empty at a time?", sort of like those [sliding tile puzzles](https://en.wikipedia.org/wiki/15_puzzle).
|
6
6
|
|
@@ -111,25 +111,25 @@
|
|
111
111
|
```
|
112
112
|
:replies:
|
113
113
|
- :author: topaz2078
|
114
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhwjaw
|
114
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhwjaw
|
115
115
|
:body: |-
|
116
116
|
> They all involve the empty disk.
|
117
117
|
|
118
118
|
Could it be a clue?!
|
119
119
|
:replies: []
|
120
120
|
- :author: pedrosorio
|
121
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhwe0d
|
121
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhwe0d
|
122
122
|
:body: |-
|
123
123
|
> Those compatible pairs that we were asked to print out in part 1? They all involve the empty disk.
|
124
124
|
|
125
125
|
That's it, from now on in advent of code, if asked about number of things X, I am always going to print the list of things X :P
|
126
126
|
:replies:
|
127
127
|
- :author: topaz2078
|
128
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhx3so
|
128
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhx3so
|
129
129
|
:body: That is a _really_ good strategy. Many of the puzzles' part 1 is just a stepping stone to make sure you're on-track for part 2.
|
130
130
|
:replies: []
|
131
131
|
- :author: BumpitySnook
|
132
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhwvxz
|
132
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhwvxz
|
133
133
|
:body: |-
|
134
134
|
Your solution arrives at 225 steps for my input, as does /u/drysle 's. My solution and hand solution get 224. The website says neither is correct. /u/topaz2078 , help? Input is here: http://dpaste.com/0JHB11A
|
135
135
|
|
@@ -169,22 +169,22 @@
|
|
169
169
|
```
|
170
170
|
:replies:
|
171
171
|
- :author: topaz2078
|
172
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhx0cw
|
172
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhx0cw
|
173
173
|
:body: For part two, I get 225, and that's also what the site is expecting.
|
174
174
|
:replies:
|
175
175
|
- :author: BumpitySnook
|
176
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhxarn
|
176
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhxarn
|
177
177
|
:body: I swear I entered 225 into the site and got 'Wrong'. Doh. Must have typoed it.
|
178
178
|
:replies:
|
179
179
|
- :author: "[deleted]"
|
180
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbiew3r
|
180
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbiew3r
|
181
181
|
:body: Did you get the right answer? I counted yours and got 232. Is it right?
|
182
182
|
:replies:
|
183
183
|
- :author: BumpitySnook
|
184
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbif5yn
|
184
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbif5yn
|
185
185
|
:body: As topaz says, 225 is correct.
|
186
186
|
:replies: []
|
187
187
|
- :author: Quick_Question404
|
188
|
-
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhww4u
|
188
|
+
:url: https://www.reddit.com/r/adventofcode/comments/5jor9q/2016_day_22_solutions/dbhww4u
|
189
189
|
:body: I immediately thought of the sliding tile puzzle when seeing this problem, but couldn't think of any way to programatically solve it.
|
190
190
|
:replies: []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: eregontp
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlqjqh
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlqjqh
|
4
4
|
:body: |-
|
5
5
|
2 lines of Ruby:
|
6
6
|
|
@@ -12,11 +12,11 @@
|
|
12
12
|
Just change the argument to rotate to 1 for part 1.
|
13
13
|
:replies:
|
14
14
|
- :author: "[deleted]"
|
15
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqltuo8
|
15
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqltuo8
|
16
16
|
:body: "[deleted]"
|
17
17
|
:replies: []
|
18
18
|
- :author: jschulenklopper
|
19
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlq7z2
|
19
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlq7z2
|
20
20
|
:body: |-
|
21
21
|
Short solution in Ruby, combining both parts:
|
22
22
|
|
@@ -33,7 +33,7 @@
|
|
33
33
|
```
|
34
34
|
:replies:
|
35
35
|
- :author: jschulenklopper
|
36
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlws4o
|
36
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlws4o
|
37
37
|
:body: |-
|
38
38
|
Even more Ruby-esque:
|
39
39
|
|
@@ -50,11 +50,11 @@
|
|
50
50
|
This removes the elements not meeting the condition from the array, and then totals the remaining digits.
|
51
51
|
:replies: []
|
52
52
|
- :author: Grimnur87
|
53
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlu3s6
|
53
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlu3s6
|
54
54
|
:body: Good to know. Same approach here, at least the crux lines. I did use an `each_cons(2)` in the first part. This is neater.
|
55
55
|
:replies: []
|
56
56
|
- :author: disclosure5
|
57
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlik5e
|
57
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlik5e
|
58
58
|
:body: |-
|
59
59
|
Ruby
|
60
60
|
|
@@ -74,7 +74,7 @@
|
|
74
74
|
```
|
75
75
|
:replies: []
|
76
76
|
- :author: egze
|
77
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlw51d
|
77
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7gsrc2/2017_day_1_solutions/dqlw51d
|
78
78
|
:body: |-
|
79
79
|
My ruby attempt
|
80
80
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnakx9
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnakx9
|
4
4
|
:body: |-
|
5
5
|
Rank #7 for Part 1 ^^ just slightly over 1 minute with Ruby! Didn't make it on leaderboards with part 2 due to a stupid bug that took **18!!!** minutes to debug :(
|
6
6
|
|
@@ -26,15 +26,15 @@
|
|
26
26
|
```
|
27
27
|
:replies:
|
28
28
|
- :author: Grimnur87
|
29
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnl07h
|
29
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnl07h
|
30
30
|
:body: I also used sort! and reverse to optimise the search.
|
31
31
|
:replies:
|
32
32
|
- :author: Unihedron
|
33
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqno5nn
|
33
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqno5nn
|
34
34
|
:body: My problem was that I did not check value==compare value and sometimes searches return prematurely as false positive of division to 1. But yes, it was a straightforward approach to take.
|
35
35
|
:replies: []
|
36
36
|
- :author: "[deleted]"
|
37
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqna63c
|
37
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqna63c
|
38
38
|
:body: |-
|
39
39
|
You guys are FAST. But since I see no Ruby solutions I'll still post mine:
|
40
40
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
```
|
79
79
|
:replies:
|
80
80
|
- :author: Fluffy_ribbit
|
81
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnbx6d
|
81
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnbx6d
|
82
82
|
:body: |-
|
83
83
|
```ruby
|
84
84
|
def check(sheet)
|
@@ -105,18 +105,18 @@
|
|
105
105
|
```
|
106
106
|
:replies: []
|
107
107
|
- :author: jschulenklopper
|
108
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnhhaw
|
108
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnhhaw
|
109
109
|
:body: 'Here''s mine: https://raw.githubusercontent.com/jschulenklopper/adventofcode/master/2017/day02/day02b.rb. Reasonably concise but still readable.'
|
110
110
|
:replies:
|
111
111
|
- :author: mentero
|
112
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqniwss
|
112
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqniwss
|
113
113
|
:body: |-
|
114
114
|
> Ruby
|
115
115
|
|
116
116
|
and mine https://gist.github.com/mentero/3cce36ee20effcf1691992a00692c05c
|
117
117
|
:replies: []
|
118
118
|
- :author: disclosure5
|
119
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnb1mb
|
119
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnb1mb
|
120
120
|
:body: |-
|
121
121
|
[Ruby solution here](https://raw.githubusercontent.com/technion/aoc2017/master/two.rb).
|
122
122
|
|
@@ -127,7 +127,7 @@
|
|
127
127
|
```
|
128
128
|
:replies:
|
129
129
|
- :author: jschulenklopper
|
130
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqne8n0
|
130
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqne8n0
|
131
131
|
:body: |-
|
132
132
|
Tip: `string.split(" ")` splits on any whitespace: spaces and tabs.
|
133
133
|
|
@@ -142,15 +142,15 @@
|
|
142
142
|
```
|
143
143
|
:replies: []
|
144
144
|
- :author: "[deleted]"
|
145
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnbarw
|
145
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnbarw
|
146
146
|
:body: "[deleted]"
|
147
147
|
:replies:
|
148
148
|
- :author: disclosure5
|
149
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnbvmx
|
149
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnbvmx
|
150
150
|
:body: Thanks ! I should have realised they would be tabs..
|
151
151
|
:replies: []
|
152
152
|
- :author: rkachowski
|
153
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqni74z
|
153
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqni74z
|
154
154
|
:body: |-
|
155
155
|
i was pretty similar. the same approach with different methods
|
156
156
|
|
@@ -159,11 +159,11 @@
|
|
159
159
|
```
|
160
160
|
:replies:
|
161
161
|
- :author: disclosure5
|
162
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnig0x
|
162
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnig0x
|
163
163
|
:body: TIL that .lines is an existing function
|
164
164
|
:replies: []
|
165
165
|
- :author: "[deleted]"
|
166
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqomop6
|
166
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqomop6
|
167
167
|
:body: |-
|
168
168
|
Ruby is amazing!
|
169
169
|
|
@@ -176,7 +176,7 @@
|
|
176
176
|
```
|
177
177
|
:replies: []
|
178
178
|
- :author: disclosure5
|
179
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnffzu
|
179
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h0rnm/2017_day_2_solutions/dqnffzu
|
180
180
|
:body: |-
|
181
181
|
Following the rushed Ruby, [here's a hopefully nice Erlang answer.](https://github.com/technion/aoc2017/blob/master/two.erl). I don't really follow why line #26 is needed. The file does not end in a new line, but the split/2 seems to break out an empty list at the end anyway.
|
182
182
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqowh44
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqowh44
|
4
4
|
:body: |-
|
5
5
|
Ruby, part 1 - maths turned out to be a trap and I fell into it
|
6
6
|
|
@@ -74,15 +74,15 @@
|
|
74
74
|
```
|
75
75
|
:replies:
|
76
76
|
- :author: "[deleted]"
|
77
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoynk8
|
77
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoynk8
|
78
78
|
:body: Oh my. Why do you write minified code?
|
79
79
|
:replies:
|
80
80
|
- :author: Unihedron
|
81
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoypai
|
81
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoypai
|
82
82
|
:body: I'm in the mind set of code golfing because that is my only strength. When you are in unfamiliar territory, it's best to carry something you have with you.
|
83
83
|
:replies: []
|
84
84
|
- :author: mikefh
|
85
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoyh9r
|
85
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoyh9r
|
86
86
|
:body: |-
|
87
87
|
Ruby
|
88
88
|
|
@@ -253,18 +253,18 @@
|
|
253
253
|
```
|
254
254
|
:replies:
|
255
255
|
- :author: Unihedron
|
256
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoz9yp
|
256
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoz9yp
|
257
257
|
:body: I'm still new to ruby, and it didn't occur to me that an approach like finding all nearby squares every round instead of handling them per case exists. I learned ( / promptly looked up) a lot of interesting things about ruby in attempt to understand your code. Thank you for sharing and well done! ^^
|
258
258
|
:replies:
|
259
259
|
- :author: mikefh
|
260
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqozwxc
|
260
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqozwxc
|
261
261
|
:body: |-
|
262
262
|
Thanks! And I'm pumped that it helped you uncover new features of the language. I considered using a ruby metaprogramming technique, but it would have hurt its clarity.
|
263
263
|
|
264
264
|
Though, after seeing the other more-efficient strategies, I may rewrite after I digest the math.
|
265
265
|
:replies: []
|
266
266
|
- :author: nawap
|
267
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoyhbr
|
267
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqoyhbr
|
268
268
|
:body: |-
|
269
269
|
Ruby for problem 1
|
270
270
|
|
@@ -298,7 +298,7 @@
|
|
298
298
|
```
|
299
299
|
:replies: []
|
300
300
|
- :author: el_daniero
|
301
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqp6u3y
|
301
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqp6u3y
|
302
302
|
:body: |-
|
303
303
|
# Ruby
|
304
304
|
|
@@ -379,7 +379,7 @@
|
|
379
379
|
You can see it in its entirety [here](https://github.com/daniero/code-challenges/blob/master/aoc2017/ruby/03.rb)
|
380
380
|
:replies: []
|
381
381
|
- :author: andreesgor
|
382
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqtiv3v
|
382
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7h7ufl/2017_day_3_solutions/dqtiv3v
|
383
383
|
:body: |-
|
384
384
|
I honestly think this is the most bizarre - in all ways - solution here (Ruby)
|
385
385
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Unihedron
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqj92m
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqj92m
|
4
4
|
:body: |-
|
5
5
|
Ruby, #8 silver #4 gold (run with -x)
|
6
6
|
|
@@ -26,11 +26,11 @@
|
|
26
26
|
PS: I now keep a [log series detailing my adventofcode adventure](https://github.com/Unihedro/workout/blob/master/adventofcode2017/entry1.md). If you're interested feel free to read it as I write more, if I do!
|
27
27
|
:replies:
|
28
28
|
- :author: topaz2078
|
29
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqnfky
|
29
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqnfky
|
30
30
|
:body: Fun log series! It's always enlightening to see some stream-of-consciousness gut-reaction to the puzzles so I can try to improve them for next year.
|
31
31
|
:replies: []
|
32
32
|
- :author: Frizkie
|
33
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqo3ae
|
33
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqo3ae
|
34
34
|
:body: |-
|
35
35
|
Never code golfed before, but I gave it a try:
|
36
36
|
|
@@ -43,7 +43,7 @@
|
|
43
43
|
```
|
44
44
|
:replies:
|
45
45
|
- :author: jschulenklopper
|
46
|
-
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqr184
|
46
|
+
:url: https://www.reddit.com/r/adventofcode/comments/7hf5xb/2017_day_4_solutions/dqqr184
|
47
47
|
:body: |-
|
48
48
|
You can trim some characters using `readlines()`. No need for a `split()` anymore:
|
49
49
|
|