xavdid's recent activity
-
Comment on Day 19: Aplenty in ~comp.advent_of_code
-
Comment on Day 26 in ~comp.advent_of_code
xavdid There are 2 truly difficult problems in computer science: naming things, cache invalidation, and off-by-one errors. 😁There are 2 truly difficult problems in computer science: naming things, cache invalidation, and off-by-one errors. 😁
-
Comment on Day 16: The Floor Will Be Lava in ~comp.advent_of_code
xavdid Step-by-step explanation | full Python code Very pleased with today. Ended up with a State that could generate the next State based on its location and direction. Put those in a queue and bail if...Step-by-step explanation | full Python code
Very pleased with today. Ended up with a
State
that could generate the nextState
based on its location and direction. Put those in a queue and bail if the next state is out of bounds or has already been seen. I liked the architecture today, which focused on separation of concerns. Also, got to use some features of pattern matching, which is always exciting.Also, spent a bunch of time at the end of the post discussion performance optimizations. Got the (both parts) runtime from ~ 4.6 seconds down to ~ 1.1 with 3 1-line changes!
-
Comment on Day 2: Cube Conundrum in ~comp.advent_of_code
xavdid Ah, that's awesome! I always use sum but never knew there was a multiplication version!Ah, that's awesome! I always use
sum
but never knew there was a multiplication version! -
Comment on Looking for games like wordle in ~games
xavdid Cinerdle is a favorite of mine! Not too hard, but not too easy. I do love film trivia.Cinerdle is a favorite of mine! Not too hard, but not too easy. I do love film trivia.
-
Comment on Day 2: Cube Conundrum in ~comp.advent_of_code
xavdid Nice! I've been really digging just as a program. Is powerful, but stays out of my way.Nice! I've been really digging
just
as a program. Is powerful, but stays out of my way. -
Comment on Day 2: Cube Conundrum in ~comp.advent_of_code
xavdid Step-by-step Python explanation: https://advent-of-code.xavd.id/writeups/2023/day/2/ Pretty straightforward today - Python's re.findall and a regex got me all the pairs of count + color and a...Step-by-step Python explanation: https://advent-of-code.xavd.id/writeups/2023/day/2/
Pretty straightforward today - Python's
re.findall
and a regex got me all the pairs of count + color and adefaultdict
made it easy to calculate the min number required. Oddly, this felt more like a day 1 than yesterday did 😅 -
Comment on Day 1: Trebuchet?! in ~comp.advent_of_code
xavdid AoC is routinely my favorite event of the year. Day 1 had some fun edge cases, but nothing too crazy. If anyone gets stuck (not necessarily today, but at some point in here), I'll be posting...AoC is routinely my favorite event of the year. Day 1 had some fun edge cases, but nothing too crazy.
If anyone gets stuck (not necessarily today, but at some point in here), I'll be posting explanations of each puzzle and my Python solution on my website: https://advent-of-code.xavd.id/writeups/2023/day/1/
Should be a fun year!
-
Comment on What programming/technical projects have you been working on? in ~comp
xavdid For the past few years of Advent of Code, I've written step-by-step explanations for how each puzzle is solved. This has been an important step in my learning, plus it's fun. Previously, these...For the past few years of Advent of Code, I've written step-by-step explanations for how each puzzle is solved. This has been an important step in my learning, plus it's fun.
Previously, these writeups have been available as GitHub
README
s, which is fine. But, in an effort to really showcase them, I'm making a little static site to host them. This has a few advantages:- I can get a little fancier with my syntax highlighting (e.g. line numbers or highlighting new rows)
- They'll be easier to find rather than buried in a repo
- I can add things like an RSS feed
I'm building it with Astro and am very impressed so far!
-
Comment on As the Halloween season begins, what are your favorite spooky reads? in ~books
-
Comment on As the Halloween season begins, what are your favorite spooky reads? in ~books
xavdid Definitely witchy- they're running around doing magic and stuff. I actually don't remember loving the movie, but I think it would fit the season.Definitely witchy- they're running around doing magic and stuff. I actually don't remember loving the movie, but I think it would fit the season.
-
Comment on As the Halloween season begins, what are your favorite spooky reads? in ~books
xavdid Nice! Seems appropriate. I've seen the Eastwick movie, but didn't realize it was a book.Nice! Seems appropriate. I've seen the Eastwick movie, but didn't realize it was a book.
-
Comment on As the Halloween season begins, what are your favorite spooky reads? in ~books
xavdid Oh fun! I like frame stories like that - I'll check it out.Oh fun! I like frame stories like that - I'll check it out.
-
Comment on As the Halloween season begins, what are your favorite spooky reads? in ~books
-
Comment on As the Halloween season begins, what are your favorite spooky reads? in ~books
-
As the Halloween season begins, what are your favorite spooky reads?
I like to try and read seasonally-appropriate books during October and I'm curious what your favorites are. To qualify as "seasonally-appropriate", the book should have at least one of: ghost /...
I like to try and read seasonally-appropriate books during October and I'm curious what your favorites are. To qualify as "seasonally-appropriate", the book should have at least one of:
- ghost / vampire / werewolf / zombie / witch / haunting / etc
- Take place in the autumn / around Halloween itself
- be overall creepy or unsettling
- mysteries are generally acceptable, but it should be different from an any-time-of-year mystery
25 votes -
Comment on What do you think about other users' usernames? in ~tildes
xavdid Oh interesting, I'll check that out! I think it's never a good substitute for a service-level thing (which is tied to my account and doesn't need to be explicitly synced), this is probably a good...Oh interesting, I'll check that out!
I think it's never a good substitute for a service-level thing (which is tied to my account and doesn't need to be explicitly synced), this is probably a good stopgap.
-
Comment on What do you think about other users' usernames? in ~tildes
xavdid I mostly don't. Many forums have so many users that you're unlikely to come across the same user enough times to develop any sort of relationship. A feature I wish more sites had (tildes included)...I mostly don't. Many forums have so many users that you're unlikely to come across the same user enough times to develop any sort of relationship.
A feature I wish more sites had (tildes included) that I like from Reddit is to be able to mark a user as a "friend". All this does is light up their username in a thread if they've commented. It's great to see someone you "know" pop up in a random thread and it does help develop that sense of community.
-
Comment on What online subscriptions do you pay for? in ~tech
xavdid The problem with this is that it ruins it for everyone. Sure, people from wealthier countries can get super cheap games / YT / whatever this way. But once enough people do it,...The problem with this is that it ruins it for everyone. Sure, people from wealthier countries can get super cheap games / YT / whatever this way. But once enough people do it, Nintendo/Steam/Google notices and drops the cheaper pricing, effectively locking the country (Turkey, Argentina, etc) out of the service. If you can't pay then pirate, but don't ruin it for people who literally can't afford it.
-
Comment on What are some good, non-microtransaction riddled mobile games? in ~games
xavdid One I haven't seen mentioned is Blackbox. It's iOS only and costs a few bucks to unlock the entire game. The first few levels are free. There are no ads at all. It's a puzzle game about exploring...One I haven't seen mentioned is Blackbox. It's iOS only and costs a few bucks to unlock the entire game. The first few levels are free. There are no ads at all.
It's a puzzle game about exploring your phone, but you never have to touch the screen. Each puzzle has to do with some system function or hardware sensor- basically treating it as a little black box.
The puzzles are awesome and the art is delightful. There's also a lot of Easter eggs to find!
Step-by-step explanation | full code
This one was a lot of fun! I separated out the workflow parsing (using
operator.gt/lt
and simple string indexing), the part parsing (using a regex that found tuples), and the recursing (to get answers) so you can look at each individually.I had some trouble visualizing part 2 at first, so there's some good diagrams in there if you're having trouble as well!
Solution wise, A workflow is parsed into a dynamically-defined function which gets the next workflow(s) based on the input. For part 1, that's:
Python code
For part 2 I passed around a
Part
as adict[str, range]
, so its workflow runner was:Python code
Very fun today, and nothing too cursed!