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

23-2Leaving something to run for 20-30 minutes expecting nothing and actually getting a valid and correct result: new positive feeling unlocked.

Now to find out how I was ideally supposed to solve it.

[-] Architeuthis@awful.systems 3 points 3 weeks ago

16 commentaryDFS (it's all dfs all the time now, this is my life now, thanks AOC) pruned by unless-I-ever-passed-through-here-with-a-smaller-score-before worked well enough for Pt1. In Pt2 in order to get all the paths I only had to loosen the filter by a) not pruning for equal scores and b) only prune if the direction also matched.

Pt2 was easier for me because while at first it took me a bit to land on lifting stuff from Djikstra's algo to solve the challenge maze before the sun turns supernova, as I tend to store the paths for debugging anyway it was trivial to group them by score and count by distinct tiles.

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

Pt2 commentary

I randomly got it by sorting for the most robots in the bottom left quadrant while looking for robot concentrations, it was number 13. Despite being in the centre of the grid it didn't show up when sorting for most robots in the middle 30% columns of the screen, which is kind of wicked, in the traditional sense.

The first things I tried was looking for horizontal symmetry (find a grid where all the lines have the same number of robots on the left and on the right of the middle axis, there is none, and the tree is about a third to a quarted of the matrix on each side) and looking for grids where the number of robots increased towards the bottom of the image (didn't work, because turns out tree is in the middle of the screen).

I thinks I was on the right track with looking for concentrations of robots, wish I'd thought about ranking the matrices according to the amount of robots lined up without gaps. Don't know about minimizing the safety score, sorting according to that didn't show the tree anywhere near the first tens.

Realizing that the patterns start recycling at ~10.000 iterations simplified things considerably.

The tree on the terminal output(This is three matrices separated by rows of underscores)

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

13 commentarySolved p1 by graph search before looking a bit closer on the examples and going, oh...

In pt2 I had some floating point weirdness when solving for keypress count, I was checking if the key presses where integers (can't press button A five and half times after all) by checking if A = floor(A) and sometimes A would drop to the number below when floored, i.e. it was in reality (A-1).999999999999999999999999999999999999999999999. Whatever, I rounded it away but I did spend a stupid amount of time on it because it didn't happen in the example set.

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

My graph search solves 7-1 and passes the example cases for 7-2, but gives too low a result for the complete puzzle input, and there's no way I'm manually going through every case to find the false negative. On to day 8 I guess.

7-2 Check case by simple graph search that mostly works

// F#
let isLegit ((total: int64), (calibration : int64 array)) = 

    let rec search (index : int) (acc: int64) =
        let currentValue = calibration.[index]
        
        [Add; Times; Concat] // operators - remove 'Concat' to solve for 7-1
        |> List.exists (fun op -> // List.exists returns true the first time the lambda returns true, so search stops at first true
                match op with // update accumulator
                | Add -> acc + currentValue
                | Times -> acc * currentValue
                | Concat -> int64 (sprintf "%d%d" acc currentValue)
                |> function // stop search on current accumulator value (state) exceeding total, or being just right
                | state when state > total -> false
                | state when state = total && index < (calibration.Length-1) -> false // this was the problem
                | state when state = total && index = (calibration.Length-1) -> true
                | state -> // stop if index exceeds input length, or continue search
                    if index+1 = calibration.Length
                    then false
                    else search (index+1) state
        )
     
    // start search from second element using the first as current sum
    search 1 calibration.[0]

EDIT: total && index < (calibration.Length-1) -> false -- i.e. stop if you reach the total before using all numbers, well, also stops you from checking the next operator, So, removing it worked.

Rubber ducking innocent people on the internets works, who knew.

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

tl;dr: Day 5 was most perfectly fine code thrown out for me, because I ran face first into eliminating imaginary edge cases instead of starting out simple.

5-1 commentaryI went straight into a rabbit hole of doing graph traversal to find all implicit rules (i.e. 1|2, 2|3, 3|4 imply 1|3, 1|4, 2|4) so I could validate updates by making sure all consequent pairs appear in the expanded ruleset. Basically I would depth first search a tree with page numbers for nodes and rules for edges, to get all branches and recombine them to get the full ruleset.

So ideally 1|2, 2|3, 3|4 -> 1|2|3|4 -> 1|2, 2|3, 3|4, 1|3, 1|4, 2|4

Except I forgot the last part and just returned the branch elements pairwise in sequence, which is just the original rules, which I noticed accidentally after the fact since I was getting correct results, because apparently it was completely unnecessary and I was just overthinking myself into several corners at the same time.

5-2 commentary and some codeThe obvious cornerstone was the comparison function to reorder the invalid updates, this is what I came up with:

let comparerFactory (ruleset: (int*int) list) :int -> int -> int = 
    let leftIndex = 
        ruleset 
        |> List.groupBy fst 
        |> List.map (fun (key,grp)-> key, grp |> List.map snd)
        |> Map.ofList

    fun page1 page2 -> 
        match (leftIndex  |> Map.tryFind page1) with
        | Some afterSet when afterSet |> List.contains page2 -> -1
        | _ -> 1

The memoization pattern is for caching an index of rules grouped by the before page, so I can sort according to where each part of the comparison appears. I started out with having a second index where the key was the 'after' page of the rule which I would check if the page didn't appear on the left side of any rule, but it turned out I could just return the opposite case, so again unnecessary.

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

discussionSame, except in 4-1 I used a recursive function to traverse each direction according to the offset decided by the selected direction (like SW is row++,col--) , due to functional programming induced brain damage.

Would have been pretty useful too if 4-2 turned out to be about finding longer patterns, instead of smaller and in half the directions.

4-1Inlined some stuff to fit everything in one function:

let rec isXmas (row:int) (col:int) (dir:int) (depth:int) (arr: char array2d) : bool =
    let value = arr.[row,col]
    if depth = 3
    then value = 'S'
    else if  [|'X';'M';'A';'S'|].[depth] = value
    then
        let (nextRow, nextCol) =
            match dir with
            | 1 -> row + 1, col - 1
            | 2 -> row + 1, col
            | 3 -> row + 1, col + 1
            | 4 -> row, col - 1
            | 6 -> row, col + 1
            | 7 -> row - 1, col - 1
            | 8 -> row - 1, col
            | 9 -> row - 1, col + 1
            | _ -> failwith $"{dir} isn't a numpad direction." 

        let rowCount = arr |> Array2D.length1
        let colCount = arr |> Array2D.length2
       
        if nextRow >= 0 && nextRow < rowCount && nextCol >= 0 && nextCol < colCount
        then isXmas nextRow nextCol dir (depth+1) arr
        else false
    else false

Then you run this for every appropriately pruned 'X' times every direction and count the trues.

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

It might be just the all but placeholder characters that give it a b-movie vibe. I'd say it's a book that's both dumber and smarter that people give it credit for, but even the half-baked stuff gets you thinking. Especially the self-model stuff, and how problematic it can be to even discuss the concept in depth in languages that have the concept of a subject so deeply baked in.

I thought that at worst one could bounce off to the actual relevant literature like Thomas Metzinger's pioneering, seminal and terribly written thesis, or Sack's The Man Who Mistook His Wife For A Hat.

Blindsight being referenced to justify LLM hype is news to me.

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

His overall point appears to be that a city fully optimized for self-driving cars would be a hellscape at ground level, even allowing for fewer accidents, so no real reason to belabor that point, which is mostly made in service to pointing out how dumb it is when your solution to reducing accident rates is "buy a new car" instead of anything systemic. like improving mass transit.

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

Apropos of nothing, I wonder when Uncle Trump's Presidential Pardon Auction House officially opens for business.

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

He wasn't usually. Another difference with siskind was that with TLP you mostly knew where you stood, or at least I don't remember any near-end-of-text jumpscares where it's revealed the whole thing was meant as really convoluted IQ apologetics, or some naive reframing of the latest EA embarrassment.

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

edit: accidentally removed the quote i was commenting on when editing in Stross' comment, here it is again:

a belief in psi powers implicitly supports an ideology of racial supremacy, and indeed, that's about the only explanation I can see for Campbell's publication of the weirder stories of A. E. Van Vogt.

Maybe it's me but I don't think that is so self evident a claim to be posited without further explanation.

Best I can come up is he means the necessary implication of having superabled people in a fictional setting is that you have a de facto racial elite, even if the concept rarely breaches the surface of the text, like in the unfortunate sequel to the Dark Knight Returns by Frank Miller.

Edit: he addresses it in the comments (can't find a way to direct link from phone, its comment #14) I wasn't far off:

If you're a glutton for punishment, (re-)read Slan by A. E. Van Vogt.

Secret superrace with super-mind powers! It's totally a meme in vintage SF (goes back at least as far as Bulwer-Lytton's The Coming Race in the 19th century) and you rapidly end up with eugenics and breeding for desired traits (eg. psi powers).

view more: ‹ prev next ›

Architeuthis

joined 2 years ago