

-
Rust solution. Part 2 is just loop over all places with a and execution of part1 algo. At least it's not that slow thanks to sharing of data between runs. Recordings twitch, youtube.
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
-
You can even take that one step further and calculate all paths to as in one go. My Python implementation of that runs in < 10 ms, C++ is at 20 Β΅s.
-
Full source code Straightforward BFS with a simple own implementation of a queue. Only clever bit was to simply use End as the start position for part 2 and change the finish condition:
-
I wrote an immutable A* in Scala a few years ago. It's not too bad if you have immutable hash maps and an immutable priority queue. Comes in handy for a lot of puzzles.
-
GitHub
-
Python, 23/29. Video coming soon, original code, marginally cleaner code that has the nicer version of part 2.
-
Nutrient
Nutrient - The #1 PDF SDK Library. Bad PDFs = bad UX. Slow load times, broken annotations, clunky UX frustrates users. Nutrientβs PDF SDKs gives seamless document experiences, fast rendering, annotations, real-time collaboration, 100+ features. Used by 10K+ devs, serving ~half a billion users worldwide. Explore the SDK for free.
-
AdventOfCode
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA
Python3, 75/41. Wrote my BFS from scratch! Video coming soon. Code.
-
github link
-
Python 3 119/160
-
195/242
-
-
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 and 2024 in Scala (by sim642)
My Scala solution.
-
-
Python [1881/1740]
-
-
Simple Python BFS: https://github.com/parthematics/aoc-2022/blob/master/day12/day12.py
-
advent_of_code
This repository contains solutions to each of the problems in Advent of Code 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 and 2024 in C++ (and 2020 in Python as well)
Part 2 (Each file is a self-contained solution)
-
Kotlin Day 12 Dijkstra Day!
-
C#/Csharp: Code here
-
-
Compiled Python (with codon): Github
-
GitHub commit Part 2 solution visualization
-
oops, yea sorry i forgot that i use a header file here. This one https://github.com/sleepntsheep/advent-of-code-2022/blob/main/a.h
-
Python (Link to Part 1 & 2)
-
Python
-
-
Part 1: a simple BFS
-
Julia
-
Well, nuts. In Part 1, I decided I'd put in the extra effort to implement A*, since it's more efficient than Dijkstra's algorithm. I thought this would set me up nicely for Part 2. It did not.
-
Elixir 3853/3602, code, reflections
-
rust. hashset party. I spent some time tinkering with it and like it a lot actually.
-
-
Perl - my implementation for part 2.
-
-
Comes with a free simple visualization of path lengths because I made it for debugging purposes and I thought it was actually pretty interesting. The end point has a value of 000, and you can follow the path there from anywhere on the map by going to a space with the next lowest number, i.e. starting at 010 -> 009 -> 008 -> 007... etc. Spaces with --- cannot reach the end point.
-
If anyone's interested for a solution using Neo4j -> GitHub
-
-
Rust
-
-
This solution in Perl 5 provides an ASCII animation in your terminal as it finds the solution. You need a fairly wide terminal for it to work. (The input map is 64 cells wide and the output uses 3 characters per cell, so you'll need a terminal width of at least 64Γ3 = 192 characters.)
-
Julia
-
Getting started with Graph libraries is always a great way to get a feel for the approachability of a language ecosystem. Got thrown in a web dead-end by some links to old libraries, but once I found Graphs.jl it was pretty smooth sailing. The precious examples were sufficient if not bountiful, but I appreciate examples are hard for such generic libraries.
-
Github
-
Haskell, 40 ms. I represented the grid as a map (type Grid = M.Map Coord Height) and made the height an Enum instance (data Height = Start | Height Char | End). I think I used Dijkstra?
-
-
-
[Github]
-
Haskell
-
aoc2022
Trying to solve Advent of Code 2022 in 25 different languages (1 day = 1 language) (by GoldsteinE)
-
-
Part one
-
Day12/2022
-
Scala using jgrapht. I thought part 2 would require a different graph (similar to 2018 day 22) since the story said "to avoid needing to get out your climbing gear..." Glad that wasn't the case!
-
Anyways here's the very messy original code
-
Code on GitHub
-
26 lines of Python for both parts. Used BFS.
-
-
-
Although I wrote my own library for A*, dijkstra, bfs and dfs, I usually write bfs from scratch which I did part 1.
-
I wrote Dijkstra with Haskell for this one
-
-
π¦π¦π¦ RUST π¦π¦π¦
-
You could simplify benchmarking by using the criterion library. Example
-
Scala 3
-
-
Hardest part was implementing the actual algorithm, but it was quite fun. Fun part was trying to it cleanly using a slist implementation made especially for the occasion, see that the nice program with nice data structures couldn't even load the dataset before running out of memory, and replacing all that with int ** and char ** tables !
-
-
So, a new version with a lot less almost-duplicate code @GitHub.
-
It was possible thanks to great https://llvm-mos.org/wiki/Welcome project (it adds 6502 target to LLVM). Adding 6502 support to rust was easy part :] https://github.com/mrk-its/rust-mos
-
-
I implemented it with A*. For part two, I just ran A* concurrently on every coord with starting point A, which is actually very easy in Rust! (I mostly did this to learn about concurrency in Rust. It's about 4 times faster than just running A* one by one.)
-
advent-of-code-2022
Joel Eisner's completed TypeScript code challenges for "Advent of Code" 2022 (by joeleisner)
https://github.com/joeleisner/advent-of-code-2022/blob/main/days/12-hill-climbing-algorithm/mod.ts (Functions)
-
Kotlin
-
Haskell. Recursive BFS in the State monad! Visited positions are marked with a '|' character, since this is 'z' + 2. My part 1 code didn't need too much modification for part 2, I only needed to account for the fact that adjacent 'a's can visit each other on the first step.
-
Dlang solution using BFS. Relevant part :
-
-
I'm doing 25 languages in 25 days.
-
Haskell. BFS using Data.Array for the map.
-
Reused my old code for pathfinding using the Dijkstra's algorithm. The code could probably be optimized specifically for the puzzle (for instance, there's no need for priority queue, and for building a more general graph structure with adjacency lists) but it's fast enough, and I wanted to use this opportunity to build a pathfinding library, as I assume pathfinding will appear again in later days.
-
-
-
-
Source + Header
-
Java8
-
Python 3: Github
-
-
F# - This turned out better than my TypeScript solution.
-
-
-
-
My code
-
-
Used an A* search today. It needs some optimising but it works https://github.com/dionysus-oss/advent-of-code-2022/tree/main/day-12
-
-
Sure! I didn't actually use any path-finding algorithm -- I used networkx to do the pathfinding. Essentially, I created a directed graph in networkx which allowed me to model each location as a node and then place a directed edge between them if I was allowed to move from one to the next following the rules (wasn't jumping up more than one step at a time). Once I had built the map, I used the shortest_path_length command in networkx to find the shortest path and compute its length. Let me know if this makes sense or if you want more explanation!
-
Python https://github.com/matheusstutzel/adventOfCode/blob/main/2022/12/p2.py
-
-
Here's the repo for all the spaghetti goodness. Big chonkers like this one are helping to push the language balance to 35% C across all my AoC solutions.
-
Heres the Code: day12.py
-
Github Solution
-
Day 12
-
-
https://github.com/HendrikPetertje/advent_of_code_2022/blob/main/test/12/day_12_test.exs CI = green too :)
-
-
Swift. I tried to use GameplayKit's pathfinding, but I got fed up with it being in Objective-C and not working with subtypes properly. shortestPathSources is just an implementation of Dijkstra that works on matrices.
-
Swift. I tried to use GameplayKit's pathfinding, but I got fed up with it being in Objective-C and not working with subtypes properly. shortestPathSources is just an implementation of Dijkstra that works on matrices.
-
-
Rust
-
Here's just the interesting bit, full solution here. ``` fn dijkstra(unvisited: &mut Unvisited, start: Pos, end: Pos) -> Option { fn update_neighbor(unvisited: &mut Unvisited, cur: &Node, pos: Pos) { if let Some(neigh) = unvisited.get_mut(&(pos)) { // Steepness check. if neigh.val <= cur.val + 1 { neigh.dist = neigh.dist.min(cur.dist + 1.); } } }
-
-
I cloned your repo and and double checked - my input against your solution to part 1 deffo produces the same result as I mentioned above, which is apparently too low. It also produces an answer for part 2, which is 514, so maybe you were referring to this?
-
Other Notes: - My solution involved using Dijkstra's algorithm to find the shortest path. This is essentially is just BFS with the use of a Min Heap. - My CPP solution: https://github.com/rdforte/competitive-programming/blob/main/AdventOfCode/2022/Day12/q1.cpp
-
~200 microseconds runtime Go solutions based on BFS that plot the path in the terminal: https://github.com/tsenart/advent/tree/master/2022/12
-
Super late to the party, here is my solution: https://github.com/xhuberdeau/advent-of-code-2022/blob/main/src/day-12/solve.ts . Idk what algorithm I used really, did it on instinct haha.
-
advent-of-code-go
All 10 years of adventofcode.com solutions in Go/Golang (and a little Python); 2015-2024
-
Just breadth first search: https://github.com/valogonor/advent-of-code/blob/main/2022/day12.py
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives