Skip to content

Commit 4ff4582

Browse files
committed
fix a bug and readme
1 parent 9a2cf3f commit 4ff4582

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Advent of Code 2025
22

33
[![Tests](https://github.com/devries/advent_of_code_2025/actions/workflows/test.yml/badge.svg)](https://github.com/devries/advent_of_code_2025/actions/workflows/test.yml)
4-
[![Stars: 18](https://img.shields.io/badge/⭐_Stars-18-yellow)](https://adventofcode.com/2025)
4+
[![Stars: 20](https://img.shields.io/badge/⭐_Stars-20-yellow)](https://adventofcode.com/2025)
55

66
This year will be my second year doing Advent of Code in [Gleam](https://gleam.run).
77
Last year I was still learning the language, and in the past year I have used it
@@ -65,13 +65,13 @@ information.
6565
but there is a line going through one of the walls. I ran out of time
6666
this morning to work on this and will pick it up later.
6767

68-
- [Day 10](https://adventmfcode.com/2025/day/10): [⭐ solution](src/day010/solution.gleam)
68+
- [Day 10](https://adventmfcode.com/2025/day/10): [⭐ solution](src/day10/solution.gleam)
6969

7070
I tried doing part 2 a naive way with some memoization, but it seems like
7171
I still need to work on it. Code was getting very convoluted anyway, not
7272
pretty like the first several days.
7373

74-
- [Day 11](https://adventmfcode.com/2025/day/11): [⭐ ⭐ solution](src/day011/solution.gleam)
74+
- [Day 11](https://adventmfcode.com/2025/day/11): [⭐ ⭐ solution](src/day11/solution.gleam)
7575

7676
Back on track with today's problem. This is a straightforward depth-first
7777
search, but I add memoization so I don't have to keep revisiting paths

src/day11/solution.gleam

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,28 @@ fn start_path_count(
6464
) -> Int {
6565
use cache <- memoize.with_cache()
6666

67-
count_paths(links, start, end, 0, cache)
67+
count_paths(links, start, end, cache)
6868
}
6969

7070
fn count_paths(
7171
links: dict.Dict(String, set.Set(String)),
7272
start: String,
7373
end: String,
74-
total: Int,
74+
// total: Int,
7575
cache: memoize.Cache(String, Int),
7676
) -> Int {
7777
use <- memoize.cache_check(cache, start)
7878

7979
case start == end {
80-
True -> total + 1
80+
True -> 1
8181
False -> {
8282
let next_steps = case dict.get(links, start) {
8383
Ok(s) -> s |> set.to_list
8484
Error(_) -> []
8585
}
8686

87-
list.fold(next_steps, total, fn(acc, next) {
88-
acc + count_paths(links, next, end, 0, cache)
87+
list.fold(next_steps, 0, fn(acc, next) {
88+
acc + count_paths(links, next, end, cache)
8989
})
9090
}
9191
}

0 commit comments

Comments
 (0)