Monday, July 22, 2013

How many ways can you cross a game board?

Let's say you're on the top right corner of a chess board, and you want to cross to the bottom right corner.  You've discovered a new chess piece that can only move right or down each move.  How many different ways are there to get from the top right to the bottom left?


Well, let's look at a few obvious solutions:
You could go all the way to the right border, then down:
RRRRRRRDDDDDDD

You could go all the way down then right across the bottom border:
DDDDDDDRRRRRRR

You could go stair-shaped:
DRDRDRDRDRDRDR

But because you can't go up or right, every solution is 14 steps long, and every solution is just a reordering of seven Down moves and seven Right moves.

So naively, the solution is 14! : 14 moves, in any order. The problem with that solution is, you can't tell down-number-three from down-number-six.

So, to take out the different (equivalent) ways you could order the downs, you get:
14! / 7!

Then to take out the equivalent ways you can order the rights, you get:
14! / 7! / 7!

The solution holds for any board size greater than 1x1:
(width - 1 + height - 1)! / (width - 1)! / (height - 1)!

Friday, April 12, 2013

What's the straight dope on the I before E rule?

So I was minding my own business on Pinterest the other night (I read it for the articles?) and came across this monstrosity.


And... I was hooked. It can't be that I memorized a rule that actually does more harm than good, right? So, I got all nerdy on it.

I've written a game about regular expressions and a lot of the levels end up being word games. (e.g., match all the words that start with pre, like present, but don't match words that contain pre like unpredictable)

Writing the game, I needed a copy of all the dictionary words that I could mess with on the command line. I use the Ispell list from this list of wordlists. That breaks up the whole language into a set of files, both general English (cromulent in America and England and Australia), things only acceptable within dialects, and generally hints at use frequency (e.g, cat and the are in a different file than amidship.) So the most common use, globally acceptable file is english.0

Let's use regular expressions to test the rule.

Words that follow the rule: I before E, except after C: (like piece)
$ egrep "[^c]ie" english.0 |wc -l
    1867
Words that follow the rule: I before E, except after C: (like inconceivable)
$ egrep "cei" english.0 |wc -l
    62

Words that break the rule by having I before E after C: (like science)
$ egrep "cie" english.0 |wc -l
     116
Words that break the rule: E before I and no C around: (like "feisty heist on a weird beige foreign neighbor")
$ egrep "[^c]ei" english.0 |wc -l     
     250

What have we learned?

Jeremy is a lunatic.

OK, but really, the base of the rule is sound: when it doubt, i before e is is right 1867 times out of 2194 (in base, international English), or 85% of the time. I like those odds.

The problem is, the extension everyone remembers, "except after C" sucks. There are 327 exceptional words (including weird and inconceivable) but "after C" only accounts for 20% of the exceptions.

So, the hell with it. Let's have a laugh with Brian Regan, instead.

Wednesday, April 11, 2012

How to replace your PC's power button with an arcade pushbutton

I'm building an arcade cabinet using the fantastic kit from North Coast Custom Arcades.  When it's done, the PC at the heart of the project will be entombed in a classy wood enclosure.  Now I need a way to turn the PC on and off, without unscrewing the wood cabinet, that maintains the general look and feel of the rest of the project.

So I've replaced the PC's power button and status light with this very nice chrome-accented, back-lit button.  And frankly, if I can do it, so can you.

What you'll need:
  1. A cheap tower PC.  I have no idea how I'd do this with a laptop or compact desktop.
  2. A button.
  3. Some cables.  I happened to have the Extension Harness Pack from Ultimarc on hand, which is pre-terminated with exactly the lengths and connectors I needed. Or you could chop up the cable that's running to your old button and re-terminate it with these.
  4. The willingness to put a 1 1/8" hole in something.  I like my Forstner bit for that job.
OK, let's do this thing.

Unplug your PC and take it somewhere well lit.  Keep the AC unplugged until you're done poking the motherboard, please.  Tear the side and plastic front off your PC.  You'll end up with something like the picture below.  The black plastic cube on the right, below the DVD, is the mechanism behind the shiny power button facade.  That's what we're replacing.

Use a camera phone to peek around inside the PC, behind the old button.  In person, it was obvious that the red and black cables are for the button, and the blue and green cables are for the power LED.  The yellow and white cables are for the hard drive indicator, which I'm now living without.

 Now follow the bundle of cables from this mechanism to the motherboard, and make note of what order they go in.  Here, it's green, blue, red, black.
Now unplug this end from the motherboard, and remove the old button from the front of the PC.  (Mine just snapped on.)  If you're reusing this cable harness, now's the time to chop off the old button and add those female QD terminations.  If you're using the Ultimarc wires, throw this bundle away.
 Now, take your button apart.  The whole switch-and-LED assembly turns a few degrees then slides out of the chrome jacket to make this easier on you.  The switch mechanism is the big black box, wire black to COM (the bottom connector) and wire red to NO ("normally open," the next connector) and leave the top connector alone.
 Now wire blue and green to the LED contacts on the sides.  I couldn't find any indication of the correct order, so I guessed.  If you get it wrong (button works, light doesn't) just unplug and swap, you won't hurt anything.
Now if you're using the Ultimarc wires, fit each wire directly onto the motherboard pins.  It's fiddly work, but if you're patient it's over quick.  If you cut and re-terminated the original wiring harness, good for you, your hard work on that step makes this step a breeze.
Time for a bench test!  Grab a monitor, and plug in your PC, then push on the teeny button alongside the LED shaft (next to my thumb here).  On my PC you have to hold it for a second, don't get antsy. 
That's what success looks like!  The fans warm up, the light comes on, and moments later the monitor fills with the lovely BIOS screen.

OK, now you can drill a 1 1/8 in hole in your cabinet (or use one of the pre-drilled button holes.  I wanted this out of the way, on the back near the floor) and mount the chrome body of the button. Then put your PC back in the cabinet, and snap the switch-and-LED assembly into the chrome button body.  Gorgeous!

Friday, July 8, 2011

How do IT pros learn, and do they have game?

I'm working on a start-up idea to make educational computer games for adult professionals.  I've worked in Information Technology for my whole career, so that seems like a natural topic to begin with.  IT professionals are necessarily computer savvy, and they'll be using these skills at a keyboard, so why not learn them there, too?

While talking to the various smart people in my life, I discovered that I didn't have hard data to defend some of my core assumptions about this business model:
  1. Do IT people really play video games, or is that just a stereotype?
  2. What would make a professional trust a video game as a teacher?
  3. How would games stack up against competing learning methods (e.g., books, classes, and the all-knowing Google)?
I've found some excellent research about what IT pros choose to learn, and the demographics of video gamers, and I'm deeply indebted to those sources.  So I've decided to share the fruits of my research, too.

You can download a spreadsheet of my results, but I'll call out some highlights here:

Who was surveyed?
I sent the survey out to 65 of my trusted LinkedIn colleagues, along with a personalized introduction.  I got 33 responses (which I consider a staggeringly great response rate).  I wasn't critically interested in typical demographic information (age, sex, location), but here's what I do know:  Everyone on this list does business in the US (with a concentration in California), in the Information Technology industry, and speaks fluent English.  14 of those invited were women, but I didn't ask gender in the survey, so I can only assume that about 20% of respondents are also female.  88% of respondents had been in the industry for more than 10 years.

I also posted the same survey on Hacker News.  That audience provided 31 additional responses, and added some more responses from students and junior-level professionals.  I don't have any demographic info on the Hacker News readership, but since it only contains English language articles and heavily covers Silicon Valley start-up culture, I'd guess it has similar makeup to my LinkedIn circle.

Interestingly, the two groups responded very similarly.  Unless otherwise noted, the percentages in the rest of the article are aggregate, although everything's broken out in the Excel file.

How do we learn?

