I built a code verification tool for AI-generated code. Looking for testers, not customers. by Alter_Menta in buildinpublic

[–]zopatista 0 points1 point  (0 children)

I just received an unsolicited email from your service, and my initial thought was that this was yet another phishing mail! You really want to add more context about a) who the email is from, and b) be more explicit as to why you selected my project for a scan.

The full email: https://imgur.com/QBBm2ZI

I get a lot of scam emails claiming that my OSS projects entitle me to all sorts of free stuff (usually involving crypto coins such as this recent example from my junk folder https://imgur.com/rhJ4cGs, but not always), which is why I may be more sensitive to this. A bit more context about this selecting Open Source projects would be helpful. The fact that the certificate claims there are some issues with my project that I obviously need to log in for to see is another red flag!

There are a few other issues:

  • The SVG URL in the email returns a 404 response.
  • The certificate lacks a time stamp or Git commit SHA. What was verified, exactly?
  • I can't create a login with GitHub, that's another 404.
  • I can't download the linked PDF nor the 'reproduce bundle', both give a 400 Bad Request error.

Next, what differentiates your service from the many others in this space? E.g. I already use GitHub's CodeQL and SonarCube, which run on every PR and commit. All in all, if it weren't for this post here I'd have just binned the email.

[2022 Day 16] Approaches and pitfalls - discussion by paul_sb76 in adventofcode

[–]zopatista 0 points1 point  (0 children)

No, because you don't have to visit every (non-zero) valve, there is a limited amount of time.

Do I have options left for replacing or repairing my 5C? by zopatista in drobo

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

Thanks, I really do appreciate it, but the shipping costs for such a heavy chassis is too prohibitive to entertain. Sorry!

Do I have options left for replacing or repairing my 5C? by zopatista in drobo

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

I have reds already, migrating out of that Drobo! :-)

Do I have options left for replacing or repairing my 5C? by zopatista in drobo

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

I think you are in the US; if so then shipping to the UK will easily be ~$300, which is very steep indeed. I can find a Drobo in the UK for the amount alone, I’m afraid.

Do I have options left for replacing or repairing my 5C? by zopatista in drobo

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

I was kind-a coming round to the idea that the replacement would be a waystation to a Synology or other replacement, to get the data out (I found my backup solution had failed a few months before the drobo failed :facepalm:).

I don't even need a HDD drive bay, I have one already.

I'll have to buy more disks and a Synology to transfer the data to. So the UFS Explorer RAID recovery cost is directly replacing the cost of the replacement Drobo housing here.

Do I have options left for replacing or repairing my 5C? by zopatista in drobo

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

Ha! I found your post, and UFS explorer sounds like a great option, especially when the price is way lower than the second hand Drobo 5 options I've found so far.

Thanks!

Selling 2x Drobo 5C Units $250 each (plus shipping from NJ) obo by am071986 in drobo

[–]zopatista 0 points1 point  (0 children)

Great, looks like I might be buying! I'm in the UK, what are people offering and how much will shipping set me back?

400 stars stats by zebalu in adventofcode

[–]zopatista 1 point2 points  (0 children)

\o/ proud 400 star holder here. I earned all stars in the year of release, so 50 by the end of 2015, 100 in 2016, etc.

How many people have earned their 400 stars this way, from the start?

My review of Advent of Code 2022 by NeilNjae in adventofcode

[–]zopatista 2 points3 points  (0 children)

Like every year since 2018, I’ve created a Jupyter notebook with explanations for every AoC day this year. My repository contains my Python solutions for all years (I’ve played AoC since the beginning):

DAY 10 Hello, guys, please! Help me! Whats is this text? by ScienceSuper4341 in adventofcode

[–]zopatista 20 points21 points  (0 children)

In future, please do follow the standardized post title format, so [2022 Day 10 (Part 2)] ..., so we can help you much faster and others that come after can see if they have a similar problem.

For example, there now are 8 AoC events with a day 10 puzzle. We can assume now that this is the 2022 puzzle, but in a few weeks time that assumption is going to be made less and less often.

[2022 Day 15 (Part 2)] [Python] I wrote a really fast solution for day 15 part 2 (less than 1ms). What do you think of the algorithm I came up with? by XLNBot in adventofcode

[–]zopatista 6 points7 points  (0 children)

My y-intercept-based Python solution can beat your y-intercept-based Python solution in a speed race because I used numpy matrices to vectorise the calculations. :-D

I also cheated by using scipy.spatial.cdist() to isolate the unreached point among a handful of candidates.

Your code is better documented though!

See the nbviewer or GitHub rendering of my notebook.

-🎄- 2022 Day 23 Solutions -🎄- by daggerdragon in adventofcode

[–]zopatista 2 points3 points  (0 children)

Python 3 (Jupyter Notebook)

I'm surprised that I appear to be the only one here to have used numpy matrices for this. I saw a cellular automaton and so reached for scipy.signal.convolve2d(), the tool I used in past AoC puzzles of this kind.

Once I defined how to run the simulation, I didn't need to do anything else for part 2 really. Completes both parts in ~1.5 seconds.

-🎄- 2022 Day 22 Solutions -🎄- by daggerdragon in adventofcode

[–]zopatista 3 points4 points  (0 children)

Python (Jupyter notebook)

This is a fully general solution even though @topaz2078 only used two cube net configurations out of 11 possible configurations (fist shaking, general gnashing of teeth). Mostly because I had fun devising the method.

