Coding 2023-12-14
Oof, partied too hard today, in a way that was imperceptible at the time. Let's see how much I'm up for.
I dusted off some of my old hobby code today, copying it from a Jupyter notebook into marimo. Along the way, I made some changes. See, the original version had a bunch of type-level stuff going on, and I ended up replacing what I was trying to do there with runtime validation. This was mostly fine in my opinion, but I think I swung the pendulum slightly too far, and I need to find some way to recover the marker-y nonsense I had going on, to a limited extent.
Anyway, the code itself. I can't explain why, but I wanted to have a minimal toolkit for expressing arbitrary decks of cards. Currently, I've got code that can generate a normal 52-card deck plus any number of jokers, and both Japanese and Korean hanafuda/hwatu decks. My assumption is that that's enough flexibility to handle most traditional decks; I'm not intending to handle anything that has a regular release schedule, for example.
So, what's left to do before I ponder trying to library-ize this code?
- Get some type-marker-y stuff in, and tighten up some annotations.
- Figure out how to pretty-print card names, and generally how to write multimethods against them. Right now, I'm using the default attrs methods for printing, which are way too verbose for most purposes, but any replacement is going to need some form of contextual information that I'm not sure how to provide.
Anyway, I'll think about that, and other things, and try to make it to the weekend.
Good night.