-
One could instead count |F7 (that's what I do in my refactored solution), but counting all the bends would miscount the vertical segments (FJ would end up canceling itself out).
-
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.
-
-
[LANGUAGES: Python] I have made an ASCII solution for this quiz... https://github.com/yangcht/Advent-of-Code/blob/main/2023/d10/output.txt. Something like this: ┌╔╗╔█╔╗╔╗╔╗╔╗╔╗╔═══╗ └║╚╝║║║║║║║║║║║║╔══╝ ┌╚═╗╚╝╚╝║║║║║║╚╝╚═╗┐ ╔══╝╔══╗║║╚╝╚╝┐╔╗╔╝- ╚═══╝╔═╝╚╝.||-╔╝╚╝┘┐ |┌|╔═╝╔═══╗┌┐-╚╗└|┐| |┌╔╝╔╗╚╗╔═╝╔╗|┘╚═══╗ ┐-╚═╝╚╗║║╔╗║╚╗╔═╗╔╗║ └.└┐└╔╝║║║║║╔╝╚╗║║╚╝ └┐┘└┘╚═╝╚╝╚╝╚══╝╚╝.└ The full solution here: https://github.com/yangcht/Advent-of-Code/blob/main/2023/d10/d10.py
-
-
[LANGUAGE: Python] 219 / 38 https://github.com/duckyluuk/AoC-2023/blob/main/10/10.py I never thought I'd make it, but today I finally got onto the global leaderboard! My solution is very hardcoded, I'll definitely have to write a proper version without shortcuts later in the day, but still am very happy with it!
-
For part 2 I handled the twist by doubling the coordinates and filling in the rest of the spaces actually along the line. From there I did a flood fill in all 4 diagonals from the start square. If I could reach the origin that flood fill was thrown out as being outside. Otherwise it was inside. Counting the even-coordinate points in the floodfill gives the answer. github
-
[LANGUAGE: Rust] 317 / 245 Code
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
Code: https://github.com/peterolson/advent-of-code-2023/blob/master/10.py
-
-
Code: AdventOfCode/2023/day10.cpp at master · dag625/AdventOfCode (github.com)
-
GitHub
-
https://github.com/Kateba72/advent_of_code/blob/main/aoc/y2023/d10.rb
-
Code: main (445b314)
-
-
[Language: Python] Part 1 was little doubleCoded for start Tile Part 2 I used method that Sourish17 explained that check how many times "|", "J", "L", "S" is from left side of tile, if it is an odd number then tile is inside My code: Part 1 & 2
-
1076/1738 — Raw solution (to refactor/possibly rewrite)
-
Code: github link.
-
Link: https://github.com/jstanley0/advent-2023/blob/main/10.rb
-
Here's my solution that I ran in a python notebook and the resulting visualization I made for my part 2. https://github.com/tliddle1/advent-of-code/blob/main/2023/day10.py https://github.com/tliddle1/advent-of-code/blob/main/2023/Day10.jpg
-
Day 10
-
[LANGUAGE: Python] 1000 / 1958 Code
-
For both part 1 and part 2, I parsed the file into a set of flags - does the current space connect north, south, east, west? Is it, in fact, an actual space in the map? And is it marked as the starting space? I then converted the starting space into a regular space, but remembered its coordinates.
-
[LANGUAGE: Kotlin] 757 / 504 Code
-
Code here
-
-
-
Code
-
Code
-
[LANGUAGE: C] Part 1 I implemented the breath-first search algorithm not realizing that I could have measured the length of the loop and divided in half. Part 2 was a bit of a struggle for me. At some point I figured that the best way of solving it was to print the path with box building unicode characters, put a screenshot of it into gimp, fill the inside of the path with the fill tool, and then count the number of periods in the filled region. For some reason, this didn't work and I'm not going to debug that janky solution. I eventually found the path tracing algorithm for determining if a point was in a polygon and realized that that was very easy to implement here. While my code is messy, the output for part 2 looks really cool as it prints the loop, I'll probably upload it as a visualization.
-
-
-
-
Source: Github
-
Source (not very elegant but does the job)
-
Whew, this one was for sure the trickiest so far. Couldn't quite figure out what to google to find the right mathy stuff, so in the end I went with a hackier solution. It's for sure not pretty and a lot of copied code between the parts, but it works. Essentially I replace all non-loop tiles with a ., then I walk through the loop again always looking to the left and to the right. One of those will be inside, one will be outside. I figure out which is which, then I do a flood fill (bfs) on all the inside nodes to find everything.
-
https://github.com/TSoli/advent-of-code/blob/main/2023/day10a/solution.cpp
-
Second was a bit trickier - but then came up with a fast neat solution for it: Source on GitHub
-
Day 10
-
Day 10 on GitHub
-
github (very messy, too tired to cleanup at this point)
-
part1 + part2 code
-
-
-
-
-
part 1: https://github.com/cgsdev0/aoc-2023/blob/main/day10/p1.sh
-
-
I'd never heard of the Shoelace Theorem, so I did it the hard way instead.
-
Link to Github
-
-
-
-
Was fairly easy to come up with a quick and dirty solution with some standard GIS tooling.
-
Part one went fairly fast, but spent quite some time on getting part two right. I settled on the approach of just iterating over the grid and using a boolean to see if I had to count elements or not. However, I had some issues figuring out when to swap, this post by /u/rogual helped me figure it out. After that I lost quite some time on an error that only occurred with my input, not with the example input. It turned out that my loop (which I take form my p1 solution) didn't include the start node, which caused all sorts of counting issues.
-
solutions
-
I thought I was prepared to tackle something of this kind with my exhaustive Vector implementation.
-
language c++
-
Solution: https://github.com/ShraddhaAg/aoc/blob/main/day10/main.go
-
common: implement neighbours using directions and character behaviour part 1: simple iterative bfs : https://github.com/happyhacks/aoc2023-rs/blob/master/day10a/src/main.rs
-
Day10
-
[LANGUAGE: MiniScript]
-
-
[LANGUAGE: Scala] GitHub
-
Both parts on GitHub here.
-
Messy code here
-
Code
-
Way trickier than I was expecting
-
GitHub
-
-
-
-
-
Source code in GitHub. Really, really messy code. I had no real idea how to tackle the second part and have been experimenting "painting" the grid to make progress.
-
It was driving me nuts that I couldn't get BFS right. Then I re-copy-pasted the input and it worked. Moral of story: Sometimes it is the input not me. Part 2 owes special thanks to u/Boojum and u/theadamabrams for their super helpful visualizations. Code
-
Here is a permalink to my GitHub : (solve_2_try_2 is the good function) https://github.com/asibahi/aoc23/blob/ce8aa99faddabf09f78de34cc8fd3bd520fb0072/src/bin/day10.rs . I am not entirely sure how else to do this.
-
-
-
Github
-
Github day 10 part 1 working, part 2 not working
-
-
-
-
[LANGUAGE: Common Lisp] https://github.com/valple/adventofcode/blob/master/2023/aoc2023.lisp (at the end of the file)
-
Part 2: Using the Part 1 as a start point for moving around the path, this time I created a grid twice the size and then tracked each space I moved around filling in the gap between the neighbouring cells, this then left a 1 "pixel" gap for later. Ran a flood fill function at 0,0. My first attempt at a recursive function caused JS to RangeError: Maximum call stack size exceeded so I Googled some JS flood fill functions and adapted one. Finally I ran through all the even pixels, counting any that remained empty.
-
-
-
-
GitHub
-
advent-of-code-2023
Solutions for Advent of Code 2023, written in JavaScript using node.js (by johnbeech)
-
ARRRRGGGGGHHHH part 2 was awful
-
Github
-
[LANGUAGE: Rust] GitHub
-
-
-
Code
-
Final solution is okay though (github)
-
-
github
-
-
I struggled immensely today, graph and geometry are truly my kryptonite. I had to search for a bunch of explanation on part2 but I ended up with something satisfying in the end I believe (about 15ms for part1+part2). Code here.
-
-
Code
-
https://github.com/auxym/AdventOfCode/blob/master/2023/day10.nim
-
-
-
-
-
-
Link to solution on GitHub
-
-
-
Am I going mad, or has anyone else noticed that an answer they submitted yesterday that was rejected is now being accepted? Is this the first time that the "My answer wasn't accepted - must be a bug in AoC" meme might actually apply?? I was pulling my hair out yesterday trying to find out why my answer for part 2 wasn't being accepted, and I've tried inputting the same answer today and now it's being accepted - I've also checked against another solution that was upvoted a lot on this thread that gave a different (i.e. presumably incorrect) answer, so I'm wondering if there was actually a bug in whatever AoC uses behind the scenes to generate the correct answer, at least when applied to my data? Anyway, here's my solution - I start at the top left loop node (which must be an F by definition) and then walk the loop clockwise (at least, clockwise initially) from there, doing DFS on each node that is to the right as I walk the loop (i.e. right from the walker's perspective, not right in the grid) and adding nodes that the DFS finds until it reaches a loop node. I've not seen anyone else implement this so thought it was worth sharing
-
-
part 1 & 2
-
The nastiest part 2 that ever there was...
-
-
Code on GitHub is currently a mess.
-
Day 10
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives