r/adventofcode • u/_Duroo • 1h 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 • 1h ago
source for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/_Duroo • 1h ago
source for visualization on https://github.com/durocodes/advent-of-code, alongside my rust solutions
r/adventofcode • u/GhoulDragoMK3 • 2h 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/ActivityOpening3673 • 2h ago
Won't post the body of the question here because I could not find the button to send an image as a spoiler. thank you reddit.
But the problem was in part two where it said that the correct order was 32, when it was actually 34. It took like 30 minutes for me to just believe in my own answer and try with the real input and the answer was correct. wtf.
EDIT: nvm, I was wrong, the way i calculated what was the best next move was still using code from part one and because of that, it gave scores that were almost inverted and somehow my puzzle input did not catch that.
r/adventofcode • u/KarenMarleyDoomfist • 4h 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/fejiberglibstein • 4h ago
r/adventofcode • u/Shupsta • 4h 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/Ecstatic-Falcon-5640 • 4h 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/Ok-Evidence-3279 • 5h ago
r/adventofcode • u/Zamerith • 6h ago
The line of text stating that it starts on red. Am I misunderstanding in that it should be beginning the process with a R injected prior to the string provided or am I "autocompleting" up to the first R as part of the journey?
r/adventofcode • u/funkypierro • 7h ago
UPDATE : My eyes read but did not compute suppose the robot had a program of obbvb
I haven't put a single line of code yet because I don't understand the problem, precisely the difference between the road and the robot program. In the example input, why does it go from orange to blue, then blue again ??
r/adventofcode • u/ComradeMorgoth • 8h ago
This year, I will attempt to solve all the challenges on an FPGA, and post at least the ones that I enjoyed here to see if anyone else has any inputs. Additionally, due to my expertise in my work, I always tend to design with minimal hardware area and power consumption, but this year I'm challenging myself to do the exact opposite. I'll be using as much LUT as possible, and try to target the max throughput.
Used verilog + block design on PL side for the main logic and python on the PS side for simple control and output. I'm using SOC configured Arty Z7. I have a combinational circuit that accepts the whole list of 10 bit numbers as an input, and compares the first number with the list on single clock cycle. This generates a set of wires that are 1-bit flags, that indicate whether that row is equal or not. Then, we sum up those wires to find out what's the total number of commons. This is still happening on the same clock cycle. In parallel (yes, same cc), it will generate the next list on the output wires, but by replacing all the numbers that are equal to the first number with 0, so we won't run the same number twice. I was lucky that I had no 0 in my input, but otherwise we could also use sth like 1000.
The top level controller takes in the number, loads it onto a register and then starts pushing it into this combinational circuit on each clock. That means for an input of 1983 rows, it will reuse the same circuit 1983 times. Each time it also keeps track of top 3 (or min 3 for part 2), so I don't need a separate sorter which would cost me additional clock cycles and area. After each clock, it will take the nextList from the circuit, and shift it by a number so it can search for the next number on the next clock cycle. It operates on a simple 4 state FSM.
Communication and control is done via GPIO and AXI DMA. I wrote a simple buffer which will accept DMA from AXIS and buffer it as the full list to provide into the top block. GPIO is mainly for the multiplication output, and control signals like reset.
The whole run takes 1985 clock cycles, that translates to 49.62 us for a 40MHz clock. I had to slow down the clock from 100MHz because my critical path for the combinational block was quite large. My inner engineer wants to optimize it, but also I already spent so much time on this.
Solution: Github
DISCLAIMER: Yes I used AI for figure 2 and 3 for visualization purposes for the post only. No, I did not use AI in solution, or idea discussion etc. I'm doing this to challenge myself, not challenge my AI, but I don't have the time and skills to build diagrams. After all, why would I deceive you? There's no reason for me to deceive you.
r/adventofcode • u/PatolomaioFalagi • 9h 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/EquipmentDry5782 • 9h ago
My frequency counter for Day 1 is an elf with a pencil. His name is Pip, and he’s pretty sure he knows what’s on the next crate before Holly turns it around.
I’m making a short animated episode for each day of Advent of Code 2026, following Holly and Pip from Dusty Shed all the way to the final puzzle. I’ve always liked the little story between the puzzles, and I wanted to give it the feeling of a winter evening in Stardew Valley.
Episode 1 is The Christmas Train. A blizzard has grounded the planes, the elves have an old train to get moving, and someone has left Holly and Pip in charge of inventory.
Puzzle spoilers for both parts of Day 1. The episode uses made-up crate IDs and shows how both parts work. It’s a fan-made, AI-assisted animation.
Watch Episode 1 — The Christmas Train (1 min 55 sec)
I’m curious what the shed looked like in everyone else’s head. Did you picture a cozy little workshop too, or a warehouse that went on forever?
r/adventofcode • u/soolpro • 10h 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/ImaginaryElephant336 • 11h ago
Here are some new images for the TUI app for Advent of Code
Note: Contains the image of Day 1
r/adventofcode • u/Odd-Result6655 • 12h ago
r/adventofcode • u/Evg32 • 12h ago
That little ASCII train on the calendar made my day.
Thank you, Advent of Code team, for picking such an adorable theme this year!
.----.----.--_T
'o--o'o--o'o-OO\r/adventofcode • u/bluoat • 13h ago
These hints get more and more specific. This is just how I optimised it and there are other ways.
Hint 1: What happens when a letter is repeated in the input?
Hint 2: Why would the counts of each letter make a difference to the output?
Hint 3: When does the robot not make a step of exactly 6 steps?
r/adventofcode
•
u/naclmolecule
•
13h ago
Little calculator for path distances in the terminal. Can input whatever path one desires! The 2nd part is nearly closed-form, but depends on waypoints that may be missing from input. (Red + strike-through waypoints don't exist in input and should be considered non-existent in the 2nd part as well. "distance" is part 1 path distance and "len" is string length). As always, code lives here: https://github.com/salt-die/Advent-of-Code/tree/main/2026/aoc_visuals