In a word, pragmatically.  The two most preferred ways to learn a new skill were "on-the-job" (70%) and "Google it" (64%).  In a separate question, the most respondents (70%) answered that being able to "use what I learn immediately" was a key influence in what they choose to learn at all. 

Books (50%), in-person classes (36%) and following a course of study like a degree or certificate (30%) all received luke-warm responses in the face of shorter, more immediate approaches.

On-line classes (13%) were the least popular method of learning, and "recruiters are looking for it" (16%) was the least popular motivation.

Do we game?
Yes, we do!  72% of respondents play video and computer games regularly ("a few times a month" or more).   83% of respondents already have some experience with educational games.

What gets people to buy?
The largest purchase influencers were friends' recommendations (61%);  the availability of a free, playable demo (63%); and covering material the student was "already planning on learning" (63%).

And don't count out the fun!  64% of respondents choose what to learn based on fun, and 52% said even educational games have to look fun to close the sale.  The Hacker News group even prefers "fun to learn" (77%) over "can use immediately" (70%)!

What are they willing to pay? 
You could spin the data as "many people (45%) would be willing to spend $50 or more."  But you could also read the data as "no one believes that an educational game will be the dollar-value equivalent of an in-person class."    Based on some other poll data from my current employer (that I'm not at liberty to share, sorry) I think this is related to in-person classes being perceived as a prestige service.  I enjoyed the movie The Matrix a lot more than the opera Lucia di Lammermoor, but movie tickets are "mass market" and operas are "prestige"... so Opera San Jose got a lot more of my money than Keanu Reeves did.

What did I learn?

It looks like part of the path to success is making games that could be viral.  Friends' opinions were an important purchase influencer (the highest among people who received the survey through their LinkedIn social network), and even early adopters will be looking for a free, playable demo.  Having a way that players can brag about what they've learned, and a way for our trial to ride along on that tweet or wall post, looks like a great way to build a sales funnel.

It also looks like I'm better off producing games of modest scope and modest price; things you could buy on your lunch break and use what you learned that afternoon.  Larger courses could be broken into individually sold "episodes," which is increasingly common in video games.

What do I wish I'd asked?

I'm surprised that so few people were motivated to learn a new skill to improve their appearance to recruiters (Q3).  When I only had the LinkedIn batch of responses, I assumed it was because that group had lots of experience and a proven contact network.  The Hacker News crowd has (on average) less experience; maybe they disdain recruiters because that audience has a strong entrepreneur/startup flavor to it?  This missed expectation rattles me so much, I'd actually like to find a third (even less experienced?) population to survey.

I wish I'd asked for details about people's experience with educational games.  Was it positive?  Was it recent?  Is an experience with Oregon Trail 20 years ago really going to help you decide how to spend your time and money as an adult?

I didn't ask, in question 7, whether people would be interested in a free (ad-supported) or freemium (e.g., Farmville) pricing models. I excluded these options intentionally; I don't think these games will ever attract enough players for those models to be profitable.  Still, given that the multiple-choice answers people picked for Q7 skewed so low, a morbid part of me wonders how much lower it would have gone, if given cheaper options.

Thursday, March 17, 2011

Mail Merge and the Dystopian Future

My wife was asked to be a bridesmaid at the wedding of our couple-friends, A and E.  She gets to throw the California edition of their bridal shower -- the cool coed one with all their west coast friends, instead of the "traditional" one with the mothers in the midwest.  Of course, throwing a party means sending invitations, and this shindig is just fancy enough to earn real paper invites.

Being proud owners of a computer, we figured mail merge in MS Office would be the best way to address the envelopes.  Labor saving devices, for the win!

It was then that I discovered: doing a mail merge is a sneak peek into the dystopian future.

For one thing, I think the home printer is the modern embodiment of the ancient nightmare of the Golem: a clay mannequin that hyper-literally follows directions even beyond it's creator's intent. It doesn't surprise me that a printer is short on self-knowledge; for $80 I don't exactly expect Caprica Six. Still, it seems like a 21st century gadget shouldn't eat my fancy stationery, apply self destructive force, or squirt ink all over its paper-handling surfaces.

The entire phenomenon of paper jams stems from the printer lacking the sensory organs to inform wiser decisions that its motors could already follow: back up, slow down, apply a little more friction.  I don't have a lot of perception of my inner workings, either, but I've got plenty of nerves in my fingertips, out where I do my work.

It gets scary when you apply this cautionary tale to dangerous robots.  Will self-driving cars be able to feel the tire shudder of an alignment problem?  The smell of burning oil?  The sight of smoke billowing from under the hood?  (On an unrelated note, does anyone want to buy my 1989 Mercedes 560SL?  Cheap!)  Doesn't my shredder find it a little suspicious when I fight back as it digests my tie?  I can hear the motor struggling to keep strangling me!

The second glimpse into the abyss came from the software half of the equation.  This isn't going to be a big party, we were only addressing 30ish envelopes.  Still, in that small pool of data, we had one person without an address, one significant other without a last name (who entertainingly printed as "Mr. Steve"), and two cases of hidden whitespace after first names.  A is actually a very conscientious and detail oriented person, so the three wasted envelopes aren't a reflection on her, they're typical of every database in my experience.  Data entry isn't fun or glamorous, and choosing tools like Excel that don't impose a structure on our data means that this happens all the time.

How will crummy data contribute to the end of the world?  Well, there's the ID making scene in Idiocracy.  The episode of King of the Hill where the bureaucrats mark Hank's license "Female."  The software bug that killed three people with radiation overdoses.  When imperfect people give imperfect data to overly confident machines, the machines can make bad decisions quickly, backed by hulking robot strength.

There you have it: This is the way the world ends
Not with a bang but a printer.

Sunday, October 3, 2010

The Worst Parts of Meatspace

Meatspace, noun. a term, originating from cyberpunk  fiction and culture, referring to the real (that is, not virtual) world, the world of flesh and blood.  ... The opposite of cyberspace.

In July, I caught a breathless article on CNN about a telepresence robot.  Imagine, if you will, being able to attend meetings and peer over your drones' shoulders, all without subjecting your bed-sore-covered carcass to sunlight.  It's $15,000 worth of technology that makes a Segway look like a wise and life-affirming investment. 

Your wage slaves get to interact with your wheeled robot stand-in through a tiny little screen, to enforce the message that being spoken to by this contraption is holding the muddy end of the stick.  As the power player, you're at home, dressed somewhere between Hugh Hefner and Howard Hughes, driving from a monitor bigger than their cube wall.

So, this manages to project both poor taste and intense disdain for those around you, like an indoor Hummer.  But I also thinks it solves a vast, interesting problem in a way that deftly preserves all the worst parts of physical reality in a shiny new digital shell.  The robot can't operate doors or stairs or even elevators.  When it joins a meeting at a normal conference room table, it has to swivel left and right to "see" who's talking.  The driver has to choose between steering it room-to-room throughout the day or making all the meetings come to him (which will kick off a territory-marking contest if ever two powerful honchos in the same company own robots).  A battery life of "up to 8 hours" also means your plastic servant is likely to need a pit stop in the middle of the day.

All of these problems were solved by video conferencing 20 years ago.  You update a room with a monster TV, a wall-mounted camera that can see everyone in the room, and plug the whole rig into the wall for power and network.  Time for the next meeting?  Hang up and call another room!

All hatin' aside, Anybots isn't the first company to just not get that they could be using digital technologies to solve meatspace problems instead of faithfully preserving them.  This appears to be the whole premise of Second Life.  Imagine how fun it would be if you had to walk from Amazon to Flickr!  Imagine clumsily steering your avatar into a meticulous recreation of a drab conference room, to watch a presentation blocked by the head of the guy in front of you, at a faithfully recreated slightly-to-one-side angle!  Oh, and can we import assholes, too?  You bet!  (Second Life defenders will note that now your Avatars can fly and teleport.  Keep going guys, you're a few patches away from being Star Trek Online.)

David Weinberger gets it.  Virtual stores are better than physical stores.  I can sort, I can filter, I can leap from cameras to chocolates without a 20 minute hoverchair ride around the Buy n Large.  Check out David's story about the big pile of clothes, start near the 15:00 mark if you're impatient. 


What about online classes?  On the one hand, I get to take them from the comfiest chair in my house (an overstuffed, closeout sale, C3PO-colored monstrosity), on a screen just the size/distance/font-size that I like, after putting on the baby's pyjamas (and my own).  On the other hand, I ask fewer questions, I don't grow my personal or professional network, and I don't get my knuckles rapped with a ruler when I doze off.  Maybe online classes take a good thing too far, maybe they need a little meatspace infusion.

Meatspace and cyberspace are different, no matter what you learned from Tron and Hackers.  Meatspace is really good for some things (hello, reproduction!) but don't think that everything in cyberspace should aspire to be like its older brother.  And if your product can be thwarted by a doorknob, you may not be solving the right problem.

Tuesday, August 3, 2010

Bounce Rate Sucks? Blame Journalism Class.

I love long blog posts.  Stevey's Blog Rants, Joel on Software, Paul Graham, I just eat them up.  I hope you do, too, but more likely you're one of the 88% of visitors who is going to read part of this then browse away never to return; in the web analytics biz, that's called my Bounce Rate.

Some curmudgeons will tell you that you're browsing away because you have a child-like attention span, growing ever more attenuated by Google and Hacker News and that newfangled Rock and Roll.  I'd like to give you a bit more credit than that.

I believe that you are a highly discerning informavore: knowledge is your prey, and you are merciless in its pursuit.  You don't browse away because you have a tiny magpie brain—you are locked on to the "information scent," and you will follow its lead until the Nature Channel-tastic end.

This is where the journalism lesson comes in.  Remember the Inverted Pyramid?  The concept is that you lead with the important part of your article because your reader may abandon you at any time—it's proof positive that people have had short attention spans for at least as long as there's been writing.  The basic Inverted Pyramid story goes something like this:

Thing you need to know.
Supporting material.
Cute anecdote.
Drivel. 

So here's my big idea, the one I would have put at the top if I hadn't slept through that J-class:  The Inverted Pyramid is actively driving away your users.  The further you read into an IP article, the weaker the information scent gets.  This probably mattered less in the heyday of newspapers, because the fastest way to get more information about a topic, assuming that you cared at all, was still to read the article in its entirety.  What else could you do, drive to the library?  Put on your weight lifting belt and crack the Encyclopedia Britannica?  Even if you were certain that better sources existed, the best value-for-effort was still to finish that article, diminishing returns and all.

On the web, everyone knows where to pick up the trail to better information the moment they lose the scent.  And maybe that's ok!  Let's face it, lots of blog posts contain just one good idea, which could have been stated succinctly.  Then its just the author typing because he likes that clicking sound.  Heck, plenty of blog posts contain zero ideas, just a link bait title followed by backpedaling, trolling, or fanboyism.  Your information senses are serving you well...

...until they aren't.  The dark side of this is that we're all building up habits that support the one-idea article.  When a really intricate idea needs to be transmitted, the author is likely to lead with the (not yet supported) core, and the reader is likely to expect that if that core doesn't make sense on first contact, it's all down hill from there.

I did wake up for the part of the class about "you need to tell 'em what you told 'em" so here's my formulaic conclusion:  The Inverted Pyramid is actively driving away your users (and maybe that's ok!).  If you've really got one clear idea, lead with it and people will leave when they get full, or when they think they're more likely to find the next big idea somewhere else.  If you've got something complicated to get across, you're better served with a format that feels as little like the Inverted Pyramid as possible so you can build the scaffolding before you drop your ton of knowledge.  Either way, your audience will thank you.