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: skawid
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7vzdf
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7vzdf
|
4
4
|
:body: |-
|
5
5
|
Ruby!
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
Part 2 took some head scratching to find an algorithm that didn't take forever.
|
10
10
|
:replies: []
|
11
11
|
- :author: "[deleted]"
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7tg41
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7tg41
|
13
13
|
:body: |-
|
14
14
|
**ruby**
|
15
15
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
This is a brute force solution but it stops looping when it finds the target for both parts. The approximate completion time is ~5 seconds.
|
23
23
|
:replies: []
|
24
24
|
- :author: el_daniero
|
25
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7edop
|
25
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7edop
|
26
26
|
:body: |-
|
27
27
|
# Ruby
|
28
28
|
|
@@ -52,18 +52,18 @@
|
|
52
52
|
```
|
53
53
|
:replies:
|
54
54
|
- :author: zeeba_neighba
|
55
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7sog7
|
55
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf7sog7
|
56
56
|
:body: Nice! I didn't know about `.lazy` I want to implement that in the future
|
57
57
|
:replies: []
|
58
58
|
- :author: dearshrewdwit
|
59
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf79fe3
|
59
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf79fe3
|
60
60
|
:body: |-
|
61
61
|
Functional [Ruby](https://github.com/dearshrewdwit/adventofcode/blob/master/2020/9/cypher-functional.rb) with recursion
|
62
62
|
|
63
63
|
Edit: got told off for pasting code, sorry! See link for code
|
64
64
|
:replies: []
|
65
65
|
- :author: kawzeg
|
66
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5pkr1
|
66
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5pkr1
|
67
67
|
:body: |-
|
68
68
|
**Ruby**
|
69
69
|
|
@@ -76,7 +76,7 @@
|
|
76
76
|
```
|
77
77
|
:replies: []
|
78
78
|
- :author: damyvv
|
79
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5q7sm
|
79
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5q7sm
|
80
80
|
:body: |-
|
81
81
|
**Ruby**
|
82
82
|
|
@@ -89,7 +89,7 @@
|
|
89
89
|
```
|
90
90
|
:replies: []
|
91
91
|
- :author: petercooper
|
92
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5n55h
|
92
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5n55h
|
93
93
|
:body: |-
|
94
94
|
# Ruby
|
95
95
|
|
@@ -106,14 +106,14 @@
|
|
106
106
|
```
|
107
107
|
:replies: []
|
108
108
|
- :author: frontpageminus
|
109
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf51h87
|
109
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf51h87
|
110
110
|
:body: |-
|
111
111
|
Ruby 1507/706. I forgot to convert the input to ints before adding them, took way too long to figure out
|
112
112
|
|
113
113
|
[paste](https://topaz.github.io/paste/#XQAAAQAgAwAAAAAAAAARiAqGkkN7pUjVWW5PmC0L6aBapSEWgmKw16LRnqk8MWLR0XniOEFoHImRzzHbojWP9/KPFyWlRwlf9iuxcCPOF3cwEecpGcDtvpNvX4s0TtaqjSZswu4WXzB4X+spXJnNaUo+Ps9+3O4csu9ETgBALRvcc9ZR+UPnydkXsoHeX+33uO/7/2yBUoveTl2fr3r+Jy7H+D54SKUuwx0M6/UxysDIRhXg9Dv2j2a7kq4NOtwIha7MtDbRnx6Tw3+ut++qywRaWTxfAfNSHL3oM42iMLdYMnWgjghR7j9CaieSdPBdBFVH1zbUy9/WeWaq0KyidvNc7sR7vGScKZIQPjOyuda6ArYH6YUWlUD89mOQmOQ+6VYVMWQAVnpltYDTCUQb8zy8JVeg9mRtYfIbiww3iGoYPAhPj1K8toNHLFmCm0FZShbrZRQ3ykgTWFe+UKSNaAZfqk85RfS8myg7s+sv78rxm0xyyYVHR17MWUf+VX9B0sL9v/3lUNU=)
|
114
114
|
:replies: []
|
115
115
|
- :author: ni3t
|
116
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf546jm
|
116
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf546jm
|
117
117
|
:body: |-
|
118
118
|
# Ruby
|
119
119
|
|
@@ -127,15 +127,15 @@
|
|
127
127
|
```
|
128
128
|
:replies: []
|
129
129
|
- :author: odlp
|
130
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5msmo
|
130
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5msmo
|
131
131
|
:body: Here's my [solution in Ruby](https://github.com/odlp/advent-of-code-2020/blob/main/day-9/solution.rb).
|
132
132
|
:replies: []
|
133
133
|
- :author: blafunke
|
134
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf55til
|
134
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf55til
|
135
135
|
:body: "[**Ruby**](https://topaz.github.io/paste/#XQAAAQBpAwAAAAAAAAARiEJHiiMzw3cPM/1Y611SZZy8dLcvLPFv5CaI5QAeyDUOD9g6sOqRoHNTUi8vG310j7C40PhkIuDkIfK9LbzmPHL5jWRBHMH9yR5NOmbSsS4BF8FHwzXFHxMtBLjdmCODNvRiPMNfQOxOhHvbbHDUYEWvYg64I3tbZ81WBS4PHm35X/+55lmYBGw6YCnMN07oZ0H/AEjR3rbRTE5ymST2UKrtHL6Yh63ofbNkU2lzC7bD3iwrETmuXRjnwMjuZc7jSw9G6rLKh27rgesAUJ7g8ftT8bd5Qhl7iK0P1b+rzWXc1ZiSA+UT9Awiu/1ZWRCre6OVjiXjnkKhbMZn4nwQTO2D2WiLX2UkWIIZTr4l1YvaPKyv1bAQAOlPoq8RelGPKzWNUqWMSr2O+p2YLL2+ZKf8k4ehfC/1bgVEZSaOF1vF6ghkYmL2rZoM60T6K6Wt+fsFzr25lydHVFElzYffJYgTmXMvXBRkU4wxrSWS+/6r6mBkSCvYACeNV/63RDu0L0IwV2nuwOmHCPPjt3W5c2NbPeSN5sH5G+jLZ1fNgvoKh6mdqBn/+QQsQQ==)"
|
136
136
|
:replies: []
|
137
137
|
- :author: zxywx
|
138
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf56juf
|
138
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf56juf
|
139
139
|
:body: |-
|
140
140
|
# Ruby Solution
|
141
141
|
|
@@ -171,7 +171,7 @@
|
|
171
171
|
```
|
172
172
|
:replies: []
|
173
173
|
- :author: CodeIsTheEnd
|
174
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5aq7n
|
174
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5aq7n
|
175
175
|
:body: |-
|
176
176
|
**Ruby:** 4:37/11:27, 345/634
|
177
177
|
|
@@ -180,11 +180,11 @@
|
|
180
180
|
Gah, I tried to get fancy and it cost me! For Part 1 I was initially going to sort the previous 25 numbers so it would be easier to check if two numbers added up to the solution, before I realized that then I wouldn't know which value to remove from the sorted array. (Nevermind that you can still check if any two numbers sum to the value in linear time even with them being sorted (See Day 1), and that with the index I could easily figure out which value I needed to remove...) Then in Part 2 I initially tried to implement the linear time solution, but it didn't work, and I mistakenly thought it _couldn't_ work so switched over to the standard n^2 solution.
|
181
181
|
:replies:
|
182
182
|
- :author: petercooper
|
183
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5njrb
|
183
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5njrb
|
184
184
|
:body: Fellow Rubyist chiming in again :-D We ran similar times today (you just beat me overall, I was slightly ahead for part 1) but I had a very different approach this time unlike other days. I'm pretty amazed you got all of that down within that time! :-)
|
185
185
|
:replies: []
|
186
186
|
- :author: Krakhan
|
187
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5df5n
|
187
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5df5n
|
188
188
|
:body: |-
|
189
189
|
# Ruby
|
190
190
|
|
@@ -193,26 +193,26 @@
|
|
193
193
|
[paste](https://topaz.github.io/paste/#XQAAAQD7AgAAAAAAAAAnFUW8WzF1WEoJx9V0hOKfg4NcZ7WDhdZEbbwcIoUqv1+y3wBBrL2nBKRx9PDu2eqWV5w7eZ8p/dHEMvzPdtqMoTg8ubrtrjtjf+6OUUPiJ/l+L7PA7kZxnaeraDwwz5V1gGClahEcV2kJenOadVBIJ49iA9X8aOwk6+7R1PQM0mZ1tbA5Y+v4uw3Ahoex/N1uRfqzZZlyC+P4dedhdXKTtribrpUo1Fddw/X+BJWtL4SsNvlu7knEoKdp/MH1xPp8+a8mO7ghXgj4sXWzCR9pgloJxk3KEgEuwzOOmt+dKoBkZG3xxrvM5ncaTP3mvDxVzDpNWNye8TAsqw37cXV71KHLNiK3Ye/6nt3K55hKxDc5PnqUoc2BUbiTW65lBEsWeLvMM/ZFp3U1TCaohJvgE6/C0y2CQpYUG8s+XPirj4NRjUQN1rqCIk9Llry2/SKcsCAAZACHGUAGzIBN3CyUXRhV9qZL9n5VU8wX8NRmV5vwCIATOmH3mtdYidbQ1wH+RD7RJf9yZbkA)
|
194
194
|
:replies:
|
195
195
|
- :author: petercooper
|
196
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5neve
|
196
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5neve
|
197
197
|
:body: One way is to refactor out the nested loop. `each_cons` would assist in this situation. Consider that `arr.each_cons(3)` will return an enumerator of each block of 3 elements. See my solution elsewhere on this post if you want to see it in situ.
|
198
198
|
:replies: []
|
199
199
|
- :author: Intro245
|
200
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5oq1j
|
200
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf5oq1j
|
201
201
|
:body: One solution for this problem that works in most languages is to put the loops into a separate function and use `return` to break out. So in this case, the return value could be either `contiguous_numbers` or the solution to part 2.
|
202
202
|
:replies: []
|
203
203
|
- :author: 2k3
|
204
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf6hsy4
|
204
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf6hsy4
|
205
205
|
:body: |-
|
206
206
|
Another [Ruby](https://github.com/Kyrremann/advent-of-code/blob/main/y2020/day-09.rb) solution.
|
207
207
|
|
208
208
|
Most interesting for me was to use `combination()` in the first part.
|
209
209
|
:replies:
|
210
210
|
- :author: sky_badger
|
211
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf6itm4
|
211
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf6itm4
|
212
212
|
:body: Interesting to see a different language (I'm doing AoC in Python). Did you know the input file is different for every competitor? So the hardcoded target in star\_2() will only work for your input. You cold make the solution more generic by storing the star\_1() result in a variable and using that as your star\_2() target instead. Just a though. Is Ruby fast?
|
213
213
|
:replies:
|
214
214
|
- :author: 2k3
|
215
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf6mkxl
|
215
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k9lfwj/2020_day_09_solutions/gf6mkxl
|
216
216
|
:body: |-
|
217
217
|
Didn't think about the different input, should use the return value for part two. Thanks!
|
218
218
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: blafunke
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfhhpxr
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfhhpxr
|
4
4
|
:body: |-
|
5
5
|
[Ruby](https://pastebin.com/33r1dfnx)
|
6
6
|
|
7
7
|
Fairly efficient in both space and time I think. Sorting is the worst part.
|
8
8
|
:replies: []
|
9
9
|
- :author: Markavian
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfdzoe0
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfdzoe0
|
11
11
|
:body: |-
|
12
12
|
Here's my node js solution for Day 10. It's not the best.
|
13
13
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
Roll on day 11...
|
19
19
|
:replies: []
|
20
20
|
- :author: ACProctor
|
21
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfd237l
|
21
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfd237l
|
22
22
|
:body: |-
|
23
23
|
## Ruby
|
24
24
|
|
@@ -100,14 +100,14 @@
|
|
100
100
|
```
|
101
101
|
:replies:
|
102
102
|
- :author: SnooEagles6377
|
103
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/ghah2my
|
103
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/ghah2my
|
104
104
|
:body: |-
|
105
105
|
Thanks for the thorough discussion of part 2, it helped me simplify my solution.
|
106
106
|
|
107
107
|
For part one, let me help you simplify yours :) To count the differences between numbers, you can use `each_cons(2)` and subtract them. Then if you are using a newer Ruby, use `.tally` to do the count (otherwise you can do `group_by(&:itself).values.map(&:size)`). Turns part one into a one-liner.
|
108
108
|
:replies: []
|
109
109
|
- :author: Krakhan
|
110
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfci2wh
|
110
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfci2wh
|
111
111
|
:body: |-
|
112
112
|
# Ruby
|
113
113
|
|
@@ -116,7 +116,7 @@
|
|
116
116
|
[paste](https://topaz.github.io/paste/#XQAAAQAhBAAAAAAAAAAwmQhJeBEoRoycf4oaE6QWXYzfGQaKTTe+cU2mAjnDZZItrEaWBFPT3hHlTOWkxk6YOPCJEnKolvO7Ow+6ckmMp5BV9q+olHDzGgr2rZwcmYbSYEeLWBGusH9v/96/Q3ULKOZlj844B/25KTOxdHmL5xtk45Tn4/snm7Tou+uusWsNu6QgT6Xs22yTiuzQFEea9w9bESJraONWuhJq/SQYHCP0DZd8sfpE4ZCY2DMM6AorXNmG4hb6Yi6V04n1bcJ0wvxdNHj0G/3pL79OqrQL1GZjRnV1vRGE0Owc0p/GslWn/SSUFjwKhwU6GiurE0OVPrgyHVpi5qymZ7eexe+rrVguBV58hvO7GJdHEUtI/xEg0TbONZsOy1NDZ1AyIVyoLLR9bKT4EGfRbnv8CVwM+BB/WSoeSSC66wCGO3YvQbWkWgf7du1+QclxpJoW/ODcwc0A7wn035rKz3ClexwwPTjHqqMlf7rWlNVJ0q2yixzmvfsFPc4R9JrZeoyCtt9MF5XBlh03veR5vYej33f6RnupqkSRO1FLMCbEpx/BmjWDREdmIsQLx0u8BjOyxgjeBL+6Qrmsu568QUfzpbWFmmWVKuf+y0ynnSn1AK1izUYAUAOpIM4XUOHnrgRhfp67yQj7pDErG8usgmVW64M02usd0WAr/z4TNwA=)
|
117
117
|
:replies: []
|
118
118
|
- :author: jtgorn
|
119
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfcaf2q
|
119
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfcaf2q
|
120
120
|
:body: |-
|
121
121
|
Has anyone seen this solutions? Ruby:
|
122
122
|
|
@@ -131,7 +131,7 @@
|
|
131
131
|
```
|
132
132
|
:replies:
|
133
133
|
- :author: mattaman101
|
134
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gffj2jv
|
134
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gffj2jv
|
135
135
|
:body: |-
|
136
136
|
> c = [nil,nil,nil,1]
|
137
137
|
>
|
@@ -140,19 +140,19 @@
|
|
140
140
|
Man, nice work. I recognized it was a dp question, and started memorizing, and then switched to tabulation but I couldn't get it to work. I had the idea, but this made it so much easier to realize.
|
141
141
|
:replies: []
|
142
142
|
- :author: Karl_Marxxx
|
143
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfcw7sb
|
143
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfcw7sb
|
144
144
|
:body: Can you explain the logic of part 1 to me? Also, how does part 2 work? Isn't i a value from the input (not an index)?
|
145
145
|
:replies:
|
146
146
|
- :author: jtgorn
|
147
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfg6ak2
|
147
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfg6ak2
|
148
148
|
:body: Sorry, I do not understand your question about part 2.
|
149
149
|
:replies:
|
150
150
|
- :author: Karl_Marxxx
|
151
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfkp7c4
|
151
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfkp7c4
|
152
152
|
:body: I was confused because you are using the value from a as an index into c. This confused me because I assumed you would quickly run into an indexing out-of-bounds error. Another user pointed out that ruby simply backfills nils up until the needed index, which I hadn't known before.
|
153
153
|
:replies: []
|
154
154
|
- :author: jtgorn
|
155
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfg65zs
|
155
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfg65zs
|
156
156
|
:body: |-
|
157
157
|
Part 1 actually assumes that there are no differencies of 2. With such assumptions: imagine the list of differencies. It only consists of 3s and 1s. The total sum of that list should give input joltage of your device (a.max+3). If there are A 3s and B 1s, the total sum is A\*3+B. You know how many differencies there are (a.count+1) which gives you two equasions:
|
158
158
|
|
@@ -164,11 +164,11 @@
|
|
164
164
|
it is easy to calculate A and B from that and calculate A\*B.
|
165
165
|
:replies:
|
166
166
|
- :author: Karl_Marxxx
|
167
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfkosty
|
167
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfkosty
|
168
168
|
:body: Awesome, thanks!
|
169
169
|
:replies: []
|
170
170
|
- :author: '442401'
|
171
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gffkzmv
|
171
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gffkzmv
|
172
172
|
:body: |-
|
173
173
|
This is quite beautiful.
|
174
174
|
|
@@ -179,7 +179,7 @@
|
|
179
179
|
In part 2, yes `i` is the value from the input but it is also being used as an index into the array. `a.each { |i| c[i+3] = c[i..i+2].compact.sum }` says that every time an adaptor with a value 1 greater than the previous is added to the collection, the number of possible arrangements will increase by the sum of the previous 3 possible arrangements whereas adding an adaptor with a value 3 greater than the previous maximum will not alter the number of possible arrangements.
|
180
180
|
:replies: []
|
181
181
|
- :author: gurgeous
|
182
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf90tw1
|
182
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf90tw1
|
183
183
|
:body: |-
|
184
184
|
Ruby, 265/382, after cleanup:
|
185
185
|
|
@@ -201,7 +201,7 @@
|
|
201
201
|
```
|
202
202
|
:replies: []
|
203
203
|
- :author: hltk
|
204
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf91xad
|
204
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf91xad
|
205
205
|
:body: |-
|
206
206
|
Ruby. Part 2 uses the hash table's constructor (recursively) for building the dp.
|
207
207
|
|
@@ -220,7 +220,7 @@
|
|
220
220
|
```
|
221
221
|
:replies: []
|
222
222
|
- :author: petercooper
|
223
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9oykp
|
223
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9oykp
|
224
224
|
:body: |-
|
225
225
|
# Ruby
|
226
226
|
|
@@ -234,7 +234,7 @@
|
|
234
234
|
```
|
235
235
|
:replies: []
|
236
236
|
- :author: el_daniero
|
237
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfamvp0
|
237
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfamvp0
|
238
238
|
:body: |-
|
239
239
|
# Ruby
|
240
240
|
|
@@ -279,14 +279,14 @@
|
|
279
279
|
```
|
280
280
|
:replies: []
|
281
281
|
- :author: frontpageminus
|
282
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf90ccm
|
282
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf90ccm
|
283
283
|
:body: |-
|
284
284
|
Ruby 500/359. Probably could make this fancier, but the memoization got part two under a second.
|
285
285
|
|
286
286
|
[paste](https://topaz.github.io/paste/#XQAAAQCSAwAAAAAAAAARiAqGkkN7pUjVWW5Qxng6Sa5RIpX45F8jD+UzAnG94fGsw92jqpPvt0f0lNYaCwwDk7adI7w0p58gIuu0WGbp0gmxYNjQhRjLVp0BOJ0lsE6giFORUZUludzYZM7a4FlFlc+5/guuelyungcIh33yxUBBjWlPJ0U05V+eQYrAbgbA6GiLxvwnwFe1QFaagyl0KD/pkR5uhPQfcdeX0VuKuqHU/5jrkF7j4UMryIm5CXIg/zVRrO99t/j+wONt0KJnBfDup9zbXYVG2/MJRFoByudziiUXK3oTtYxfzWKxF2/dUGhWsDnm8IIix3J4qF/aC0tnAIKPwisdRD+zqyvW0mTdtYK+B2uev0kwa6/0Jd6Ps8bMxsDgPUdu6g6ws3b+XEwvuPnitlqe9fzhGYmj9z3DYM3wAYPhxY21gJytiK/mHUREK+OOLkApZgntdpj77ZIkWN4ClUwy7vqmMgJRjxBncMSoLy3/1aVvzQ==)
|
287
287
|
:replies: []
|
288
288
|
- :author: Unihedron
|
289
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf91536
|
289
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf91536
|
290
290
|
:body: |-
|
291
291
|
Ruby 149/44.
|
292
292
|
|
@@ -309,7 +309,7 @@
|
|
309
309
|
```
|
310
310
|
:replies: []
|
311
311
|
- :author: CodeIsTheEnd
|
312
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9cr2t
|
312
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9cr2t
|
313
313
|
:body: |-
|
314
314
|
**Ruby:** 8:06/29:01, 1409/1335
|
315
315
|
|
@@ -320,7 +320,7 @@
|
|
320
320
|
Part 2 didn't go much better. I spent a while implementing a recursive solution, which I eventually got written "correctly" only to then realize that it wouldn't never finish in time. (It was only at this point I read the comment about "more than a trillion"...) Rather than switch to a dynamic programming/memoization method, I broke up the input into "chunks" where the end of one chunk was separated by the start of the next chunk by 3, indicating that both adapters HAD to be used. Then I could compute how many different chains there were in each shorter chunk, using the same solution I had already come up with, then multiple those all together.
|
321
321
|
:replies:
|
322
322
|
- :author: petercooper
|
323
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9ouwx
|
323
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9ouwx
|
324
324
|
:body: |-
|
325
325
|
Part 2 of this one totally beat me too for a while. I failed to notice the "over a trillion" comment and wrote a very naive recursive search (though over a graph) and went down the same rabbit hole you did! :-D
|
326
326
|
|
@@ -334,7 +334,7 @@
|
|
334
334
|
```
|
335
335
|
:replies: []
|
336
336
|
- :author: Robert-Damoc
|
337
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9nvaj
|
337
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9nvaj
|
338
338
|
:body: |-
|
339
339
|
You can also find the solution in the following link: [Day 10 Solution in Ruby](https://github.com/robert-damoc/Advent-of-Code/blob/master/2020/Day10/day10.rb) - This repo includes solutions for past days too.
|
340
340
|
|
@@ -387,14 +387,14 @@
|
|
387
387
|
```
|
388
388
|
:replies: []
|
389
389
|
- :author: AmazedAlligator
|
390
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfag6bj
|
390
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfag6bj
|
391
391
|
:body: |-
|
392
392
|
Super Simple **Ruby** solution for part 2 which counts paths in a directed graph. Not nearly as succinct as the other one but hopefully it's easy to understand.
|
393
393
|
|
394
394
|
[https://github.com/m7rk/adventofcode2020/blob/master/10.rb](https://github.com/m7rk/adventofcode2020/blob/master/10.rb)
|
395
395
|
:replies: []
|
396
396
|
- :author: "[deleted]"
|
397
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfb338j
|
397
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfb338j
|
398
398
|
:body: |-
|
399
399
|
Ruby
|
400
400
|
|
@@ -429,7 +429,7 @@
|
|
429
429
|
```
|
430
430
|
:replies: []
|
431
431
|
- :author: Karl_Marxxx
|
432
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfbq4f4
|
432
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfbq4f4
|
433
433
|
:body: |-
|
434
434
|
# Ruby
|
435
435
|
|
@@ -455,7 +455,7 @@
|
|
455
455
|
```
|
456
456
|
:replies:
|
457
457
|
- :author: theGalation
|
458
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfc5lbn
|
458
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfc5lbn
|
459
459
|
:body: |-
|
460
460
|
THANK YOU
|
461
461
|
|
@@ -464,15 +464,15 @@
|
|
464
464
|
If I get this in a whiteboard I am eating the markers.
|
465
465
|
:replies:
|
466
466
|
- :author: Karl_Marxxx
|
467
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfc641m
|
467
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfc641m
|
468
468
|
:body: It's a dynamic programming approach. Lemme know if you'd like me to help break it down!
|
469
469
|
:replies: []
|
470
470
|
- :author: theGalation
|
471
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfc7gp1
|
471
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gfc7gp1
|
472
472
|
:body: This is some good ruby magic.
|
473
473
|
:replies: []
|
474
474
|
- :author: anericod
|
475
|
-
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9dsvd
|
475
|
+
:url: https://www.reddit.com/r/adventofcode/comments/ka8z8x/2020_day_10_solutions/gf9dsvd
|
476
476
|
:body: |-
|
477
477
|
# Ruby
|
478
478
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Krakhan
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gffp3au
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gffp3au
|
4
4
|
:body: |-
|
5
5
|
# Ruby
|
6
6
|
|
@@ -9,14 +9,14 @@
|
|
9
9
|
[paste](https://topaz.github.io/paste/#XQAAAQBECwAAAAAAAAAkk4bN/Dq9JvpdmcyYGaBc7LQX/buFf1oDyCAw4zc/6HyE0/lc22e478Mw/zzhx1WgUiFjq9QIRbKna4otu0Ap5rU8ChjwBjw1pbLYvr04QDdpNlXzWCuuoQkSkHb3fx0GjDHFLj7US6MrO+lBB01QaueCu9jCDv2FBezBSuEJGFvdewTPqrZCf808GJ3ne1O4hAK4nwh7YE4ecLnAXVwFFWlQVp7eGe6rau6+utPDJ6WiOtp6ec2BxhAro2iK7WMRNQSXS5ngHVYCIUL0S8GTQ7T3v5GCJTi3u7L538V+cEm9g9W1RotbwGGCF3cK/fvfSMH+wpqW3P4hKNpKcVw2H4d1nYkrv7VCCTiZNtTtmusKckhC8UzovPGA+bURvMUW+pM0A2xY9X7WTGeof8fP0KYp4UydB+fPouiZdcE5bHlUUGnKkQGUhhmptbDeYaQUz47DCUb44Ha3ia4k5m0EywRNVHcgDtBqNF1ZYus4SEHfk01/gvgX7uCBEdcFuEvJandmXH6kfafkbFkJWJWtPV2YtCDN2KRm7TDpS7e6Oy8YUeUhTXzmPs6HMANBVoyD4jGe6oHKUmPdnC7j8tVG9RjLeR5GUlFC9eX91+IG0DfqxOaSE3tAurvGMRyFonxAYZEExDJ4JoLALnyfgD6XnSznVAo9d0p0IipmIGGsUPZCodOr6d4xAHY/mEdFEXBEZKuf0vrJFuI3XQBFC1B0VYfDwz6t66Q2EtsNqn0a6GVZvIZ9OT52MJ3L+miUBw9uuNcwY/5vVWSx32abo3xSplOIlucst6XxRJJ7O3xZNf6HwTV5mMYsj/jymdPOm9CC+d44tmsYLorb4Omi7MEgBVn2rmUqKHIpI6k70UhL5nAI52xkgkkSUsZaNZdOVuoyrSjmvSR2oBxH9bIwP2yngLPOa5cUJYcSZ+9JqSuopZ4A8qIDYXiLTsnBwxhexqO6BKwb3hUfdiN5YBuzddr2y3Xg76cibBCKmoXb5HlWPb/9onPZFUag87e95+oSsve/x85qNbMLgPiarjBtFuxHBWLmqnjPqbCZGlmd1OvDq9jnlJt0y689bba2FXDJ7j+Wpkb8FvWTnhvdIRVt4+Holo2w3vzyoNbyZCJjqWOEIL/H5eCHxrIDFMGMCPxfU7pQOIgE28r+Aujt+S01vNRE5q+dnaLqiN7NCGGHzQUoPME3ZiukTQnruNjalZcekmJ499EvOSe2iTtA3nf3VhRUh3RwzjgCF3y+zFnpQT31AhXuydVQ1uMCLAEOkj6Mh6fgWfrlpElJcWmRedKL9uzxNBOTsnr+2s79g1UZh7yC2ODXxq6XPMFDeqPljAakR8kH3MoKcvj8QSLl)
|
10
10
|
:replies:
|
11
11
|
- :author: Krakhan
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfgbunl
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfgbunl
|
13
13
|
:body: |-
|
14
14
|
Better solution that uses one less copy on each iteration, skipping floor tiles in the main loop and not saving them when looking up surroundings, and just caching each of the seat visibilities. About 3-4 seconds on each part now, much better.
|
15
15
|
|
16
16
|
[pastebin](https://pastebin.com/gshb1ebL)
|
17
17
|
:replies:
|
18
18
|
- :author: mr_banana_lord
|
19
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/ggghzwi
|
19
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/ggghzwi
|
20
20
|
:body: |-
|
21
21
|
Late to the party, but nethertheless I would like to share my solution as it's even faster (1.3s).
|
22
22
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
[https://github.com/MrBananaLord/adventofcode/blob/master/day\_11/task\_2.rb](https://github.com/MrBananaLord/adventofcode/blob/master/day_11/task_2.rb)
|
26
26
|
:replies: []
|
27
27
|
- :author: CodeIsTheEnd
|
28
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfdicvy
|
28
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfdicvy
|
29
29
|
:body: |-
|
30
30
|
**Ruby:** 9:08/26:44, 138/643
|
31
31
|
|
@@ -36,7 +36,7 @@
|
|
36
36
|
I lost TONS of time because I didn't re-initialize my starting location when exploring in different directions in Part 2. This led to very confusing output and serious concern that I didn't understand something about Ruby scoping rule.
|
37
37
|
:replies: []
|
38
38
|
- :author: gurgeous
|
39
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfd7730
|
39
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfd7730
|
40
40
|
:body: |-
|
41
41
|
Ruby 317/181
|
42
42
|
|
@@ -45,18 +45,18 @@
|
|
45
45
|
Two things I've learned since last year (1) use arrays for directions (2) use ranges for bounds checking!
|
46
46
|
:replies:
|
47
47
|
- :author: lasagnaman
|
48
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfd8qkv
|
48
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfd8qkv
|
49
49
|
:body: yooooo your tip (1) is sick. Stealing that for the future.
|
50
50
|
:replies: []
|
51
51
|
- :author: frontpageminus
|
52
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfdkgih
|
52
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfdkgih
|
53
53
|
:body: |-
|
54
54
|
Ruby 11227/8772. Fell asleep before the problems were released again ¯\_(ツ)\_/¯
|
55
55
|
|
56
56
|
[paste](https://topaz.github.io/paste/#XQAAAQBOBgAAAAAAAAARiAqGkkN7pUjVWW5PyUyHG0Kg1qjbFQsxMn57rA2U8PFRT9HwDm/jKPypT8lhWbRv+5Mo6S7pU2e8bFUf9NSngYwD8fRFsFWwB/qQX9QCKImN+t63gpP8aHfrzxMICG/37U3JjprLqRfhXS0Z+cF/uQf5vPg3nOuFgbBZO0SfqYfqd3OT73cAby2RoHQ6BnemvsZkbpJdG/Io69nx211VbrO9zYqlDzGrqss3RkolVDBNJIVCrnlQDG7oEBUTFlA2Cb/HvJ5At2q3DlSwX4tfMx7Br+Gl/d7zi1zicV5XnqkPZSxsopagVzF5EY2Cwyz/4teszqzY6k2CYgHPD4x1T1/ubJWSmev/nOKWuyN3+Z9Ruci+L7icqOhP52XsaITKLi2k5H7fJPfeIT9lfFjzEwB4WUUkX77ycS7iDXRl7oYp81WebaJgACdwHkcXdaWGGjT70fgM+5l4tOsZN44Z9wfh1nGeympHMzfWxLaxyRUsYC/uINKVA9lZGEKRlBWLLcw48t0G1CpeoFVuaRwSK26PrzKVRfnpqr1L9ZM7QfczoKtvpU6l3HgXV1nMsW6A/vy8TAJ5lqn+vsb/vb5Fp1+e0nOwcOublmWNb3B373LdoiH1Wp/k/x3GQuE5qWFJx/IDDtdEjS76W9T6nzrunfPOSPZS4ElnCOkyBWVq+2GgLZk1RY0DOfwMomfYfc4+WlMciCBkZjfKuRbIXwkxyQGhZFv+Tj6t)
|
57
57
|
:replies: []
|
58
58
|
- :author: wholarry
|
59
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfeu6gb
|
59
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kaw6oz/2020_day_11_solutions/gfeu6gb
|
60
60
|
:body: |-
|
61
61
|
[Ruby](https://github.com/dgokman/advent_of_code_2020/blob/main/aoc_2020_11.rb)
|
62
62
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: adjudicator
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gflr8bq
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gflr8bq
|
4
4
|
:body: |-
|
5
5
|
OO Ruby:
|
6
6
|
|
@@ -9,14 +9,14 @@
|
|
9
9
|
Just using the 90 degree neg/swap vector rotation trick. Still took a while to figure out!
|
10
10
|
:replies: []
|
11
11
|
- :author: odlp
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfkejes
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfkejes
|
13
13
|
:body: |-
|
14
14
|
[Ruby](https://github.com/odlp/advent-of-code-2020/blob/main/day-12/solution.rb)
|
15
15
|
|
16
16
|
Enjoyed cracking out `Array#rotate!` ([ref](https://ruby-doc.org/core-2.7.2/Array.html#method-i-rotate-21)) to adjust the direction in part 1!
|
17
17
|
:replies: []
|
18
18
|
- :author: willkill07
|
19
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfjy87o
|
19
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfjy87o
|
20
20
|
:body: |-
|
21
21
|
# Swift
|
22
22
|
|
@@ -27,22 +27,22 @@
|
|
27
27
|
Done: C (2) , C++ (6) , Java (3), OCaml (1), Python (4), Bash (5), Swift (12) Todo (well, ones to choose from): F#, Haskell, Lisp, C#, Javascript, Typescript, Perl, Ruby, Scala, Rust, Assembly, Kotlin, FORTRAN, D, Go, Nim, Awk, Sed, Perl
|
28
28
|
:replies:
|
29
29
|
- :author: its_a_gibibyte
|
30
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfkblw5
|
30
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfkblw5
|
31
31
|
:body: This is an awesome idea, and a cool way to familiarize yourself with a bunch of different languages. What about Raku? If you're planning on doing Perl anyway, it'd be nice to do them one after another and compare the two.
|
32
32
|
:replies:
|
33
33
|
- :author: willkill07
|
34
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfl7nx4
|
34
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfl7nx4
|
35
35
|
:body: |-
|
36
36
|
Well /u/ **abigail** mentioned that I have Perl twice to choose from... so I’ll add Raku to the potential list
|
37
37
|
|
38
38
|
I have some familiarity with most of these, so it’s just a matter of **doing** it
|
39
39
|
:replies: []
|
40
40
|
- :author: __Abigail__
|
41
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfk9wvu
|
41
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfk9wvu
|
42
42
|
:body: Perl twice? Good choice.
|
43
43
|
:replies: []
|
44
44
|
- :author: i_have_no_biscuits
|
45
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfk6bu5
|
45
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfk6bu5
|
46
46
|
:body: |-
|
47
47
|
... GWBASIC?
|
48
48
|
|
@@ -51,7 +51,7 @@
|
|
51
51
|
(You can dip your toe in the water with QBASIC if you want...)
|
52
52
|
:replies: []
|
53
53
|
- :author: parentheses-of-doom
|
54
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi249v
|
54
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi249v
|
55
55
|
:body: |-
|
56
56
|
[Ruby](https://github.com/Prajjwal/advent-of-code/blob/master/2020/ruby/day_12.rb)
|
57
57
|
|
@@ -60,14 +60,14 @@
|
|
60
60
|
Runs lightning fast, too, since the cartesian transforms are just static lookups.
|
61
61
|
:replies: []
|
62
62
|
- :author: petercooper
|
63
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfiw6qf
|
63
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfiw6qf
|
64
64
|
:body: |-
|
65
65
|
# Ruby
|
66
66
|
|
67
67
|
Kept it [short and sweet](https://gist.github.com/peterc/ef27494a081c48334d1ef29ff67f9f4c) today. I don't do both solutions in one file so mushed them together here.
|
68
68
|
:replies: []
|
69
69
|
- :author: gurgeous
|
70
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhsb4b
|
70
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhsb4b
|
71
71
|
:body: |-
|
72
72
|
Ruby, 50/305
|
73
73
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
Edit: here's how you do it with Ruby's Complex number support. I gotta learn this https://gist.github.com/gurgeous/a719b780fa5b117ec5a8f6ede5280985
|
79
79
|
:replies:
|
80
80
|
- :author: ald_loop
|
81
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhsjry
|
81
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhsjry
|
82
82
|
:body: |-
|
83
83
|
> sigh. I admire those who can do this quickly with complex numbers.
|
84
84
|
>
|
@@ -87,26 +87,26 @@
|
|
87
87
|
Does not compute
|
88
88
|
:replies: []
|
89
89
|
- :author: frontpageminus
|
90
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhsbhf
|
90
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhsbhf
|
91
91
|
:body: |-
|
92
92
|
Ruby 744/1520. My brain absolutely shut down trying to figure out how to do the L/R rotations in part two.
|
93
93
|
|
94
94
|
[paste](https://topaz.github.io/paste/#XQAAAQCpBgAAAAAAAAARiAqGkkN7pUjVWW5N06C9m0mxVKYwp83rTcRiKZucKy4ybNfbMp0Ut7lQYAGdIiY8Ss+49n+2YO5gh8nFh4IluugFFJd3MqZpehAvPqerIS/eDJJ2lyaUXh9xddAmGUA0ojALOLzyegeztuXdWijKBp8cEPi0NK7+91NXXH/EhX8o5hu7nYFFl4On5dMfZvkztMvb3fPtC6TGigR9H7AFB2A/pk8coLYV3mGmhrEPnZHPq5pP7zf/zYc+QoJz0xkPD/6QKN/Jrs6G1iDx49lR5RMaensNbQPWgMptlmx6kX6mTCM+ibVSDl9A8iR9E7iyTh0mopQ3Skv2luUBJCk0uDJVnfso2BGS4GuhOhGkC2Xe9G6tVRlGMn0SNsteteL4PjNn+vJJCVcRWZbKwvbGqrts/7x5zolt/H4SLZX48cW9Y1Vc5ONnIBk2ojQae/HDyU3vPX/RBaP5BM+672pBjqKRu+wfOPuudYBojizeRH5PGf/gUtHPJVHzfubM+ULS6VDU53wuH0Aggi5Ebrhn9i2/0zpt70KzKpvU4ycvVx9Nz7pBJv/2rpp4)
|
95
95
|
:replies:
|
96
96
|
- :author: sentry07
|
97
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhtb5p
|
97
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhtb5p
|
98
98
|
:body: I misread the second part and thought it was still rotating the ship. Then I fixed it and screwed up an if statement and my 180 rotations weren’t happening. I shouldn’t do these when I’m tired.
|
99
99
|
:replies: []
|
100
100
|
- :author: nospamas
|
101
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi5fdd
|
101
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi5fdd
|
102
102
|
:body: If you ever need a reference in future googling for "Coordinate rotation rules" or "Coordinate rotation table" will get you something like [this](https://useruploads.socratic.org/V4G3pprQT5evsH3JS5Zy_9D861043-9375-4DC6-85EE-5FDA751F5053.png). You could probably work it out with a piece of paper but way easier to google.
|
103
103
|
:replies:
|
104
104
|
- :author: frontpageminus
|
105
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfkcc48
|
105
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfkcc48
|
106
106
|
:body: Yeah, that would’ve been much easier than drawing it out. Thanks!
|
107
107
|
:replies: []
|
108
108
|
- :author: "[deleted]"
|
109
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhxo8f
|
109
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfhxo8f
|
110
110
|
:body: |-
|
111
111
|
# Ruby
|
112
112
|
|
@@ -115,7 +115,7 @@
|
|
115
115
|
[https://gist.github.com/Clashbuster/b66c950a6ad762a378d5c3c54d78c1a5](https://gist.github.com/Clashbuster/b66c950a6ad762a378d5c3c54d78c1a5)
|
116
116
|
:replies: []
|
117
117
|
- :author: Krakhan
|
118
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi05h8
|
118
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi05h8
|
119
119
|
:body: |-
|
120
120
|
# Ruby
|
121
121
|
|
@@ -124,7 +124,7 @@
|
|
124
124
|
[pastebin](https://pastebin.com/RdhqEzCa)
|
125
125
|
:replies:
|
126
126
|
- :author: jtgorn
|
127
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfipktf
|
127
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfipktf
|
128
128
|
:body: |-
|
129
129
|
I have the same approach, however I prefer another style of coding
|
130
130
|
|
@@ -154,14 +154,14 @@
|
|
154
154
|
```
|
155
155
|
:replies: []
|
156
156
|
- :author: Krakhan
|
157
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi7jcv
|
157
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi7jcv
|
158
158
|
:body: |-
|
159
159
|
More compact version that uses complex numbers for both parts after realizing the generalisation noting that Part 1 is just a 'waypoint' at (1, 0) as well. Edit: Realized as I woke up that the only thing needed to change was whether you're moving the ship or waypoint. So, corrected function here below for that.
|
160
160
|
|
161
161
|
[pastebin](https://pastebin.com/SDzcS0mx)
|
162
162
|
:replies: []
|
163
163
|
- :author: CodeIsTheEnd
|
164
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi084b
|
164
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfi084b
|
165
165
|
:body: |-
|
166
166
|
**Ruby:** 7:16/14:30, 347/257
|
167
167
|
|
@@ -170,7 +170,7 @@
|
|
170
170
|
Reasonably satisfied with this one. I imagine people who do more competition coding have rotation matrices down pat. Lost some time in Part 2 due to a bad find/replace.
|
171
171
|
:replies: []
|
172
172
|
- :author: el_daniero
|
173
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfizpvb
|
173
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfizpvb
|
174
174
|
:body: |-
|
175
175
|
# Ruby
|
176
176
|
|
@@ -244,6 +244,6 @@
|
|
244
244
|
Also, for part two at first I had `puts ship_x + ship_y` at the bottom (forgot the `.abs` part) and ended up with the same resulta as part1; Is there a pattern here, or just coincidence?
|
245
245
|
:replies:
|
246
246
|
- :author: el_daniero
|
247
|
-
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfmwdd8
|
247
|
+
:url: https://www.reddit.com/r/adventofcode/comments/kbj5me/2020_day_12_solutions/gfmwdd8
|
248
248
|
:body: 'Also made an online visualization thing here: [https://daniero.netlify.app/aoc/2020/12/part2](https://daniero.netlify.app/aoc/2020/12/part2) (WIP)'
|
249
249
|
:replies: []
|