Posts Tagged ‘Geek’

LEGO Link Sprite

Friday, August 19th, 2011
It's Link. The 8-bit sprite from The Legend of Zelda. In LEGO.

LEGO Link. The stand was the hardest part.

The other day at work I was waiting for build after build and deployment after deployment and got a little bit bored, so I used some spare LEGOs to build this, a mosaic of the sprite from the original 8-bit Legend Of Zelda. Then I got back to work and MEGA-CODED. I swear I actually work at work.

How to Win (Or Maybe Not) on Wheel of Fortune

Wednesday, August 19th, 2009

Wheel! Of! Fortune!One nice thing about being a programmer is that you can automate certain calculations that you’d have to be crazy to attempt any other way. While some would see a non-programmer attempting to figure out some of this stuff as borderline insane, we coders just come across as eccentric with a lot of time on our hands. If people ask a question fairly frequently, and said question involves lots of number-crunching, you can bet some coder somewhere has taken a crack at trying to crunch those numbers.

Case in point: Wheel of Fortune. Now, I’ve never really been a huge fan of the show, but I see it a lot anyway. It’s on after Jeopardy!, which I really do enjoy and try to watch fairly frequently, so I’ve seen my fair share of episodes of Wheel. One thing that always got me was the final puzzle. For those of you who don’t know, this is how it works: the winning contestant from all the previous rounds must solve a shorter, harder puzzle by himself in a small span of time. He is given a (usually unhelpful) hint in the form a category, and some of the most common letters in the English language (R, S, T, L, N, and E) are already shown. Then the contestant must choose three more consonants and one more vowel. If any of these letters occur in the puzzle Vanna White shows them, and the players has ten seconds to guess what the word or phrase is.

There are other factors at play here, but they don’t relate to what I’m interested in most, namely: What are the best letters to pick? Can we do an analysis of the letter frequency of a whole bunch of these puzzles? Can we determine whether or not the producers of the show pay attention to these frequencies? Thanks to the Internet and some spare time in the hands of a programmer, the answer is a (qualified) yes, we can. Please note that while I do enjoy math, I am most certainly not a mathematician, so this is just an armchair analysis, and not a scholar’s take.

First, I needed a set of data. As interested as I was in determining the letter frequencies, I wasn’t about to spend six months collecting data by actually watching the end of each show. I have the Internet to do that sort of stuff for me! In this case, I found this forum, whose residents had already done the hard work. I was able to grab the final puzzles from a couple of threads on this site, and store them in some text files, one puzzle to a line. Then, I wrote a short Python script to parse through the results and generate links to a Google Charts representation of the data. If you’re going to screw around on the Internet, why waste time inputting data into Excel?

The Code

Below is the code. Please note that while I have commented it, it’s task-oriented code. I did not sit down and think things through for hours on end; I was more interested in the results produced by the code than the process of making it. To that end it may be a bit rough around the edges. If you’re a Python programmer you might even think it un-Pythonic.

Show/Hide Source Code

from operator import itemgetter # for sorting
import sys # for command-line arguments
 
# makes sorting dictionaries prettier
def sortDictionary (s):
    return sorted(s.items(), key = itemgetter(1), reverse = True)
 
hexColors = ["F05DCF", "F4B213", "7BB5FE", "19B915",
       "C913E4", "E38080", "4891EB", "DCF725", "E02EB0",
       "EE7D18", "16D949", "73E0C9", "22F1DB", "1460A1",
       "CF8040", "FFFFFF", "CF8054", "204E00", "2B1160",
       "87513C", "DECEE9", "C913E4", "83B892", "597D4C",
       "DACA5D", "2F486B", "D79E17", "826889", "359DA1",
       "DE7A43", "568C51", "FBF786"]
 
 
if __name__ == "__main__":
    # set up command line arguments
    # thumb:   creates a smaller file, with shorter (or no, depending on letter count) labels
    # verbose: prints out each list of letters and frequencies, too
 
    if (len(sys.argv) < 2 or len(sys.argv) > 4):
        print "Usage: wof.py [filename] [t|f] [v]"
        exit()
 
    thumb = False
    verbose = False
    fileName = sys.argv[1]
    if len(sys.argv) > 2 and sys.argv[2].lower() == "t":
        thumb = True
    if len(sys.argv) > 3 and sys.argv[3].lower() == "v":
        verbose = True
 
 
    # set up lists of letters
    letters = ["a", "b", "c", "d", "e", "f", "g", "h",
               "i", "j", "k", "l", "m", "n", "o", "p",
               "q", "r", "s", "t", "u", "v", "w", "x",
               "y", "z"]
    consonants = ["b", "c", "d", "f", "g", "h",
                "j", "k", "l", "m", "n", "p",
               "q", "r", "s", "t", "v", "w", "x",
               "y", "z"]
    vowels = ["a", "e", "i", "o", "u"]
 
    # letters to exclude (already given to you on game show)
    already = ["r", "s", "t", "l", "n", "e"]
 
 
    # set up frequency dictionaries {leter : number of occurences}
    allFrequencies = dict((letter, 0) for letter in letters)
    vowelFrequencies = dict((letter, 0) for letter in vowels)
    consonantFrequencies = dict((letter, 0) for letter in consonants);
 
    # Read the data file. Should consist of one final puzzle
    # solution per line, optionally lines can start with "#" for a comment
    file = open(fileName)
    while True:
        line = file.readline()
        if not line: break #end of loop
        if line[0] == "#": continue # skip comments
        for letter in line:
            lower = letter.lower()
            if lower in allFrequencies:
                allFrequencies[lower] = allFrequencies[lower] + 1
            if lower in already: # exclude RSTLNE from vowels and consonants
                break
            if lower in vowelFrequencies:
                vowelFrequencies[lower] = vowelFrequencies[lower] + 1
            if lower in consonantFrequencies:
                consonantFrequencies[lower] = consonantFrequencies[lower] + 1
 
    #sort dictionaries
    allFrequencies = sortDictionary(allFrequencies);
    vowelFrequencies = sortDictionary(vowelFrequencies);
    consonantFrequencies = sortDictionary(consonantFrequencies);
 
    if verbose:
        #display the lists
        print "ALL:\n", allFrequencies
        print "\nVOWELS:\n", vowelFrequencies
        print "\nCONSONANTS:\n", consonantFrequencies
 
 
    charts = {"All+Letters" : allFrequencies, "Vowels" : vowelFrequencies,
             "Consonants" : consonantFrequencies}
 
    for chart in charts:
        # make the image URLs, using Google Charts
        if thumb:
            url = "http://chart.apis.google.com/chart?chs=100x100&cht=p"
        else:
            url = "http://chart.apis.google.com/chart?chs=400x300&cht=p"
 
        # build lists for data series and its labels
        labels = []
        data = []
        for entry in charts[chart]:
            if int(entry[1]) > 0: # exclude any letters not used
                # make sure a thumbnail doesn't have too many labels to clutter it
                if thumb and len(charts[chart]) <= 6:
                    labels.append(entry[0].upper())
                else:
                    labels.append(entry[0].upper() + "+(" + str(entry[1]) + ")")
                data.append(str(entry[1]))
 
        # set them to the query string parts for data and labels
        dataRange = "&chd=t:" + ",".join(data);
        if (thumb and len(charts[chart]) >= 6):
            labelRange = ""
        else:
            labelRange = "&chl=" + "|".join(labels);
 
 
        # build the array of chart colors
        chartColors = "&chco=" + ",".join(hexColors[0:len(charts[chart])-2])
 
        # build final URL
        url = url + dataRange + labelRange + "&" + chartColors + "&chtt=" + chart;
        print "\n", chart, "\n", url

The Results

Might as well show off the pretty, pretty pictures, huh? Click any graph below to enlarge it.

At first look, the data is not too promising. I can give you two letters that will increase your chances of getting a ‘hit’, and one of them might come in handy. In our six months’ worth of data, O is the favorite… but not by much. Looking at both periods, it seems pretty clear that somebody at Merv Griffin Productions is responsible for distributing the vowels O, I, and A across the spectrum so none of them shows up too frequently. Notice how I and O are tied on the most recent set of data, but A is the second-most frequent vowel on the older figures. Combining all the numbers, we see that these three vowels are essentially tied in frequency, with U in a slightly lower class. But at least it’s something to work with, right? From the last six months of Wheel, it looks like ‘O’ is the best vowel to go with.

Now what about consonants? I was most excited when I pulled up the 2009 consonants graph (the first one I did), because you can clearly see that the top two letters are definitely a bit more common than the rest, and even the top three look pretty solid. H, G, and D… could those be the winning ones? My excitement faded, however, as I ran the earlier set of data through the script. Looking at the combined chart, H still has a statistically significant lead. But you’ll have no luck trying to discover the three letters to choose. But we can limit our options a little. F, G, and B are all clearly separated from the next letter (D) in the combined graph, with a decent-sized gap between them. It’s harder to say for certain, but it looks like the producers may be balancing these top four letters throughout their puzzles.

So, what to go with? You should definitely choose O for your vowel. H is the consonants which statistically is most likely to occur. Then any of F, G, and B would probably do you some good.

And how about those shifty producers? Are they gaming the final answers, so they don’t have to give out as much prize money? Are they maybe picking and choosing their phrases to deflect somebody who did a little research before heading down to the studio to play? Well, let’s try to find a pattern in the frequency of letters in the English language (please note that I’ve removed RSTLNE from these graphs):