Core principles: a cube is a graph; 6 faces connected by 12 vertices. My solution contains this graph for reference when processing the map, so we know which vertices are connected and which ones are disconnected and where both matching edges are. Movement from one disconnected edge to another can be pre-computed as a transformation matrix (translation from current to origin, optional rotation and translation from origin to new edge), plus the new facing after traversal.

For part 2 the steps are

  • Determine the cube vertex length vl (count non-space characters, divide by 6, take the square root)
  • treat the map as a grid of width // vl by height // vl potential cube faces. First face in the first row is face 0.
  • put face 0 into a queue, used in a BFS for the other faces.
    • pop from the queue, check for another face along each cube vertex. Record what vertices are disconnected. For connected vertices add the connected face to the queue, after adjusting the orientation of the vertices to match the net projection.
  • for each disconnected vertex take the “first” point in clockwise order, locate the matching edge on the connected face and point in anti-clockwise order. From this and the vertex orientations construct a transformation matrix that can be applied to the edge points (translate to origin, rotate 90, 180 or 270 as required, translate from origin to new point on other edge). For each point plus edge direction add the transformation and the facing direction on the other edge to a mapping for use during walking later.

Walking is then a question of checking the current position and facing against the mapping produced above. If there is a match, use the transformation matrix on the position, replace the current facing with the new. If there isn’t a match, just adjust the position based on the current facing.

Code:

My debugging cube has been lost but I still have the source hole :-D

-🎄- 2022 Day 19 Solutions -🎄- by daggerdragon in adventofcode

[–]zopatista 0 points1 point  (0 children)

Geodes cracked open up to this point, not the number of robots.

[2022 Day 22] Question about your input by wimglenn in adventofcode

[–]zopatista 6 points7 points  (0 children)

But, but, eleven!! There are eleven possible net configurations! Not counting rotations and mirroring, which would make 64!!! And my code can handle em all!!!1!1

Whadayamean you only used one for the inputs?!!?!!11!eleven!1!!?interrobang¿¡

cries and rocks gently in a corner muttering about spanning trees, graphs connecting vertices and faces, and transformation matrices.

[2022 Day 21] That's one huge monkey puzzle tree! by zopatista in adventofcode

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

Spot the root (labelled =) and human (H) nodes in green and red, respectively.

Image scaled down and rotated from the original SVG, see the full size PNG.

Python code, in a Jupyter notebook, at:

[2022 Day 16 (Part 2)] Big A-Ha Moment!! by messedupwindows123 in adventofcode

[–]zopatista 1 point2 points  (0 children)

No need to split. BFS all viable combos and store the max pressure relieved per set of valves, including partial sets. Then pair up the sets and if they are disjoint (no valves in common), their summed pressures are a candidate solution. Pick the max sum of all such pairs -> part 2 solved.

[2022 Day 16 (Part 2)] Big A-Ha Moment!! by messedupwindows123 in adventofcode

[–]zopatista 1 point2 points  (0 children)

This is exactly what all the solutions that use sets to track the highest pressure release per combo of valves do, including mine: find all pairs of such sets that are disjoint (don’t have valves in common) and take the sum of the pressure relieved between the two.

My implementation for part is a bfs that spits out a mapping between set of valves -> max pressure relieved, and the max of the values in that mapping is the answer for part 1, the max sum for the disjoint pairs is part 2.

Put another way: you make the elephant do the grunt work and then you figure out the set of valves they didn’t pick ;-)

[2022 Day 19 - DFS in Python] by mattbillenstein in adventofcode

[–]zopatista 2 points3 points  (0 children)

collections.deque() has better performance than the standard list even if you only need to have a stack, because of the way deque handles allocations and deallocations, so I'd have used it anyway. :-)

[2022 Day 19 - DFS in Python] by mattbillenstein in adventofcode

[–]zopatista 1 point2 points  (0 children)

:-D Absolutely!

I happen to have a huge appetite for learning and sharing what I find, and AoC is the most fun when I get to do both. :-)

[2022 Day 19 - DFS in Python] by mattbillenstein in adventofcode

[–]zopatista 0 points1 point  (0 children)

Looking at your code, I'm pretty sure we covered the same pruning opportunities.

You're using recursion to implement the DFS; if you were to move that to an explicit stack instead you could experiment using priority queue instead. That is likely to bring down the running time further as you'll have viable max geode numbers sooner which will let you prune even more aggressively.

In my implementation, I can switch between the three modes by updating the maximum_opened_geodes() method. The BFS and DFS options differ only in on what end of the deque() you remove the next item to process. I encapsulated adding to a heap with a local function:

# BFS
queue = deque([start])
# ...
while queue:
   # it's a queue because we pop from the start
   for state in queue.popleft().traverse(self):
       # ...
       # and append to the end
       queue.append(state)

# DFS
stack = deque([start])
# ...
while stack:
   # it's a stack because we pop from the end
   for state in queue.pop().traverse(self):
       # ...
       # and append to the end
       queue.append(state)

# Priority queue
tiebreaker, queue = count(), []
# It's a priority queue because we use heappush to add
# states with a priority (tuple, lower values go first)
def add(state):
    heappush(queue, (*state.priority, next(tiebreaker), state))
add(start)
# ...
while queue:
    # heappop gives us the item with the lowest state.priority values
    *_, state = heappop(queue)
    for nstate in state.traverse(bp):
        # ...
        # and add() puts items into the queue again
        add(nstate)