-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
58 lines (47 loc) · 2.45 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r badges, echo = FALSE}
badge_stars <- function(color = "green", url = NULL, cookie = Sys.getenv("ADVENT_COOKIE_2024")) {
req <- httr::GET(
glue::glue('https://adventofcode.com/'),
httr::add_headers(
.headers = c(
"user-agent" = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
"cookie" = paste0("session=", cookie)
)
)
)
parsed <- xml2::read_html(req)
stars <- rvest::html_node(parsed, ".user")
star_text <- rvest::html_text(stars)
badge <- paste0("![](https://img.shields.io/badge/", "2024 star count", "-", star_text, "-", color, ".svg)")
if (is.null(url))
return(badge)
paste0("[", badge, "](", url, ")")
}
```
# Advent of Code
<!-- badges: start -->
`r badge_stars()`
<!-- badges: end -->
This repo contains all of my Advent of Code solutions using R. I'm using this to practice programming and problem-based solutions, but it's mostly for a little holiday fun. I'm also using a custom repo badge that scrapes a user's Advent of Code star count and displays it as a badge.
## Solutions so far
### [2024](R/2024) | [2023](R/2023) | [2022](R/2022) | [2021](R/2021) | [2020](R/2020)
| Day | Puzzle | Solution | Data |
| :---: | :---: | :---: | :---: |
| 1 | [Historian Hysteria](https://adventofcode.com/2024/day/1) | [R](R/2024/day01.R) | [Puzzle input](data/2024/day01.txt)
| 2 | [Red-Nosed Reports](https://adventofcode.com/2024/day/2) | [R](R/2024/day02.R) | [Puzzle input](data/2024/day02.txt)
| 3 | [Mull It Over](https://adventofcode.com/2024/day/3) | [R](R/2024/day03.R) | [Puzzle input](data/2024/day03.txt)
| 4 | [Ceres Search](https://adventofcode.com/2024/day/4) | [R](R/2024/day04.R) | [Puzzle input](data/2024/day04.txt)
| 5 | [Print Queue](https://adventofcode.com/2024/day/5) | [R](R/2024/day05.R) | [Puzzle input](data/2024/day05.txt)
| 6 | [Guard Gallivant](https://adventofcode.com/2024/day/6) | [R](R/2024/day06.R) | [Puzzle input](data/2024/day06.txt)
| 7 | [Bridge Repair](https://adventofcode.com/2024/day/7) | [R](R/2024/day07.R) | [Puzzle input](data/2024/day07.txt)
| 8 | [Resonant Collinearity](https://adventofcode.com/2024/day/8) | [R](R/2024/day08.R) | [Puzzle input](data/2024/day08.txt)
| 9 | [Disk Fragmenter](https://adventofcode.com/2024/day/9) | [R](R/2024/day09.R) | [Puzzle input](data/2024/day09.txt)