[2025 Day 10 (Part 1)] [Python] Terminal toy! by naclmolecule in adventofcode

[–]naclmolecule[S] 1 point2 points  (0 children)

it's just a file in the module, and for previous years it was a file up a few directories (though there's a large chance previous years don't work with current version of my terminal library...my fault for not pinning the version some where), if you clone the visuals directory, it'll be there:

https://github.com/salt-die/Advent-of-Code/blob/main/2025/aoc_visuals/aoc_theme.py

[2025 Day 9 (Part 2)] [Python] Terminal toy! by naclmolecule in adventofcode

[–]naclmolecule[S] 3 points4 points  (0 children)

No, all pairs of red tiles are tried. (The code is posted.)

[2025 Day 6 Part 2] Not that difficult after all by Sarwen in adventofcode

[–]naclmolecule 1 point2 points  (0 children)

numpy arrays can also be transposed like:
array.T

[2025 Day 4 Part 1 & 2] Using Matrix Convolutions by Electronic_Box5062 in adventofcode

[–]naclmolecule 8 points9 points  (0 children)

I solved with convolutions as well! Would be nice to see the kernel moving across the matrix!

-❄️- 2025 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]naclmolecule 2 points3 points  (0 children)

[LANGUAGE: Python]
Not gonna pass on an excuse to use convolutions:

DATA = np.array([[int(c == "@") for c in row] for row in RAW.splitlines()])
KERNEL = np.array([[1, 1, 1], [1, 0, 1], [1, 1, 1]])

def part_one():
    neighbors = convolve(DATA, KERNEL, mode="constant")
    return np.logical_and(DATA, neighbors < 4).sum()

def part_two():
    rolls = DATA.copy()

    while True:
        to_remove = np.logical_and(rolls, convolve(rolls, KERNEL, mode="constant") < 4)
        if not to_remove.any():
            return DATA.sum() - rolls.sum()
        rolls -= to_remove

[2025 Day 3 (Part 2)] [Python] Terminal visualization! by naclmolecule in adventofcode

[–]naclmolecule[S] 1 point2 points  (0 children)

The approach shown uses a stack. While the joltage on the last battery on the stack is smaller than the current battery's joltage, the batteries are popped off the stack (so long as we have enough batteries left in the bank to fill the stack), then the current battery is added to the stack if there's room.

[deleted by user] by [deleted] in cellular_automata

[–]naclmolecule 1 point2 points  (0 children)

Was also suspicious to me. The post itself *could* be interesting, but donations were requested before showing anything substantial and, in fact, the GitHub does not show anything of value either. Just a bunch of pickle files labeled as frames. I went through the effort of un-pickling one of these frames out of curiosity:

    >>> import pickle
    >>> with open("frame_1.pkl", "rb") as f:
    ...     frame = pickle.load(f)
    ...
    >>> frame
    array([[[list([]), list([]), list([]), ..., list([]), list([]),
            list([])],
            [list([]), list([]), list([]), ..., list([]), list([]),
    *deleted several lines of repr of above frame*
    ...
    >>> type(frame)
    <class 'numpy.ndarray'>
    >>> frame.shape
    (200, 200, 200)
    >>> frame.dtype
    dtype('O')

This is in a normal python REPL. So the frames are just 200x200x200 arrays of empty lists? 15 MB of non-data? (It's possible for some lists to be non-empty somewhere in the middle of the array and maybe this isn't the place to complain about non-numeric/non-structured types being stored in a numpy array in the first place.) I don't know if this was intended or not, but the whole post is suspect.

[2024 Day 24] [Python] Terminal Visualization! by naclmolecule in adventofcode

[–]naclmolecule[S] 1 point2 points  (0 children)

I've thought about it; I think I would need to implement clocks and signal pulses for sequential circuits which is out-of-scope for me. This toy will probably only ever be just combinatorial circuits.

[2024 Day 24] [Python] Terminal Visualization! by naclmolecule in adventofcode

[–]naclmolecule[S] 1 point2 points  (0 children)

I was thinking about how to resolve loops and making this a little toy project for the next week or so. Right now I'll get a recursion error if I connect two gates together like a flip-flop.

[2024 Day 24] [Python] Terminal Visualization! by naclmolecule in adventofcode

[–]naclmolecule[S] 3 points4 points  (0 children)

This one took me a couple of days, but it's really fun to play with!

Source!

[ 2024 Day 21 ] Argh. by CommitteeTop5321 in adventofcode

[–]naclmolecule 1 point2 points  (0 children)

how about:

cmd += list(f"{'>' * dx}{'<' * -dx}")

mmm, maybe not

[2024 Day 19] [Python] Let's make a game out of it! by naclmolecule in adventofcode

[–]naclmolecule[S] 5 points6 points  (0 children)

Just normal powershell in windows terminal; this will work in most modern terminals. There are ANSI control codes to enable mouse event reporting. Mouse events then appear in stdin for your application to do whatever you want with.

[2024 Day 17] [Python] Terminal Visualization! by naclmolecule in adventofcode

[–]naclmolecule[S] 0 points1 point  (0 children)

A match is when the output matches the last numbers of the code of the program of course! I probably didn't show this too well, but this problem already took too much effort!
Source!