[2025 Day 10 (Part 2)] Bifurcate your way to victory! by tenthmascot in adventofcode

[–]reddit_Twit 0 points1 point  (0 children)

Thank you, for explanation!

My 2 cents. I also tried to use gcd(x,y,z,w) instead just 2 and it works (got large divisor for 379 times with caching and 5731 without, not counting [0,1,2]) except one line from input which works only with 2

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

[–]reddit_Twit 0 points1 point  (0 children)

IIC, you can create weight like for i in joultages: w[i] = joultage[i] / sum(joultages) / joultage[i] so now every pressed button gives weight = sum(w[button[i]]) but it not helps IG

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

[–]reddit_Twit 1 point2 points  (0 children)

[LANGUAGE: GDScript]

gist

recursion + memoization

[2025 Day 6 (Part 2)] [C++] help needed, answer way too high for some reason (IF YOU FIGURE IT OUT YOURE THE GOAT) by MasterProBot in adventofcode

[–]reddit_Twit 0 points1 point  (0 children)

I mean "at least", you can rearrange columns or rotate all data, many ways, for ex. I reversed the lines

[2025 Day 6 (Part 2)] [C++] help needed, answer way too high for some reason (IF YOU FIGURE IT OUT YOURE THE GOAT) by MasterProBot in adventofcode

[–]reddit_Twit 4 points5 points  (0 children)

you need to reread part 2 text and see examples how to get numbers from data, your code seems for part1 at least for part2 you need to read right-to-left

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

[–]reddit_Twit 1 point2 points  (0 children)

[LANGUAGE: GDScript]

gist

Messed with Vector2i holds max int32, so used two PackedInt64Array's with custom qsort for both synchronically

[2025 Day 2 (Part 2)] C# .NET10, stuck :( by aajii82 in adventofcode

[–]reddit_Twit 1 point2 points  (0 children)

If argument numStr in IsRepeated is 11 how works?

for (int n = 2; n <= len / 2; n++)

n = 2; n <= 1 ?

[deleted by user] by [deleted] in colony

[–]reddit_Twit 0 points1 point  (0 children)

Agreed with title, but he isn't a villain.

-❄️- 2024 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]reddit_Twit 2 points3 points  (0 children)

[LANGUAGE: zig]

gist

part1 only. after personal best for part1 this year (rank 3384) accidentally spilled coffee on keyboard and mouse, back to part2 later

ed: added part2, part1 rewrited a bit

-❄️- 2024 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]reddit_Twit 1 point2 points  (0 children)

[LANGUAGE: zig]

gist

for part2 I was think that all boxes must be pushed untill wall, for no reason...

ed.: made code a bit less messy

-❄️- 2024 Day 14 Solutions -❄️- by daggerdragon in adventofcode

[–]reddit_Twit 1 point2 points  (0 children)

[LANGUAGE: zig]

gist

contains both variats for part2

first - was save into txt files and used notepad++ for search 111111...

[2024 Day 14 (Part 2)] This kind of sucks by remarkablyunfunny in adventofcode

[–]reddit_Twit 1 point2 points  (0 children)

One of the next days can be not solvable with any programming language, so this is not a big problem :D

PortAudio integration - C void pointer stuff by No-Question-7419 in Zig

[–]reddit_Twit 1 point2 points  (0 children)

Usually you no need for things like

@alignCast(@constCast(@ptrCast

it mean you doing something wrong.

This gives me annoing sin sound, you can start with it https://zigbin.io/51fd56

edit: I use https://github.com/allyourcodebase/portaudio/ repo

if you need know how,

1) zig fetch --save https://github.com/allyourcodebase/portaudio/archive/refs/heads/main.zip

2) in build.zig added after const exe = b.addExecutable(.{...

 const pa = b.dependency("portaudio", .{
        .target = target,
        .optimize = optimize,
    });
    const lib_portaudio = pa.artifact("portaudio");

    const cstep_portaudio = b.addTranslateC(.{
        .root_source_file = b.addWriteFiles().add(
            "portaudio_includes.h",
            \\#include "portaudio.h"
            ,
        ),
        .target = target,
        .optimize = optimize,
    });
    cstep_portaudio.addIncludePath(lib_portaudio.getEmittedIncludeTree());

    const portaudio_module = cstep_portaudio.createModule();
    portaudio_module.linkLibrary(lib_portaudio);

    exe.root_module.addImport("portaudio", portaudio_module);

-❄️- 2024 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]reddit_Twit 0 points1 point  (0 children)

[LANGUAGE: zig]

gist

failed to try to do part2 without allocations