Right away you should notice some major discrepancies between the Wheel of Fortune data set and written English. While H shows up at the top where we’d expect, D is clearly in a much higher class than B, F, and G that we picked above. In fact, F and G aren’t even in the top five, and other letters that show up often in English aren’t placed very high in the combined final puzzle data. This is probably the result of producers fine-tuning their answers over the years, either to avoid the letters contestants chose most often or to more evenly distribute the winning ones.

This is such a small data set, however, that we shouldn’t rely on it too heavily. After all, Wheel of Fortune has been on the air for twenty-six years, and we only have half a year’s worth of data, or around 2% of all that is available. But a small attempt at analyzing this data is probably better than going in blind and picking letters that you ‘think’ show up frequently.

There are other ways that this quick-and-dirty analysis can be improved. Mine is a pretty naive approach. Going over some basic rules of English might help to improve the method. For example, breaking the final puzzles down into phonemes could yield more information, as might looking at letter pairs instead of single letters. For instance, Q never occurs without U, and some letters are more common after others. This is especially useful in our task, as we need to choose three consonants but only one vowel. Consonants are most often followed by vowels, so consonant pairs increase the uniqueness of a phrase. P is often followed by R, L, or H, for example. Looking for patterns in the words themselves might also yield better predictions about what letters would be better to guess.

Another thing to realize is that these numbers are averages from a discrete set. Some puzzles might include the high-frequency letters and be solvable with only those (and RSTLNE), while some might not include a single one of the high-frequency picks. Picking from one of the high scorers might improve your odds of getting more letters, but it doesn’t guarantee that you’ll get some, or even any. You might wind up with something like ‘Blind Luck’, which doesn’t contain an O or an H. These estimates can help you, but only so much.

So, after all these calculations, I now know what I would do if I ever found myself in Wheel’s final round. I’d go for H, G, and B (G and B having been arbitrarily picked over F), and then O as my vowel. And maybe I’d win big. Of course, the biggest factor in all this is your ability to manipulate letters and words in your mind. That’s one subject in which I lack skill, as evinced by the Boggle-solving program I wrote (a story for another time). So I might tank, even if my statistically-chosen letters filled out quite a bit of the puzzle. A lot of it does come down to luck, which was probably the producers’ intention all along.

Nerd Score

Sunday, November 5th, 2006

I am nerdier than 93% of all people. Are you nerdier? Click here to find out!

I don’t know whether or not to be proud of this…

Star Wars Costume

Thursday, May 19th, 2005


For this film, I decided to splurge and dress up. I found some instructions and got underway.

First, the Lightsabre. $7.00 at K-Mart.

Next, the costume. Unfortunately, because I picked the priciest place in town, I paid about $40 for all the cloth.

A white T-shirt underneath and a brown pair of paints completed the look. I think it turned out really relly.

C.C. is sporting his Sith costume — my black jacket, black pants, and a black T-shirt. He already had the Darth Maul lightsabre.

Special thanks to Mom and to Maggie for helping with the sewing.

Rocky Horror is On

Tuesday, April 5th, 2005

How do I constantly find opportunities to wear women’s clothing? Last year for my Acting II class I played a queen (a medieval queen, smartass), replete with gigantic prom dress, huge high heels, and a tiny tiara. And last summer, I got conned into playing Dr. Frankenfurter in a local cast show of The Rocky Horror Picture Show. This, obviously, was a step up (or down), as I was now wearing women’s underwear, as well. And a corsette. And pearls.

And now I’m doing it again. The show will be on May 14th, the day after the last day of finals week. Most of the original cast (at least, the major players — Brad, Janet, and Eddie/Dr. Scott) will be returning as well. We’ll get seven weeks to practice, instead of one. It should be fun.

More details will be appearing as I get them. Maybe even some pictures and crap.

Me The Woman

Wednesday, June 30th, 2004

Current Listening NOFX – “The Decline” (The Decline)

I wish I had a schilling, / For every senseless killing, I’d buy a government. / America’s for sale / And you can get a good deal on it / And make a healthy profit

Somebody mistook me for a woman today. Someone called, asking for my dad, “Steve Short.” I said he wasn’t home, and they asked if I were “Mrs. Short.” Now, last time I checked, I had gone through puberty and my voice sounds like a man’s, at least enough like a man’s for the raging sissy-boy I am.

Of course, this isn’t the first time this has happened:

It all adds up…we feel 16% certain that you are…
A Woman!
Compared to others…


70% more male than you6% like you24% more female than you

TheSpark tells me that I’m a woman; in fact, there are only 24% of people who’ve taken this test who are more womanly than me. This means that either 1. an army of short-haired, boot-wearing, man-hating she-males has taken the test or 2. I am a nancy boy. I tend to agree with the second conclusion, mainly because I’m sure that valley girl, makeup-ensconsed, prissy teen queens use TheSpark. And me.

So, in order to combat my unmanliness, I have come up with this six-point plan to combat my sissiness:

1. Watch More Sporting Events

Since I was a child, I have been horribly deficient in the watching-other-people-have-fun category. To my knowledge, there 156070 x108 activities I would rather do than watching sports. Call me crazy, but I find nothing entertaining about a bunch of grown men running around in tight clothes and tackling each other. Sexy, maybe, but not entertaining.

2. Stop Asking Directions

I know this is a stereotype, but I’m not taking any chances. From now on, I will pick a direction and keep driving that way, never giving up or admitting I’m wrong or lost, no matter what, even if I’m going to New Mexico and I can see penguins out the window.

3. Start Eating Meat

I’ll level with you all. I stopped eating meat to get chicks. It’s a great conversation starter! But it’s just not manly. especially here in Montana, where everybody, even the girls, hunt and kill deer.

4. Start Working on Cars

This might be difficult, because I don’t have a car of my own and I’m terrified to touch my parents’ cars. So I figure I can start working on other peoples’ cars — people I don’t evne know. I’ll be like the car fairy, flitting from hood to hood, initially damaging the cars I tinker with but eventually being able to do some sort of repair, until I get shot.

5. Start using the word ‘fag’

Nothing shows how manly I am more than throwing hateful phrases at others because of my own deeply-hidden homosexual tendencies!

6. Start grabbing the breasts of random women

I’m really looking forward to this one.

7. Build Things

The only things I’ve ever built involve Legos. I want to be able to create monstrocities, things that can destroy major metropolitan areas.

And, most important of all:

8. Stop Writing in a Blog

I mean, c’,mon!!! It’s basically a diary, right?

PS — Dear diary! Today I ran into Judy Armstrong, and she is SOOOOO HAWT!!!1!!!onehundredeleven!1!!1 I hope she asks me out, but I just can’t wait… I’m sooo sad!!! LOLOLOLOL!!!

Calling All Sperm Donors

Monday, June 28th, 2004

Current Listening: Bad Religion – “Billy” (No Control)
“But Billy was a lunatic just barking at the moon / and his brain was totally wasted / He then exchanged his friends for a needle and a spoon / And threw his future away”

Someone has got to tell the people that this whole cellphone thing has gone too far. Someone besides me, because this blog routinely gets fewer readers than can be counted on two eyes. It’s intolerable! Everywhere I go, you see some boneheads yacking to their bonehead friends on the bonephone. Never about intelligent or particularly pertinent stuff, either. The only conversations I hear on cell phones I hear involve drinking or the actual act of talking on the cellphone. One time I was crossing the Oval at UM and I saw a girl talking to her friend on the phone. “I’m right over here, Stacy,” she said (I assume her name is Stacy), “can you see me waving?”

And these people play games on these damn things, and take pictures. They take pictures. With a phone. And some of them play MP3’s! Then there are the ringtones. I tell you what, nothing’s cooler than telling the world how downright emo you are when your girlfriend calls you to break up and your cellphone’s ringtone is set to play a song by Thursday or Thrice or Story of the Year.


The spermetozoa: Its only known enemy: the ten-minute “Goodbye, I wuv you! No I wuv you!” Boyfriend/Girlfriend valediction.”

But something soon might take care of these people. According to some study or other, cellphone use can cut a man’s sperm count up to 30%. Of course, all the phones the scientists looked at were Plutonium, but that’s beside the point. The point is that, finally, the gene responsible for the need to always have a phone on you may be weeded from the gene pool.

And I can finally be spared the indignity of telling someone I don’t have a cellphone and getting ‘that look.’ For years now I’ve felt like the kid in elemetary school whose family doesn’t ‘believe in’ TV. You know, the kid who ate worms and now is probably a running for Congress on a sinister party ticket, like the Green Party? That’s how I’ve felt. But not anymore! Now I can look down on cellphone-using males: “No, I don’t have a cellphone, but at least I can knock somebody up in the old-fashioned sense.”

Of course, this could be a good thing. Cellphones could be used as contraceptives! This is a double boon — the guy doesn’t get a girl pregnant, and if somebody calls at the right time and the ringer is set to vibrate, the guy won’t have to do as much work!

Shit. Looks like not having a cellphone has screwed me over. Again.

Update

Sunday, March 2nd, 2003

Wow, this weekend went quickly. We didn’t practice, so we might not play on Friday. I’ll try to get down to the valley sometime during the week to practice; if that happens then we’ll play. I really want to play this show, so I hope we can practice once this week.

I went to John’s for the Geek-fest. Star Trek, Video Games, and computers, oh my! The best part was the midnight excursion to Super 1 to pick up donuts. I didn’t get much sleep, though.