Wednesday, December 30, 2015

I've got a lot of books here.



Over the past week or so, I've taken 5 boxes of books to Half Price Books and just now filled another box to go out the next time I'm headed in that direction.

I like books. I like reading books. I like collecting books. I have maybe too many books. I have books that have perhaps been a fire hazard, making easy escape from my house a difficulty in case of an emergency. I have more than once bought a duplicate of a book, either because I've bought it already and forgot, or I just couldn't find the original.

Years ago, I thought it'd be good to organize my books by Dewey Decimal, oh, or maybe Library of Congress. Or maybe some sort of hierarchical tag-based scheme that I never got around to fully exploring. Now, I'm just happy if I can keep track of my books. 

I have a Google Drive Sheets spreadsheet, which is super handy - I can check it while I'm at a bookstore and see if the book I see in front of me is also waiting for me at home. This has already been a benefit.

But it's kind of ponderous - it's just a big list of stuff, and there's not a good way of identifying where a book actually is. (Organization.) I might also like to have a list of all my GURPS books, or when I get a new Kakuro puzzle book (I shouldn't be buying more of those), it might be nice to put it near the other ones of its ilk.

Also, barcode lookup might be nice to support.

So, I've been writing a tool.

Starting with web.py, and using MySQL (for now?), I started manually pulling individual lines from my spreadsheet in. The database knows that authors and ISBNs exist, but the web app has no way to display or edit them. But there's enough to start pulling one line at a time over from my spreadsheet.

Some(!) of my books are in boxes, and each box has its own ID. Each room in my house has its own ID. My house has an ID. So, there's a chain of containment there - such and so book might be in such and so box, which is in such and so room which is in my house. There are container links up from each item, and the web app is smart enough to do a select if I want to know what the contents of a specific box are. I've started printing out listings for the contents of boxes as I do my inventory - easy, just click the "contents" link off the box listing, and hit "print".

The web app does allow for me to use my fancy barcode scanner, storing UPC data for whatever items I feel like tagging. So far, it does nothing with that UPC ID, but I'm planning on doing an automated fetch from isbndb.org and making that data available.

I just now put in a facility where I can search for title substrings. So, if I ask for "gurps", it lists all the GURPS books I've entered so far (only 14, I'm just getting started). And when I ask for "apple", I get 21 hits, all for early '80s stuff. 6502 only hits 5 titles so far.

One thing that this should do is reach back to the Google Drive Sheets spreadsheet and mark which items in my spreadsheet have been added to the web app. And if I add a thing to the web app, it'd be nice if the spreadsheet reflected that without having to enter it twice. And maybe, it'd be nice to import from the spreadsheet, but if that's a lot of work, I'm OK with doing a manual inventory anyway, since my spreadsheet doesn't have a lot of UPC data, which I kind of want to collect at some point.

If you look carefully at the screenshot at the top, you'll see 4 digit IDs. That's not because I've catalogged more than 1000 items (well, actually, I have, but that's not why). It's because I had some idea that I'd use the thousands place to denote the type of object - allowing me to have enumerated categories for furniture, rooms, boxes, books, games, and other things. That categorization scheme has sort of fallen apart, but I might go back and rebuild it later, now that it's easier for a bit of code to enforce that sort of thing. Or I might ignore it, now that I've got code that makes it easier to filter and search.

Once I've got it reaching out and writing back to my spreadsheet, the next logical thing to do would be to reach out and write to a BoardgameGeek list, so my games would be listed there. But just games. Again, software is smart enough to mostly get that right, probably.

Also, maybe I could go back to my LibraryThing account and update my booklist there. 

Sunday, December 13, 2015

Clerics & Codenames, v0.0.2



Back in late October, I played a game of Codenames by Vlaada Chvátil. I was impressed with how much fun it is, how challenging, how much the words stuck in my head afterward, and how simple a game it seemed.

I appreciate that when somebody is really good at their art, they can make stuff that looks simple, even if it takes a lot of work, so to say that it seems like a simple game isn't meant to diminish it - it's elegant.

I also wondered how much work it'd be to make a playable set of expansion cards. I had a bunch of questions - should you go for simple words? Just nouns? Would choosing words from a theme make sense? (Star Wars? Computers? Geek Life?) Or would that narrow the range of possible connections too much?

