Generating puzzles for a Four-by-Four Word Game

A few years ago, I made a crossword-like game wherein users fill out a 4×4 grid of letters to spell 8 words (4 across and 4 down): http://osric.com/chris/wordgame/

Four by Four word puzzle game

However, over the course of several days, I was able to develop only 20 puzzles by hand. Trying all the various combinations is clearly a task better suited to computers than humans. Such a grid has 16 slots, each of which can contain one of 26 letters–so there are 2616 total permutations to check. That’s about 43,000,000,000,000,000,000,000–which could take a very long time, even for a computer. One key to speeding things up is to ignore permutations that don’t contain words.
Continue reading Generating puzzles for a Four-by-Four Word Game

Creating a Javascript Game (LetterLock)

LetterLock - A Word Game
osric.com/letterlock

I recently created a simple word game using Javascript, which presented certain challenges. The game displays 3 random letters to the player, who must then attempt to create a dictionary word in as few moves as possible by shifting the letters up or down in the alphabet.

There were several programming decisions or challenges that came up during the game’s creation, for which I was able to apply some of the things I learned in my recent computer science classes.

Continue reading Creating a Javascript Game (LetterLock)

Testing for multiple versions of Internet Explorer

Only one version of Internet Explorer (IE) can exist on a single windows installation by default. I had previously used Multiple IE as a way of testing web pages on older versions of IE. This allows you to have IE3, IE4, IE5, IE5.5, and IE6 installed alongside your existing IE7 or IE8 install. You can even run them concurrently.
Internet Explorer Logo
I don’t test pages on anything earlier than IE6 anymore, but IE6 still accounts for more than 5% of my site traffic. Multiple IE basically helps me test both IE6 and IE8 from the same machine. However, there is still the IE7 gap, plus Multiple IE, which is no longer being updated or maintained, can produce some glitchy behavior.

It turns out, though, Microsoft offers some tools to help test their legacy browsers.
Continue reading Testing for multiple versions of Internet Explorer

Hunt the Wumpus

I am taking a course in discrete mathematics this semester, and the professor suggested we take a look at a game called Hunt the Wumpus.

Hunt the Wumpus was originally created in the 1970s, and unfortunately, most of the versions you can find on the web today are easier and less interesting that the original. The original eschewed a square grid for the game board and instead used a “squashed” dodecahedron, where each game space was one of the vertices.

It is also noteworthy for introducing the superbat, a feature of other games (including Zork) that followed Hunt the Wumpus, and for the humorous feedback (e.g. “ZAP–Superbat Snatch! Elsewhereville for you!”) that many of my favorite games adopted.

At any rate, I decided to recreate a version of the easier and less interesting grid-based game in Javascript:
Hunt the Wumpus

Online Advertisements and Statistical Analysis

Quite a few years ago, I was in the online advertising business. My team and I created banner ads to run alongside web site content, to entice viewers to click on ads and find out more about advertiser offers. We scheduled ads to run alongside specific content. We targeted ads towards users in specific geographic regions, thanks to a browser cookie that told us their ZIP code. And we constantly managed inventory.

Although we made animated ads, we avoided anything that blinked. There were no monkeys to punch.

Click-Through Rate (or Click-Thru Rate or CTR) was a key measurement of an ad’s success. Although at first we would sometimes see click CTRs between 1-2% (meaning that an ad was clicked between 10 and 20 out of every 1000 views, or impressions), as online advertising proliferated, and as our systems got better at filtering out false impressions and clicks from various robots, crawlers, and spiders, CTRs trended much lower: 0.25% suddenly looked good, and 0.10% was not uncommon in some cases. That’s 1 click for every 1000 impressions.

That’s why we were insanely interested in a blog post we found, now presumably lost to the ages, that ran a set of 6 banner ads, which varied only slightly, and analyzed the results to determine what aspects of the ads could improve CTRs. Did including the phrase “click here” really help? If the words “click here” were in blue and underlined, like a typical web link, would that improve the CTR?
Continue reading Online Advertisements and Statistical Analysis

Typography on the Web

In spite of my fondness for typography, I have always been fairly antagonistic towards web typography “solutions” like sIFR. Sure, it’s a better idea than using a GIF file for every headline, but is it really necessary?

I’m skeptical. What is it buying you, and at what cost? What’s the return on investment? Is it improving conversions, improving customer/reader loyalty?

To me, content is king. I’ve visited, bookmarked, and returned to many web sites that are no-frills black-text-on-a-white-background. I remember fondly the days of Gopher, shortly before the rise of the World-Wide Web: all information, and no waste.

Let’s say there are 3 kinds of people in the world:

  1. Graphic Designers
  2. Computer Programmers
  3. Everyone Else

Let’s look at these groups from the bottom-up:
Continue reading Typography on the Web

WordPress Security Tips

I attended the WordCamp Birmingham conference this past weekend to find out more about all things WordPress. WordPress is an open source blog engine/lightweight Content Management System (CMS) that has a huge community of users and developers, and an enormous repository of plugins to extend its functionality.

One of the presentations I attended, Mitch Canter‘s session on WordPress Security, had 6 good tips for making your WordPress-based site more secure:
Continue reading WordPress Security Tips

Mistakes I Made When Setting Up My WinXP/OSX Intel-Based Mac

I really like my little Intel-based (Core 2 Duo) Mac Mini. It has a small footprint, low power draw, and it has wifi (so I don’t need a Cat 5 cable snaking through my apartment). Surprisingly, after comparing it to other small-footprint systems with comparable specs, the Mac was about the same price and came with the added option of running OSX. I set it up as a dual-boot WinXP and OSX system so that I can continue to run all my Windows software, as well as checking out some of the nifty Mac software (like the night we sat around making humorous commercials for the Chevy Volt using Garage Band and iMovie).

