Skip to content

Commit

Permalink
day 10: setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sreedevk committed Dec 10, 2024
1 parent f486c86 commit 34004c7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ gleam test
# Run the solution against actual input for a particular day
gleam run <day>
```

## Solution Status

1. [x] [Day 01 Historian Hysteria](https://github.com/sreedevk/advent-of-code/blob/main/src/historian_hysteria.gleam)
2. [x] [Day 02 Red Nosed Reports](https://github.com/sreedevk/advent-of-code/blob/main/src/red_nosed_reports.gleam)
3. [x] [Day 03 Mull It Over](https://github.com/sreedevk/advent-of-code/blob/main/src/mull_it_over.gleam)
4. [x] [Day 04 Ceres Search](https://github.com/sreedevk/advent-of-code/blob/main/src/ceres_search.gleam)
5. [x] [Day 05 Print Queue](https://github.com/sreedevk/advent-of-code/blob/main/src/print_queue.gleam)
6. [x] [Day 06 Guard Gallivant](https://github.com/sreedevk/advent-of-code/blob/main/src/guard_gallivant.gleam)
7. [x] [Day 07 Bridge Repair](https://github.com/sreedevk/advent-of-code/blob/main/src/bridge_repair.gleam)
8. [x] [Day 08 Resonant Collinearity](https://github.com/sreedevk/advent-of-code/blob/main/src/resonant_collinearity.gleam)
9. [ ] [Day 09 Disk Fragmenter](https://github.com/sreedevk/advent-of-code/blob/main/src/disk_fragmenter.gleam)
10. [ ] [Day 10 Hoof It](https://github.com/sreedevk/advent-of-code/blob/main/src/hoof_it.gleam)
20 changes: 18 additions & 2 deletions src/advent_of_code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import gleam/io
import gleam/result
import guard_gallivant as day06
import historian_hysteria as day01
import hoof_it as day10
import mull_it_over as day03
import print_queue as day05
import red_nosed_reports as day02
Expand Down Expand Up @@ -117,10 +118,12 @@ pub fn main() {
result.unwrap(
result.map(read("data/day8.txt"), fn(data) {
io.println(
"[8] Bridge Repair (Part 1): " <> int.to_string(day08.solve_a(data)),
"[8] Resonant Collinearity (Part 1): "
<> int.to_string(day08.solve_a(data)),
)
io.println(
"[8] Bridge Repair (Part 2): " <> int.to_string(day08.solve_b(data)),
"[8] Resonant Collinearity (Part 2): "
<> int.to_string(day08.solve_b(data)),
)
}),
Nil,
Expand All @@ -141,6 +144,19 @@ pub fn main() {
Nil,
)
}
["10"] -> {
result.unwrap(
result.map(read("data/day10.txt"), fn(data) {
io.println(
"[10] Hoof It (Part 1): " <> int.to_string(day10.solve_a(data)),
)
io.println(
"[10] Hoof It (Part 2): " <> int.to_string(day10.solve_b(data)),
)
}),
Nil,
)
}
_ -> io.println_error("invalid arguments!")
}
}
7 changes: 7 additions & 0 deletions src/hoof_it.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pub fn solve_a(_: String) -> Int {
0
}

pub fn solve_b(_: String) -> Int {
0
}
21 changes: 21 additions & 0 deletions test/hoof_it_test.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import gleam/string
import gleeunit/should
import hoof_it as day10

fn test_data() -> String {
string.join(
[
"89010123", "78121874", "87430965", "96549874", "45678903", "32019012",
"01329801", "10456732",
],
"\n",
)
}

pub fn solve_a_test() {
should.equal(day10.solve_a(test_data()), 36)
}

pub fn solve_b_test() {
should.equal(day10.solve_b(test_data()), 0)
}

0 comments on commit 34004c7

Please sign in to comment.