[-] Architeuthis@awful.systems 2 points 2 weeks ago* (last edited 2 weeks ago)

If nothing else, you've definitely stopped me forever from thinking of jq as sql for json. Depending on how much I hate myself by next year I think I might give kusto a shot for AOC '25

[-] Architeuthis@awful.systems 2 points 2 weeks ago* (last edited 2 weeks ago)

22-2 commentaryI got a different solution than the one given on the site for the example data, the sequence starting with 2 did not yield the expected solution pattern at all, and the one I actually got gave more bananas anyway.

The algorithm gave the correct result for the actual puzzle data though, so I'm leaving it well alone.

Also the problem had a strong map/reduce vibe so I started out with the sequence generation and subsequent transformations parallelized already from pt1, but ultimately it wasn't that intensive a problem.

Toddler's sick (but getting better!) so I've been falling behind, oh well. Doubt I'll be doing 24 & 25 on their release days either as the off-days and festivities start kicking in.

[-] Architeuthis@awful.systems 2 points 1 month ago* (last edited 1 month ago)

11 discussion with spoliersWell my pt1 solution would require something like at least 1.5 petabytes RAM to hold the fully expanded array, so it was back to the drawing board for pt2 😁

Luckily I noticed the numbers produced in every iteration were incredibly repetitive, so I assigned a separate accumulator to each one, and every iteration I only kept the unique numbers and updated the corresponding accumulators with how many times they had appeared, and finally I summed the accumulators.

The most unique numbers in one iteration were 3777, the 75 step execution was basically instant.

edit: other unhinged attempts included building a cache with how many pebbles resulted from a number after x steps that I would start using after reaching the halfway point, so every time I found a cached number I would replace that branch with the final count according to the remaining steps, but I couldn't think of a way to actually track how many pebbles result downstream from a specific pebble, but at least it got me thinking about tracking something along each pebble.

11 code

// F# as usual
// fst and snd are tuple deconstruction helpers

[<TailCall>]
let rec blink (idx:int) (maxIdx:int) (pebbles : (int64*int64) list) =
    if idx = maxIdx
    then pebbles |> List.sumBy snd
    else
        pebbles
        // Expand array
        |> List.collect (fun (pebbleId, pebbleCount) -> 
            let fpb = float pebbleId
            let digitCount = Math.Ceiling(Math.Log(fpb + 1.0,10))      
            match pebbleId with
            | 0L -> [ 1L, pebbleCount ]
            | x when digitCount % 2.0 = 0.0 -> 
                let factor = Math.Pow(10,digitCount/2.0)
                let right = fpb % factor
                let left = (fpb - right) / factor
                [int64 left, pebbleCount; int64 right,pebbleCount]   
            | x -> [ x * 2024L, pebbleCount ])
        // Compress array
        |> List.groupBy fst
        |> List.map (fun (pebbleId, pebbleGroup) -> pebbleId, pebbleGroup |> List.sumBy snd)
        |> blink (idx+1) maxIdx


"./input.example"
|> Common.parse
|> List.map (fun pebble -> pebble,1L)
|> blink 0 25 
|> Global.shouldBe 55312L

"./input.actual"
|> Common.parse
|> List.map (fun pebble -> pebble,1L)
|> blink 0 75 
|> printfn "Pebble count after 75 blinks is %d" 

[-] Architeuthis@awful.systems 2 points 1 month ago

10 commentaryYeah basically if you were doing DFS and forgot to check if you'd already visited the next node you were solving for pt2, since the rule about the next node always having a value of +1 compared to the current one was already preventing cyclic paths.

10 CodeHardly a groundbreaking implementation but I hadn't posted actual code in a while so

(* F# - file reading code and other boilerplate omited *)

let mapAllTrails (matrix : int array2d) =
    let rowCount = matrix |> Array2D.length1
    let colCount = matrix |> Array2D.length2

    let rec search (current:int*int) (visited: HashSet<int*int>) (path: (int*int) list) : (int*int) list list= 
        let (row,col) = current
        let currentValue = matrix.[row,col]

        // Remove to solve for 10-2
        visited.Add (row,col) |> ignore

        // If on a 9 return the complete path
        if currentValue = 9 then [List.append path [row,col] ]
        // Otherwise filter for eligible neihboring cells and continue search
        else                    
            [ row-1, col;row, col-1; row, col+1; row+1,col]
            |> List.filter (fun (r,c) -> 
                not (visited.Contains(r,c))
                && r >= 0 && c>=0 && r < rowCount && c < colCount
                && matrix.[r,c]-currentValue = 1 )
            |> List.collect (fun next ->
                [row,col] 
                |> List.append path  
                |> search next visited)

    // Find starting cells, i.e. contain 0
    matrix
    |> Global.matrixIndices
    |> Seq.filter (fun (row,col) -> matrix.[row,col] = 0)
    // Find all trails starting from those cells and flatten the result
    |> Seq.collect (fun trailhead -> search trailhead (HashSet<int*int>()) [])
    

"./input.example"
|> Common.parse 
|> mapAllTrails
|> Seq.length
|> Global.shouldBe 81

"./input.actual"
|> Common.parse 
|> mapAllTrails
|> Seq.length
|> printfn "The sum total of trail rankings is %d"

[-] Architeuthis@awful.systems 2 points 1 month ago* (last edited 1 month ago)

Day 9 seemed pretty straightforward, don't really have anything to add.

[-] Architeuthis@awful.systems 2 points 1 month ago* (last edited 1 month ago)

I almost got done in by floating point arithmetic, I think

8-2 commentaryUsed the coordinates of every two same type frequences to create the ilnear equation (y = ax + b) and then fed it all the matrix coordinates to see which belonged to the line. To get the correct number of antinodes I had to check for |y - ax - b| < 0.0001, otherwise I got around 20 too few.

[-] Architeuthis@awful.systems 2 points 3 months ago

This was exactly what I had in mind but for the life of me I can't remember the title.

[-] Architeuthis@awful.systems 2 points 7 months ago

That's the trouble with talking about thoroughly disingenuous people, you get bogged down with defining if they meant to mean what they wrote. It's all optics.

[-] Architeuthis@awful.systems 1 points 1 year ago

Maybe he hopes that if he mentions shady crypto shenanigans often enough twitter's algorithm will take the hint and start pushing his stuff on a fresh batch of suckers who already self-select for gullibility.

[-] Architeuthis@awful.systems 2 points 1 year ago* (last edited 1 year ago)

Not sure if it's a NSFW assertion, but to me the p-zombie experiment seems like the result of a discourse that went off the rails very early and very hard into angels on the head of a pin territory, this lw post notwithstanding.

Like, as far as I can tell, imagining a perfectly cloned reality except with the phenomenon in question assumed away, is supposedly (metaphysical) evidence that the phenomenon exists, except in a separate ontology? Isn't this basically like using reverse Occam's razor to prove that the extra entities are actually necessary, at least as long as they somehow stay mostly in their own universe?

Plus, the implicit assumption that consciousness can be defined as some sort of singular and uniform property you either have or don't seems inherently dodgy and also to be at the core of the contradiction; like, is taking p-zombies too seriously a reaction specifically to a general sense of disappointment that a singular consciousness organelle is nowhere to be found?

view more: ‹ prev next ›

Architeuthis

joined 2 years ago