Aside from just using Apple’s Boot Camp to select which OS I wanted to use the next time I started the computer, I also installed rEFIt, a boot-loader that will let me select which OS I want as I start the system, and VMWare Fusion, so that I can run WinXP from within OSX.

From my experience with with a dual-boot WinXP and Ubuntu Linux laptop, I wasn’t looking forward to sharing files between the 2 systems by setting up an antediluvian FAT32 partition. However, one of my friends recommended MacDrive, a program that allows Windows to read from and write to an HFS+ volume. Magic, right?

Everything was looking rosy, until I decided to be stingy and give Windows XP a 10 GB partition.
Continue reading Mistakes I Made When Setting Up My WinXP/OSX Intel-Based Mac

7 Ways Twitter is Like Cigarette Smoking

1. People who have never tried it don’t get it.
As far as I can tell, the naysayers have never tried Twitter. I’ve seen people complain about Twitter on Facebook, but a Facebook status update and a tweet are nearly the same: short snippets of information that you want to share.

The at-signs (@) and hashes (#) that have become ubiquitous on Twitter may be part of the problem. Although I feel that if you can decipher an emoticon you ought to be able to handle @replies and #hashtags.

The difference?
A tweet is public if your Twitter timeline is public. (A timeline is akin to your wall on Facebook.) This is probably one reason why marketers love it: they get to push links out to the world, including search engines, whereas on Facebook you actually have to work to build an audience. (More on Facebook later.)

2. It’s addictive.
Clearly, it can be. Maybe not to the same extent as nicotine, but some people can’t stay off Twitter. People complain about how many breaks smokers take. Sick of your friends leaving you alone at a party while they compose a tweet? Annoyed that they ignore you to check the latest on their Blackberries? Tired of your co-workers taking tweet breaks? Which leads to…

3. It interrupts you.
Cravings for cigarettes driving you to distraction? Twitter can drive you insane. I quickly disabled updates on my phone, because I would have exceeded my 400 monthly SMS messages in the span of a few days. I installed twhirl, and later TweetDeck, and found that I was getting notifications almost every minute. That’s no way to work. I changed my TweetDeck settings to check for updates every 40 minutes. I may find out about the latest celebrity death 10 minutes after you do, but I still have some semblance of mental focus.

4. Users love to talk about it
Smokers love to talk about smoking. What brand you smoke, the way you hold your cigarettes, whether or not you prefer hard-packs or soft-packs, whether or not you pack your cigarettes before you open them–these are the sorts of conversations people have on their smoke breaks. My friend Brady cited all the unnecessary talking about smoking as a top reason to quit smoking.

Twitterers love to talk about Twitter. People are in love with Twitter right now, and they aren’t afraid to shout it from the rooftops. Which apps they use, who they follow, how it can turn their struggling companies into a giants. Even I am guilty of this: about a quarter of my tweets reference Twitter. I imagine this may fade over time, along with the accompanying backlash. After all, remember blowthedotoutyourass.com?

5. You do it more when you’re drinking.
…and that’s not a good thing.

6. Short and unsatisfying.
Oscar Wilde wrote, “A cigarette is the perfect type of a perfect pleasure. It is exquisite, and it leaves one unsatisfied.” I’ve seen people pack a lot of info into a mere 140 characters, but sometimes 140 characters just isn’t enough. That is why more than half of the tweets I am perusing right now contain shortened links from sites like bit.ly, short.to, ff.im, and tr.im.

[I actually really dislike shortened links, because they remove a critical piece of info–the destination URL–from the link. If someone posts a link with little-to-no explanation, I will not click on it for two reasons: one, there’s no incentive, two, it could be spam or lead to a malicious web site.]

7. It’s bad for your health.
OK, I admit it: that’s a weak link. Just don’t tweet while driving, OK? But just as smokers often pass on exercise, Twitter may cause people or companies to scrimp on more important things, like phone calls, face-to-face conversations, making good products, or even updating Facebook. Time spent on Twitter is time not spent on something else.

(That’s right, I said Facebook. As I mentioned to a friend recently, if Facebook stepped on Twitter, Facebook would hardly notice. Check out Facebook vs. Twitter on Compete.com. To which should you devote more time?)

Afterthoughts
I should note that I have been tobacco-free for years and would never advocate tobacco use. On the other hand, I think with some caveats, Twitter can be fun, useful, and relatively harmless.

I decided to capitalize Twitter in this post because it is a proper noun. I’ll respect bell hooks’ preference for lowercasing, but that’s where I decided to draw the line this time; I reserve the right to be inconsistent.

Additions?
Feel free to contribute your own comparisons in the comments!

Javascript insertAfter()

There is no Node.insertAfter() DOM function in Javascript, but it is clearly something that developers would like.

As the Gecko DOM Reference for Node.insertBefore() points out, this can easily be achieved with
parentDiv.insertBefore(nodeToInsert, nodeToInsertAfter.nextSibling);

If nodeToInsertAfter doesn’t have a next sibling, a NULL value will be returned and nodeToInsert will be inserted as the last child of parentDiv.

If you find it frustrating to type insertBefore when you want to insertAfter, that’s OK: you can add that function to the Object object:
Object.prototype.insertAfter = function (newNode) { this.parentNode.insertBefore(newNode, this.nextSibling); }

Now you can type:
nodeToInsertAfter.insertAfter(nodeToInsert)