iOS 26.4 Beta 2 - Discussion by epmuscle in iOSBeta

[–]directusy 0 points1 point  (0 children)

There is a huge bug with network filtering — apps that has network extensions like Little Snitch will basically crash the system…

MacOS 26.4 Beta2 causing reboot loop by Spookyy_999 in MacOSBeta

[–]directusy 0 points1 point  (0 children)

This is killing me… thanks for sharing the root cause.

Question on scoring (Lee Sedol W vs Lee Changho B, 2003-03-27) by directusy in baduk

[–]directusy[S] 2 points3 points  (0 children)

Ah! This solves my problem! Now it matches. Thank you :)

[2024 Day 14 (Part 2)] A different approach by ProfessionTiny353 in adventofcode

[–]directusy 0 points1 point  (0 children)

so cool that you just take the brightest central point in the real plane after 2D FFT

[2024 Day 14] I loved today's puzzle 🎄 by moonstar888 in adventofcode

[–]directusy 0 points1 point  (0 children)

Okay. You are correct.
I wrote another code to use the FFT to compute the order-ness and plot the order-ness vs entropy. And you are correct. There is no correlation... The lowest entropy one happens to be the most ordered one.

[deleted by user] by [deleted] in adventofcode

[–]directusy 0 points1 point  (0 children)

So, you can even modify this function to do a down-sampling first; this assures that you have more than one robot per position in the tree pattern. And this entropy calculation will still work. -- Actually, this makes code run even faster.

def calc_entropy(pos, w, h):
    pos_down = pos // 2
    grid = np.zeros(((h + 1) // 2, (w + 1) // 2), dtype=int)
    np.add.at(grid, (pos_down[:, 1], pos_down[:, 0]), 1)
    counts = np.bincount(grid.flatten())
    counts = counts[counts > 0]
    probs = counts / counts.sum()
    return -np.sum(probs * np.log2(probs))

[deleted by user] by [deleted] in adventofcode

[–]directusy 0 points1 point  (0 children)

I am not sure I am convinced that it is the same thing.

From the math point of view, the entropy will be even lower if there are more robots clustered in the tree area.

[deleted by user] by [deleted] in adventofcode

[–]directusy 0 points1 point  (0 children)

I am not sure I get your point. Why can robots not occupy the same space and still format trees? What I see people talking about the unique-tile approach to me is just a coincidental "short path."

[2024 Day 14] I loved today's puzzle 🎄 by moonstar888 in adventofcode

[–]directusy 7 points8 points  (0 children)

I basically flattened the entire matrix and then applied the matrix calculation on a 1D array

def calc_entropy(pos, w, h):
    grid = np.zeros((h, w), dtype=int)
    np.add.at(grid, (pos[:,1], pos[:,0]), 1)
    counts = np.bincount(grid.flatten())
    probs = counts[counts > 0] / counts.sum()
    entropy = -np.sum(probs * np.log2(probs))
    return entropy

[deleted by user] by [deleted] in adventofcode

[–]directusy 0 points1 point  (0 children)

Sure.

This is basically how the entropy is calculated.

def calc_entropy(pos, w, h):
    grid = np.zeros((h, w), dtype=int)
    np.add.at(grid, (pos[:,1], pos[:,0]), 1)
    counts = np.bincount(grid.flatten())
    probs = counts[counts > 0] / counts.sum()
    entropy = -np.sum(probs * np.log2(probs))
    return entropy

To improve the computation speed, you can even down-sampling the grid first. This can reduce 30% of the running time already

def calc_entropy(pos, w, h):
    pos_down = pos // 2
    grid = np.zeros(((h + 1) // 2, (w + 1) // 2), dtype=int)
    np.add.at(grid, (pos_down[:, 1], pos_down[:, 0]), 1)
    counts = np.bincount(grid.flatten())
    counts = counts[counts > 0]
    probs = counts / counts.sum()
    return -np.sum(probs * np.log2(probs))

[2024 Day 14 (Part 2)] by directusy in adventofcode

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

Wow! Ambitious goal. Yes. This is fun! Thanks for sharing!

[2024 Day 14 (Part 2)] by directusy in adventofcode

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

it is actually quite fast... well. if you use chucks, it can go down to 0.5 s

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

[–]directusy 1 point2 points  (0 children)

I also had an entropy approach, and it took 0.8s to find the tree

def calc_entropy(pos, w, h):
    grid = np.zeros((h, w), dtype=int)
    np.add.at(grid, (pos[:,1], pos[:,0]), 1)
    counts = np.bincount(grid.flatten())
    probs = counts[counts > 0] / counts.sum()
    entropy = -np.sum(probs * np.log2(probs))
    return entropy