You ride the train to its first stop: a large farm surrounded by fields. The Elves explain that you're not actually here for anything the farm grows; apparently, this farm also collects thunder from passing storms. This explains the surprisingly rumbly crates being loaded onto the train.
In an attempt to distance yourself from the noise, you take a walk and explore some of the farm. After a few minutes, you come across some Elves tinkering with an interesting-looking robot.
Visit the website for the full story and full puzzle description.
namespace AdventOfCode.Y2026.Day02;
using System.Collections.Generic;
using System.Linq;
[ProblemName("Fulminating Farmland")]
class Solution : Solver {
const string field = "roygbv";
const string optimalOrder = "rvbgyo";
public object PartOne(string input) =>
Distance(input);
public object PartTwo(string input) =>
Distance(input.OrderBy(optimalOrder.IndexOf));
int Distance(IEnumerable<char> program) {
var pos = 0;
foreach (var nextTarget in program) {
// Walk up to the next target.
// Probably could be made faster with ugly modulo arithmetic.
pos++;
while (field[pos % field.Length] != nextTarget) {
pos++;
}
}
return pos;
}
}Please ☆ my repo if you like it!