Skip Navigation

Posts
9
Comments
211
Joined
2 yr. ago

  • Many fond memories of using RISC OS as a kid. It's good to know that it's still alive!

  • Hehe. Nice observation!

    Although, isn't this basically Newton's method of square roots? I don't recall how floating point implementations usually do it, but it's not too surprising that the performance is similar to the algebraic approach.

  • That's nice to hear. I recognize a lot of what you're saying <3

    It feels good to be able to open up to people at last.

  • Whee! Another time sink! subscribe

  • I might have spent an unusual amount of time recently reading up on ADHD. Am I going to do anything about it? Ha ha ha.

  • I tried some of this recently. The peach flavor was a bit too sweet for me, but the plain stuff is <3

  • That sounds lIke fun! What do you do about hills? Do you have power assist?

  • I agree with 15: I solved it pretty quickly and I like my solution, but what makes me really happy is that I'm pretty sure I couldn't have solved it a few years ago.

    Also day 11 (Plutonian pebbles): it's such a simple problem, and part two is a perfect example of how and why to use dynamic programming. I've been encouraging everyone to try it.

  • It was nice to see some of the same faces (as it were) again from last year!

    Also great to see more Haskell solutions, and props to those crazy enough to write in J and Uiua.

  • Sorry to hear that :/

    I think you handled it well.

  • Haskell

    A total inability to write code correctly today slowed me down a bit, but I got there in the end. Merry Christmas, everyone <3

     
        
    import Data.Either
    import Data.List
    import Data.List.Split
    
    readInput = partitionEithers . map readEntry . splitOn [""] . lines
      where
        readEntry ls =
          (if head (head ls) == '#' then Left else Right)
            . map (length . head . group)
            $ transpose ls
    
    main = do
      (locks, keys) <- readInput <$> readFile "input25"
      print . length $ filter (and . uncurry (zipWith (<=))) ((,) <$> locks <*> keys)
    
      
  • Posted (in the daily thread)! I was initially considering brute force on outputs which are dependencies of the first incorrect bit (but not earlier bits), but in the end I just coded up the checks I was doing by hand.

  • Haskell

    For completeness' sake. I actually solved part 2 by looking at the structure with Graphviz and checking the input manually for errors. So the code here merely replicates the checks I was doing by hand.

  • Yeah, same here. Graphviz to get an overview (although I didn't actually need it in the end), plus some helper functions. I've got an idea for how to do it in code, though, when I get a moment.

  • If you're re-checking all nodes you should be safe πŸ‘

  • That's a fun approach. The largest totally connected group will of course contain overlapping triples, so I think you're effectively doing the same thing as checking a node at a time, just more efficiently.