Solving Advent of Code Day 7: Splitting Tachyon Beams

Published: (December 17, 2025 at 12:00 AM EST)
5 min read
Source: Dev.to

Source: Dev.to

I originally posted this post on my blog.

This year, I’m following the Advent of Code. I challenged myself to write “functionalish” solutions. Here’s one of the puzzles I’ve liked the most.

On Day 7 of Advent of Code, we’re studying tachyon beams while we’re stuck in a teleporter.

We’re stuck in a teleporter because we’ve been trying to help the elves with all the Christmas preparation. But each step has complicated things even more, making it a mission impossible. I feel like I’m in an episode of The Mandalorian. But anyway, back to code…

I imagine this puzzle as a game where each iteration moves the beam until it hits the end of the manifold.


Moving a beam

A Beam is a list of positions in the manifold at a given iteration.

record Position(int X, int Y);
record Beam(IEnumerable<Location> Locations);

A manifold is an array‑of‑array of strings. Each cell could be an empty space or a splitter, e.g.:

var manifold = new string[][]
{
    new[] { ".", ".", "S", ".", "." },
    new[] { ".", ".", ".", ".", "." },
    new[] { ".", ".", "^", ".", "." },
    new[] { ".", ".", ".", ".", "." }
};

The method that moves a beam

static Beam Move(string[][] manifold, Beam beam)
{
    var newLocations = new HashSet<Position>();

    foreach (var current in beam.Locations)
    {
        var downward = manifold[current.X + 1][current.Y];
        if (downward == ".")
        {
            newLocations.Add(new Position(current.X + 1, current.Y));
        }
        else if (downward == "^")
        {
            // split the beam left and right
            newLocations.Add(new Position(current.X + 1, current.Y - 1));
            newLocations.Add(new Position(current.X + 1, current.Y + 1));
        }
    }

    return new Beam(newLocations);
}

Finding the entry position

static Beam Start(string[][] manifold)
{
    for (int i = 0; i ());
}

With those two methods a beam can be created and moved downward:

var start       = Start(manifold);
var newPosition = Move(manifold, start);
newPosition     = Move(manifold, newPosition);

All that’s left is to count splits and move the beam to the end.


Counting splits

We let the beam move on its own until it reaches the bottom of the manifold:

var beam = Start(manifold);
while (!HasReachedTheEnd(manifold, beam))
{
    beam = Move(manifold, beam);
}

The next step is to count when a beam splits. I do that inside Move().

Full solution (sample input is hard‑coded)

var manifold = new string[][]
{
    new[] { ".", ".", ".", ".", ".", ".", ".", "S", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", "^", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", "^", ".", "^", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", "^", ".", "^", ".", "^", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", "^", ".", "^", ".", ".", ".", "^", ".", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", ".", "^", ".", "^", ".", ".", ".", "^", ".", "^", ".", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", ".", "^", ".", ".", ".", "^", ".", ".", ".", ".", ".", "^", ".", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." },
    new[] { ".", "^", ".", "^", ".", "^", ".", "^", ".", "^", ".", ".", ".", "^", "." },
    new[] { ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", "." }
};

var beam = Start(manifold);
while (!HasReachedTheEnd(manifold, beam))
{
    beam = Move(manifold, beam);
}

Console.WriteLine(beam.SplitCount);
Console.ReadLine();

static Beam Start(string[][] manifold)
{
    for (int i = 0; i ());
}

static bool HasReachedTheEnd(string[][] manifold, Beam beam)
{
    var anyBeam = beam.Locations.First();
    return anyBeam.X >= manifold.Length - 1;
}

static Beam Move(string[][] manifold, Beam beam)
{
    var splits       = 0;
    var newLocations = new HashSet<Position>();

    foreach (var current in beam.Locations)
    {
        var downward = manifold[current.X + 1][current.Y];
        if (downward == ".")
        {
            newLocations.Add(new Position(current.X + 1, current.Y));
        }
        else if (downward == "^")
        {
            splits++;
            newLocations.Add(new Position(current.X + 1, current.Y - 1));
            newLocations.Add(new Position(current.X + 1, current.Y + 1));
        }
    }

    return new Beam(beam.SplitCount + splits, newLocations);
}

record Position(int X, int Y);
record Beam(int SplitCount, IEnumerable<Position> Locations);

I thought “tachyon” was a made‑up word until I Googled it. TIL what a tachyon actually is.

A tachyon is. Win‑win.

Et voilà!

Advent of Code sharpens your coding skills. But coding is more than typing symbols fast. It's also about teamwork, collaboration, and many skills I share in my book, *Street‑Smart Coding: 30 Ways to Get Better at Coding.* That's the roadmap I wish I'd known from day one.

**[Get your copy of Street‑Smart Coding here](https://imcsarag.gumroad.com/l/streetsmartcoding/?utm_source=devto&utm_medium=post&utm_campaign=advent-2025-7)**
Back to Blog

Related posts

Read more »

Advent of Code 2025 - Day 6

Check out my full solution for day 6 on GitHub. Part one The first part gives us a few rows of numbers and a last line with operations that are either addition...

I tried Gleam for Advent of Code

Article URL: https://blog.tymscar.com/posts/gleamaoc2025/ Comments URL: https://news.ycombinator.com/item?id=46255991 Points: 39 Comments: 12...

Advent of Code 2025 - Day 5: Cafeteria

!Me solving AoC Day 5https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazo...

Advent of Code 2025 - December 8th

In this series, I'll share my progress with the 2025 version of Advent of Code. Check the first post for a short intro to this series. You can also follow my pr...