File tree Expand file tree Collapse file tree 3 files changed +263
-0
lines changed Expand file tree Collapse file tree 3 files changed +263
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " 2023: Day 3 - Gear Ratios"
3
+ date : 2023-12-3
4
+ categories :
5
+ - TAG_1
6
+ - TAG_2
7
+ draft : true
8
+ ---
9
+
10
+ ## Setup
11
+
12
+ [ The original challenge] ( https://adventofcode.com/2023/day/3 )
13
+
14
+ ``` {r}
15
+ library(aochelpers)
16
+ library(dplyr)
17
+ # other options: aoc_input_data_frame(), aoc_input_matrix()
18
+ input <- aoc_input_matrix(3, 2023)
19
+ head(input)
20
+ ```
21
+
22
+ # TLDR; Solutions
23
+
24
+ ## Part 1 ⭐
25
+
26
+ ::: {.callout-danger}
27
+ ### ❓ W
28
+
29
+ :::
30
+
31
+
32
+ ## Part 2 ⭐⭐
33
+
34
+ ::: {.callout-danger}
35
+ ### ❓
36
+
37
+ :::
38
+
39
+
40
+ # Walkthrough / Explainer
41
+
42
+ I get to a gondola that'll take me to the water source. But ofc the gondola is broken. Why would I expect any different. Gotta find the missing part.
43
+
44
+ ## Part 1
45
+
46
+ :::{.callout-exa icon=true}
47
+ Example Data
48
+ ``` {r}
49
+ exa <- c("467..114..",
50
+ "...*......",
51
+ "..35..633.",
52
+ "......#...",
53
+ "617*......",
54
+ ".....+.58.",
55
+ "..592.....",
56
+ "......755.",
57
+ "...$.*....",
58
+ ".664.598..")
59
+
60
+ # convert to match aoc matrix input
61
+ (exa.in <- matrix(unlist(strsplit(exa, split = "")),
62
+ nrow = length(exa), byrow = TRUE))
63
+ ```
64
+
65
+ dot's don't mean anything, so make them missing.
66
+ ``` {r}
67
+ exa.in[exa.in=="."] <- NA
68
+ exa.in
69
+ ```
70
+
71
+ We only care if the number is neighbors with a symbol, so convert all symbols to something common.
72
+ ``` {r}
73
+ (ex3 <- gsub("\\D", "*", exa.in))
74
+ ```
75
+
76
+
77
+
78
+
79
+
80
+ ## Part 2
81
+
82
+ :::{.callout-exa icon=true}
83
+ Example Data
84
+ ``` {r}
85
+ exa <- 0
86
+ ```
87
+
88
+
89
+
90
+ ##### Session info {.appendix}
91
+
92
+ <details ><summary >Toggle</summary >
93
+
94
+
95
+ ``` {r}
96
+ #| echo: false
97
+ sessioninfo::session_info(pkgs = "attached")
98
+ ```
99
+
100
+
101
+ </details >
102
+
103
+
104
+
105
+
106
+
You can’t perform that action at this time.
0 commit comments