Box Relatives

Thoughts about puzzles, math, coding, and miscellaneous

July 7, 2014
by Alex
1 Comment

Curriculum Vitae: Crazy Gin

Inspired by Todd McClary’s posts about the games he has created, I thought I’d share the only game I’ve ever come up with.

Crazy Gin
(Card game)

Two players are dealt seven cards each. One player plays gin rummy and the other player plays crazy eights. Both ignore the fact that the other person is playing by different rules. The only slight changes are

  1. The person playing gin always goes first (so that the first up card isn’t lost), and
  2. When the person playing gin discards an eight, she must declare a suit for the crazy eights player.

I invented this game in college one day, being unable to decide with a friend which of the two games to play. While a bit confusing (and frustrating!) at first due to the other player not behaving the way you would expect, it quickly becomes as easy as playing either game. Crazy Gin has not been *extensively* play-tested but it does appear fair. If, however, the person playing gin is very skilled, she may have an advantage. In this case the obvious handicap is to start the crazy eights player with only six cards.

January 18, 2014
by Alex

A Quirk of Twitter

Let’s suppose for whatever reason I wanted to list my favorite TV stations, and I came up with this list:

It’s not a long list — in fact, including spaces, it’s only 55 characters. Twitter’s character limit is 140 characters, so I should easily be able to tweet this, right? Wrong.
Wait, what? I’m not just over the character limit, I’m WAY over it. How is that possible?

Well, it turns out this is a quirk of Twitter’s URL shortening code. Yes, if you have a long link like*twit*&searchtype=simple&xmode=on&source=Wiki+%2B+Wiktionary&first=1 it will shorten it. But if you have a very short URL, it will actually lengthen it, sometimes by quite a bit. For instance, if I type “” into Twitter, it gets automatically changed to, which is 22 characters long. In other words, an eight-character string almost triples in length when you type it in. Crazy, huh?

November 14, 2013
by Alex

The newish Wikipedia Regex Search

We’ve had the Wikipedia Regex Search live for a while at Crossword Nexus, and this past week we made a few changes:

  • The search is much, much faster now. It is also easier on our servers, so making that change was win-win.
  • We’ve removed the Wiktionary search. The ranking algorithm we have for Wikipedia works great, but not so much for Wiktionary. We’ll need a new way of ranking common words … any suggestions?
  • We’ve removed the word length limit option and restricted results somewhat. We want to encourage people to download the list and run their searches offline if they want more.

Now if you’re wondering why you should use this thing, let me give you a concrete example of why it’s better than OneLook. Let’s use it to solve the most recent NPR Sunday Puzzle
Continue Reading →

November 7, 2013
by Alex

NPR Puzzle for 2013-11-03: a perl solution

Edit: This post has been updated with a better version of the code.

Here’s the most recent NPR puzzle:

A famous actress and a famous director share the same last name, although they are unrelated. The first name of one of these is a classic musical. The first name of the other is an anagram of a classic musical. Who are they?

Yes, this is an easy one. But hey, let’s see if a computer can solve it anyway …
Continue Reading →

November 1, 2013
by Alex

Crossword Nexus Store

Hey, have you not purchased the Crosswords LA puzzles yet? Is that because you hate charity or because you don’t like good crosswords? Seriously, though, these crosswords range from very good to excellent and all the profits go to the Reading To Kids charity. If these were daily puzzles in a major newspaper, Todd McClary’s puzzle would be talked about as possibly the best Monday puzzle of the year, and Jeffrey Harris’s puzzle would be in the running for best overall puzzle. What’s more, you get John “Doppler” Schiff’s ferris wheel-themed team game, which is a lot of fun.

Now, you may have noticed that these puzzles are for sale at the Crossword Nexus Store, which you may not have heard of before. Let me walk you through what it is.
Continue Reading →

September 5, 2013
by Alex

NPR Puzzle for 2013-09-01: a perl solution

Here’s this past week’s NPR puzzle:

Think of a well-known celebrity who goes by a single name — the last two letters of which are alphabetically separated by only one letter (like A and C, or B and D). Replace this pair of letters with the one that separates them, and you’ll have a common, everyday word. What is it?

It used to be that a puzzle like this was tough to solve with a computer program, because there wasn’t a list of famous names available anywhere. Well, now there is such a list, and it makes solving things like this a snap. You will still need a list of common words to solve this puzzle, but those are available all over. I used the Enable dictionary from the NPL.

A few interesting quirks happened along the way to solving this puzzle. First, it turns out that this particular person isn’t listed in Wikipedia by only his/her first name. So I had to tweak the code a bit to look at all possible first names in my list. This created a bit of a logjam because ROBERT -> ROBES comes up a ton. So the final hacked code to give the answer is below. Not my best work, but not bad for ten minutes.

It’s also a relief to see that the intended answer had a score of 100. YAY FAMOUS PEOPLE LIST
Continue Reading →

July 26, 2013
by Alex

New ranked Wikipedia pages are live

The new ranked Wikipedia pages (along with the updated Wikipedia regex search) are live on the site. Besides having more recent titles than the previous version, there are two other main differences:

  1. Pages with parentheses are now properly scored. Previously, an entry like Foxy Brown would have a low score because the Foxy Brown page is just a disambiguation page. But now, the score for Foxy Brown refers to the Foxy Brown (rapper) page and so she gets a score of 99.
  2. The scores are now distributed so as to have more granularity at the top end of the list and less at the bottom end. This means that it is now harder to get a score of 100 than before, a score of 80 isn’t nearly as good as it used to be, and there are fewer entries overall with scores of 90+. Hopefully the algorithm separates the wheat from the chaff well enough to merit this change.

Enjoy! If you do anything cool with this data, I’d love to hear about it.

July 1, 2013
by Alex
1 Comment

More on ranking Wikipedia pages

I’m updating the Wikipedia Regex Search, creating a new ranked list of Wikipedia pages, and I have some thoughts:

  1. Thanks to an excellent comment from Jim Kingdon, I tried including some redirects in the new results. But even excluding all the redirects marked as “bad” isn’t enough. There are so many redirects not marked as anything and it’s impossible to differentiate between them for scoring purposes. There’s lot of junk in there, and even for the stuff that’s not junk – how do you score it? “Mr. October” is a redirect (to Reggie Jackson, of course). Do I give it the same score as Reggie? It only has 1 inlink, do I give it a terrible score because of that? I suppose I could take an average, but the problem of the junk remains. I’ll have to table this indefinitely.
  2. Continue Reading →