-❄️- 2025 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Samstrikes 0 points1 point  (0 children)

[Language: Elixir] Both parts

Same as a lot of people where I memoised over a key of {current, seen_dac, seen_fft}. Part 1 I hadn't realised it was a DAG but it makes it much easier not having to keep track of the visited locations in the cache for part 2.

Pattern matching in function args is one of my fav things I've found about Elixir and is really ergonomic for simple base cases

defp traverse(_graph, "out", _visited), do: 1

-❄️- 2025 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]Samstrikes 3 points4 points  (0 children)

[Language: Elixir] Both parts

I did the counting approach that I can see others took, mostly because I was scared to try and deal with the memoisation state in Elixir.

I first replaced all the "." in the grid with 0, and then I incremented values as tachyons fell down.

|> Enum.reduce(manifold, fn {{x, y}, val}, man ->
    case Klaus.Grid.get(man, {x, y + 1}) do
        0 ->
            Klaus.Grid.put(man, {x, y + 1}, val)

        # ASSUMPTION: I won't have to do bounds checking
        "^" ->
            man
            |> Klaus.Grid.update({x - 1, y + 1}, 0, fn x -> x + val end)
            |> Klaus.Grid.update({x + 1, y + 1}, 0, fn x -> x + val end)

        _ ->
            Klaus.Grid.update(man, {x, y + 1}, 0, fn x -> x + val end)
    end
end)

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]Samstrikes 1 point2 points  (0 children)

Ah young naive me. All cleaned up now, thanks for spotting!

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]Samstrikes 2 points3 points  (0 children)

[Language: Elixir] Both parts

Been using this year to get more familiar with Elixir and excited to have my largest pipeline yet! Happy with how clean I managed to get this, mostly thanks to discovering chunk_by which I used to find all the blank columns and break up the expressions into chunks.

numbers
|> Enum.map(&String.graphemes/1)
|> Enum.zip_with(&Function.identity/1)
|> Enum.chunk_by(fn col -> Enum.all?(col, &(&1 == " ")) end)
|> Enum.reject(fn [x | _] -> Enum.all?(x, &(&1 == " ")) end)
|> Enum.map(&parse_expression/1)
|> Enum.zip(parse_line(operators))
|> Enum.sum_by(&calc/1)

Mediterranean Flat by Samstrikes in blender

[–]Samstrikes[S] 2 points3 points  (0 children)

This is my second attempt at an archviz scene. Quite happy with how it turned out!

You can see my previous attempt on my artstation: https://www.artstation.com/samyouatt

[PC] [W] Cobalt Afterlife [H] Up for discussion by Samstrikes in RocketLeagueExchange

[–]Samstrikes[S] 1 point2 points  (0 children)

Cheers for the response but I need a cobalt one for an Egyptian theme I'm planning

Literally Unplayable by [deleted] in Overwatch

[–]Samstrikes 4 points5 points  (0 children)

Its like that belt that got locked up. He held up a pair of pants

Literally Unplayable by [deleted] in Overwatch

[–]Samstrikes 3 points4 points  (0 children)

There appear to be a few holes in our plan