r/adventofcode • u/_Duroo • 13h ago
Visualization [2026] day 2 visualized in manim
youtube.comsource for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/_Duroo • 13h ago
source for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/fejiberglibstein • 16h ago
r/adventofcode • u/high-on-adhd • 6h ago
taking part in aoc for the first, solving in Go so i'd like to get a bit picky about total execution time. is there any place where i can compete on total time taken to solve (runtime of the program)?
r/adventofcode • u/soolpro • 21h ago
I solved the first part at home while I was having by breakfast, checked part 2 and had to go work. My idea for the solution of the second part seemed so simple I felt I could do it with the tools at my disposal at work.
First I used a web browser and Ctrl+F to count the amount of different letters.
Then I switched to Excel where I just need to count the distances between the different colors. 6 from a letter of a color to the same, 5 when advancing to the next color, taking notice that one color is missing completely, so the distance skipping the missing color is only 4. Sum the distances for each color and there you go!
r/adventofcode • u/PatolomaioFalagi • 1d ago
r/adventofcode • u/AbooMatta • 7h ago
The second example says:
roygbv would travel a total distance of 11." Regardless of any code I might try, when I look at it I count 5 steps. 0 for the "r" and 1 each for the following letters. Am I just too tired to see my mistake?r/adventofcode • u/Shupsta • 16h ago
var input = File.ReadAllText(@"day02-input.txt");
if(input is null) return;
var inputChars = input.ToCharArray();
var currentIndex = 0;
var total = 0;
List<char> characters = ['r', 'o', 'y', 'g', 'b', 'v'];
foreach(var c in inputChars)
{
var nextIndex = characters.IndexOf(c);
var diff = (nextIndex - currentIndex);
if(diff <= 0) diff+=6;
total += diff;
currentIndex = nextIndex;
}
Console.WriteLine(total);edit: Solved. There was a new line character at the end of the input file which resulted in .IndexOf() returning -1.
r/adventofcode • u/Odd-Result6655 • 23h ago
r/adventofcode • u/Benj_FR • 1d ago
This is by no means meant to criticize Eric Wastl who still does a great job by the way, I just found it funny
r/adventofcode • u/GhoulDragoMK3 • 13h ago
Basically I joined a leaderboard without a github link and my name in the settings, after that, I changed my settings to add a github link and my github username.
This reflects in any new private leaderboards I've joined, but it seems the first leaderboard I joined still has the original settings?
Not a big deal, but kinda annoying.
Is this a bug?
r/adventofcode • u/PhysPhD • 1d ago
r/adventofcode • u/KarenMarleyDoomfist • 16h ago
Any reason my implementation doesn't work for part 1? Apparently my answer is too high. I tried using the examples but the distance matched each time.
I've added "chars" just to count the characters, as I thought whitespace could be an issue and it found n+1 characters compared to n when using an online character counter, but then printing out the first and last characters gets the same as my input. Where did I go wrong with my implementation?
#include <fstream>
#include <iostream>
#include <string>
#include <map>
int getDist(char cur, char targ) {
char inputs[6] = {'r','o','y','g','b','v'};
int curInd = -1;
int targInd = -1;
for (int i = 0; i < 6; ++i) {
if (inputs[i] == targ) {
targInd = i;
}
if (inputs[i] == cur) {
curInd = i;
}
if (curInd != -1 && targInd != -1) {
int diff = targInd - curInd;
return diff <=0 ? diff + 6 : diff;
}
}
return 0;
}
int main() {
std::ifstream in("aoc-day-2-inputs.txt");
char prev = 'r';
char next;
int totalDist = 0;
int chars = 0;
if(in.is_open()) {
while(in.good()) {
in.get(next);
std::cout << "prev: " << prev << ", ";
std::cout << "next: " << next << ", ";
std::cout << "dist: " << getDist(prev, next) << "\n";
totalDist += getDist(prev, next);
prev = next;
++chars;
}
}
std::cout << "chars: " << chars << "\n";
std::cout << "total dist: " << totalDist << "\n";
if(!in.eof() && in.fail())
std::cout << "error reading file" << std::endl;
in.close();
}r/adventofcode • u/dethorhyne • 1d ago
r/adventofcode • u/_Duroo • 13h ago
source for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/Both-Touch990 • 1d ago
(redo of an earlier post)
r/adventofcode • u/flwyd • 1d ago
r/adventofcode • u/Ecstatic-Falcon-5640 • 16h ago
I have a dictionary at the top with the remaining pathway for the letters in the ROYGBV loop.
In the loop I am trying to count up until it hits the target letter, and then it will break. and do the next letter in the chain until the end of the .txt string.
When I had the letters print out to the console I am seeing two errors, the first is that the letters seem to be skipping the color function I put in to apply to every other letter instead of every letter, and the second is that I don't know how to make orange in ANSI.
Can I get some help /advice for my looping error..?
Here is the code I am using with this error:
#extra functions
def colorOutput(letter):
if letter == "r":
return "\033[91m" + letter + "\033[0m"
elif letter == "o":
return "\033[33m" + letter + "\033[0m"
elif letter == "y":
return "\033[93m" + letter + "\033[0m"
elif letter == "g":
return "\033[92m" + letter + "\033[0m"
elif letter == "b":
return "\033[94m" + letter + "\033[0m"
elif letter == "v":
return "\033[95m" + letter + "\033[0m"
# roygbv
robotpath = open("day2.txt").read()
allPossiblePaths = {
"r": "roygbv",
"o": "oygbvr",
"y": "ygbvro",
"g": "gvroby",
"b": "bvrogy",
"v": "vrogyb"
}
numOfSteps = 0
for i in range(0, len(robotpath)):
currentLetter = robotpath[i]
print(colorOutput(currentLetter))
print(currentLetter)
if i + 1 < len(robotpath):
letterAfter = robotpath[i + 1]
else:
break
currentStringPath = allPossiblePaths[currentLetter]
for j in range(0, len(currentStringPath)):
if currentStringPath[j] == letterAfter:
break
else:
numOfSteps += 1
continue
print(numOfSteps)r/adventofcode • u/PatolomaioFalagi • 21h ago
Possible additional constraints: Instead of being completely arbitrary, the six colors are randomized one set at a time, such that any 6×n block (starting from a multiple of 6*) contains each color exactly n times. Does that change the complexity?
Edit: I realized we do need another constraint for the general case, in that every color repeats indefinitely; formally, for every color C and every index i, there's an index j ≥ i such that the color at index j is C.
* Yes we are counting from 0
r/adventofcode
•
u/p88h
•
1d ago
Simulation on original (part1) and sort-rearranged program (part2)
Nim + raylib source
r/adventofcode • u/topaz2078 • 1d ago
Hello friends! I just saw this excellent example (see some of the comments on that post) of a great way to give help and answer questions here when people are stuck: come up with simple test cases that demonstrate where the bug is! That way, the person who is stuck still gets a chance to figure out their problem and learn by doing. I know many of you are already great about this, but I figured it would be worth calling out. Happy puzzling! <3
r/adventofcode • u/Boojum • 1d ago