MATLAB Community

MATLAB, community & more

MATLAB, Sporcle, and Grant

Grant O. Cook III, better known to the Cody-playing world as goc3, is a player and puzzle constructor of great renown. He is currently ranked 5th on the Cody leaderboard, and he is 2nd when ranked by number of problems created (he’s made 121 so far). He recently distinguished himself as one of the authors of our 5th anniversary puzzles. You may recall that we’ve written about him before on this blog.

But his mad puzzle-making skills aren’t limited to Cody. He’s also a rock star on Sporcle. If you haven’t heard of Sporcle, I’m about to waste a bunch of your time by telling you about it. In fact, Sporcle’s explicit mission is this: “We actively and methodically search out new and innovative ways to prevent our users from getting any work done whatsoever.” Sporcle is a trivia quiz site with (and I looked this up on the internet, so I know it’s accurate) 25 bazillion quizzes on it. One of the things I like about Sporcle is that you can use it to learn useful things. For instance, when I was planning a trip to Ireland, I practiced with the quiz Counties of Ireland until I could rattle them off.

Well listen to this: our friend Grant has authored an eye-watering 1477 quizzes. And that’s only as of this writing. Follow the link and I’m sure you’ll find more. That works out to an average of 56 quizzes per month since he started. I believe he makes a couple between brushing and flossing his teeth.

How does he do it? What is his secret? Well, his real secret is that he’s talented and hard-working, but among his other secrets is MATLAB. That is to say, many of Grant’s puzzles are algorithmic variations on a theme, and MATLAB is used to do some of the algorithmic heavy lifting. I’ll give you an example. One of his more popular quiz styles is called Blind Secret Countries. Imagine a friend of yours is thinking of a country. You have to find it by wandering the globe as he says things like “You’re getting warmer” or “Now you’re freezing cold.” Only instead of globetrotting, you’re typing country names and seeing if they’re red (hot!) or blue (ice cold, baby!). Eventually, BANG! You name the secret country. But you don’t have much time, and you need to know your countries. It doesn’t do you any good if you know the secret country is somewhere in southern Africa, but you’ve never heard of Malawi.

To make this work, he needs to color every country in the world according to how close it is to the secret country. If your country is Bangladesh, you end up with something like the map shown above. As you can imagine, generating this image is quite involved. Here is Grant’s flow chart. Many of these blocks are managed with MATLAB code. Using this approach, he’s created 75 different blind secret country quizzes (so far).

I’ll close by describing another geography quiz type: Erase by Provinces. Let’s say you’re planning a trip to Kyrgyzstan. It will be valuable to learn the seven provinces (or, in your case, verify that you already know them). You’re shown an unlabeled map and prompted with the name “Ysyk-Köl.” Quick! Click on the corresponding province now! And keep going until you’ve labeled all seven provinces. Easy peasy!

I’m going to give you a hint of how you might get started making a puzzle called Erase by Departments for Benin. Grant gets his country outlines in the form of shape files from Global Administrative Areas. Download the data for Benin. Armed with the shaperead function from the Mapping Toolbox, look how easy mapping Benin is.

s = shaperead('BEN_adm1.shp');
colors = jet(length(s));
for n = 1:length(s)
    ix = ~isnan(s(n).X);
    patch(s(n).X(ix),s(n).Y(ix),colors(n,:))
    hold on
end
axis equal
box('on')
grid('on')
hold off
legend({s.NAME_1})
title('Departments of Benin')

To get to a quiz on Sporcle is a lot more work, but you can see how MATLAB can accelerate the process. Now you know, from Alibori to Zou, your Departments of Benin!

And you also know why Grant is one of the most popular puzzlers on both Cody and Sporcle.

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.