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

puzzles unlock at 2PM

Almost exactly at the start of office hours for me.

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

Nabokov's Lolita really shouldn't be pigeonholed as merely that, but I guess the movies are another story.

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

Got stuck forever on 2-2 because of an edge case that only showed up in 7/1000 reports, ended up just brute forcing it, just ran the fitness function after removing one element at a time sequentially.

Then solved 3.x in like minutes because I could be worse at regex, posting code mostly because no-one else posted F# yet.

edited to fix spoiler header formatting

3-2 in F#

"./input.actual"
|> System.IO.File.ReadAllText
|> fun source -> 
    System.Text.RegularExpressions.Regex.Matches(source, @"don't\(\)|do\(\)|mul\((\d+),(\d+)\)")
    |> Seq.fold
        (fun (acc, enabled) m ->
            match m.Value with
            | "don't()" -> acc, false
            | "do()" -> acc, true
            | mul when enabled && mul.StartsWith("mul") ->
                let (x, y) = int m.Groups.[1].Value, int m.Groups.[2].Value
                acc + x * y, enabled
            | _ -> acc, enabled ) 
        (0, true)
    |> fst
|> printfn "The sum of all valid multiplications with respect to do() and don't() is %A"

commentsNot much to say, the regex grabs all relevant strings and the folding function propagates a flag that flips according to do/don't and an accumulator that is increased when a mul() is encountered and parsed.

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

Explaining in detail is kind of a huge end-of-book spoiler, but "All communication is manipulative" leaves out a lot of context and personally I wouldn't consider how it's handled a mark against Blindsight.

[-] Architeuthis@awful.systems 4 points 4 months ago

Seems unnecessary, due to the paradox of intolerance it's trivial to be made to look the bad guy if you are actively trying to curtail fash influence in the public discourse.

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

He seems very aware of how writing works at least, and unlike EY some of his fiction is serviceable.

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

(update: disproven by Crowdstrike’s blog post).

How do you mean? The current top post on the blog seems to mention .sys files as part of the problem very prominently.

Channel file "C-00000291*.sys" with timestamp of 0527 UTC or later is the reverted (good) version. Channel file "C-00000291*.sys" with timestamp of 0409 UTC is the problematic version.

[-] Architeuthis@awful.systems 4 points 11 months ago

If books could kill is so much fun.

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

/r/buttcoin seems to have it handled, but it might be worth it to have an alternative just in case, especially if @dgerard@awful.systems is going to be contributing.

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

Day 4: Scratchcards

Late to the party and never done advents before, I liked how this problem reminded me that tree traversal is thing, almost as much as I don't that so much of my career involves powershell now.

I'm putting everything up at https://github.com/SpaceAntelope/advent-of-code-2023 except the input files.

Using command abbreviations like % and ? to keep the horizontal length friendly to lemmy post areas, they are expanded in git.

Part 2 in Powershell

function calculate([string]$data) {
  # code for parsing data and calculating matches from pt1 here, check the github link if you like banal regexps
  # returns objects with the relevant fields being the card index and the match count
}

function calculateAccumulatedCards($data) {
    $cards = calculate $data # do pt1 calculations

    $cards 
    | ? MatchCount -gt 0 # otherwise the losing card becomes its own child and the search cycles to overflow
    | % { 
        $children = ($_.Index + 1) .. ($_.Index + $_.MatchCount)  # range of numbers corresponding to indices of cards won
        | % { $cards[$_ - 1] } # map to the actual cards
        | ? { $null -ne $_ }  # filter out overflow when index exceeds input length

        $_ | Add-Member -NotePropertyName Children -NotePropertyValue $children # add cards gained as children property
    }

    # do depth first search on every card and its branching children while counting every node
    # the recursive function is inlined in the foreach block because it's simpler than referencing it 
    # from outside the parallel scope
    $cards | % -Parallel {
        function traverse($card) {
            $script:count++        
            foreach ($c in $card.Children) { traverse($c) }
        }
        
        $script:count = 0 # script: means it's basically globally scoped
        traverse $_ 
        $script:count # pass node count to pipeline     
    } 
    | measure -sum    
    | % sum
}

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

It's supposed to be from the book the moneyball guy wrote about him that was recently released, according to several seconds of googling 'SBF on Shakespear'.

view more: ‹ prev next ›

Architeuthis

joined 2 years ago