I poked around, looking for word lists of common words (inspired by Randall Munroe's Thing Explainer, which also inspired Space Weird Thing, which is awesome, but is only super loosely connected to the game I was talking about), but couldn't find a list I liked, so I set things aside for a bit.

Then, last week, somehow the idea of taking a bunch of words from fantasy role playing games might be a place to start. I went back to a couple of the works that made an impression on me at an early age, the Holmes edition of the Dungeons & Dragons ruleset and B2 - The Keep on the Borderlands. Skimming through there (and paying particular attention to glossaries), I came up with many words that were burned into my brain first through Dungeons & Dragons.

Those words went into a Google Docs Spreadsheet (er, a Google Spreadsheet as hosted on Google Drive?), which I then exported as a CSV file.

Using Reportlab and PIL (actually Pillow), I made a PDF, which I printed out on cardstock:


I invited a few of my coworkers to sit down and see if a strongly-themed cardset would actually be fun, and I was surprised first by how enthusiastic people were, and then I was surprised that it played really well.

Some of the feedback included:

  • randomize the cards, because we had a bunch of 'h' words, followed by a bunch of 'c' words. Shuffling home-printed cardstock cards is challenging.
  • wouldn't it be awesome for the red and blue 'cover' cards from the Codenames set were also themed?
  • remove words that are too close in meaning. e.g. 'cave' and 'cavern', 'vial' and 'phial'.
  • rework the script so that the fontsize is consistent from card to card
  • I would totally buy this on DriveThruCards
  • Maybe this should be posted on Board Game Geek 



So, stuff I've done today:

Script rework. I reworked my Python script to generate either letter (print and play) or mini-card (Drive Thru Cards) page sizes. Reportlab's canvas object defaults to letter, but you can pass in a pagesize argument.

I pulled the UniversalisADFStd-Regular.otf file into fontforge and exported it as a TTF. This made Reportlab happier with the file, as the outlines were in a format that it liked. (Known issue, they're in no hurry to support Postscript outlines, or something.

In my 1st printing, I had worked around the OTF limitations by using Pillow to create an image just large enough to hold the text, rendering the text to an in-memory image, then using Reportlab to insert that image into my PDF. Now that Reportlab can render the text directly, I can skip Pillow for this, which fixes the odd sizing artifacts that I was seeing - for some words (ones with descenders, I think), the images were sizing differently from others. Now, since I'm not using images, the font sizes don't have that step to cause strange behaviors.

Randomized the cards. For the first image (above), I wanted to make sure I could easily find "dungeon" and "dragon", so I sorted the words. This led to a whole bunch of the same first letter. This will be solved, in time, when I get better printed cards. Until then, I might as well shuffle the words before creating the PDF.

Custom Red & Blue cards. I've made some solid color cards, as well as some temporary placeholder themed cards using copyrighted content that I cannot distribute. Red and Blue line up nicely with that particular content, though.

Word curation. I got rid of 'cave'. I added 'sepulchre'. I should probably spell that the way any good United States citizen spells it. Oops. Also forgot to remove 'phial'.

Printed out a new playable set:


I haven't got my print settings set up right - the cards aren't lining up front-and-back the way I had intended. Not a huge thing, totally playable as-is, but if I wanted to distribute this as print-and-play, I'd want to make sure that it's possible to line up the cards.

Board Game Geek posting. I have had an account on BGG for years, mostly using it to read reviews. I found the link to create a new listing for a new game, which itself depends on a BGG page for designer and publisher, so I created new listings for myself and for Big Dice Games. It's like I'm a real boy!

All of the above are under review. I think that's a good policy. If it were faster, I'd include a link here to my listings.

DriveThruCards listing. As much to test out the process (is the PDF I generated from ReportLab the right flavor of PDF that DTC is expecting?) as anything, I made a listing of this on DriveThruCards. This required setting my account up as a publisher account (whee). It also required a cover image, which I made by cropping the above photo. Good enough for a work-in-progress.

Apparently, it passed the simple checks to get to the point where I could order a proof, so I have. I'm eager to see if it prints without errors, and if it gets to me before I'm on vacation.


Feels like a lot, and this is for a trivial little expansion to somebody else's game. But it's fun to play, and it's been fun to go through the process.