Posts tagged “geekiness”
Kip

While I’m at it: How to win at the Cracker Barrel peg game

Written by Kip on Wednesday, May 26, 2010 at 11:06 pm (EDT)
Tagged as:

In my last post I discussed the game of hangman, aided by an algorithmic analysis of the winningest words. A few months ago I did something similar with the peg game they have on the tables at Cracker Barrel.  The one where you have a triangle with 15 pegs, with one missing. You remove a peg by jumping over it. The goal is to leave only one peg remaining. I think I won the game the very first time I ever played it, and I don’t think I’ve won since then.

It occurred to me that the game would be easily solved with brute force, and after an hour or two of coding I had done so. However, I never went much farther than that. I had hoped to look for patterns or simple rules that lead to a victory, but never really got very far. But I decided to post what I have here just for the sake of doing so.

         0
       1   2
     3   4   5
   6   7   8   9
10  11  12  13  14

Given the above peg positions, there are four unique starting configurations: you can start with peg 0, 1, 3, or 4 removed. Any other position is a mirror and/or rotation of those four. So I looked at which starting positions were the most likely to win.

Peg 0: 29,760 ways to win of   568,630 games (5.23%)
Peg 1: 14,880 ways to win of   294,543 games (5.05%)
Peg 3: 85,258 ways to win of 1,149,568 games (7.42%)
Peg 4:  1,550 ways to win of   137,846 games (1.12%)

So the moral of the story is: start with a middle edge peg removed, not the traditional configuration of top peg removed. Beyond that, I got nuthin.

No Comments
Kip

How to win at hangman

Written by Kip on Saturday, May 22, 2010 at 11:24 am (EDT)
Tagged as:

Last week Stephanie and I were discussing the game of hangman. I commented that “rhythm” and “myth” are good words because the only vowel is y, and most people try to find the vowel first. I wondered what might be the best possible words.  When I remembered that I’m a programmer, I said “hey, I can write a program to figure this out!” And since I haven’t posted on this blog in quite a while, I thought I’d share.

I found a list of 58,112 words and got to work. I decided to first count the frequency of each letter in the word list.1 I figured that the probability that a letter would be guessed is approximately equal to the frequency of that letter in the language. This could be a bad assumption, but it’s all I had to work with. Then I computed a score for each word by averaging the frequency of each letter in the word. I don’t know that this is the best way of measuring the difficulty of the word, but it’s the best one I could come up with.

Here are the words with the lowest scores (and therefore the most difficult hangman words, according to my algorithm):

fuzz     1.28%
fuzzy    1.37%
buzz     1.39%
why      1.57%
by       1.79%
jazzy    1.95%
jazz     2.01%
huffy    2.02%
buff     2.03%
huff     2.10%
jug      2.17%
jumpy    2.18%
puffy    2.18%
my       2.20%
hubby    2.20%
muff     2.23%
jump     2.29%
puff     2.29%
buy      2.33%
foxy     2.36%

And here are the easiest:

see     10.55%
eerie   10.15%
ere     10.13%
nee     10.08%
sees    10.05%
tee     10.04%
ease     9.81%
eire     9.79%
seer     9.73%
seen     9.69%
eerier   9.67%
tees     9.67%
serene   9.60%
eases    9.56%
settee   9.54%
lessee   9.54%
eel      9.52%
seine    9.52%
seers    9.50%
eeriest  9.47%

While I was at it, I did some other searches on the word list.  Here are the 49 words that have no vowels besides Y:

by
cry
crypt
crypts
cyst
cysts
dry
dryly
fly
fry
glyph
glyphs
gym
gyms
gypsy
hymn
hymns
lymph
lynch
lynx
my
myrrh
myth
myths
nymph
nymphs
ply
pry
pygmy
rhythm
rhythms
shy
shyly
sky
sly
slyly
spry
spy
sty
styx
sylph
sylphs
sync
thy
try
why
whys
wry
wryly

Seventeen words contain all the vowels, including Y:

consequentially
counterrevolutionary
disadvantageously
facetiously
gregariously
heterosexuality
homosexuality
neurologically
neurotically
pertinaciously
precariously
precautionary
questionably
revolutionary
simultaneously
supersonically
tenaciously

And only two words contain all the vowels, including Y, in order:

abstemiously
facetiously

1 This is slightly different from the frequency of each letter in the English language. For example, “t”, “h”, and “e” probably have higher probabilities in the English language than in the word list, since “the” is used over and over in the language, but it is only represented once in the word list.
No Comments
Kip

Alerts

Written by Kip on Monday, October 26, 2009 at 9:32 am (EDT)
Tagged as:

I’ve been using Mint to track my money for a few months now.  Most of you reading this are cool people who have been using Mint since before I heard about it, though, so I won’t bother explaining how the service works.  I guess I’m supposed to set up budgets or something, and if you don’t it kinda guesses based on your past expenses.  Then it alerts you when you go over-budget in a category.  Which is nice sometimes, but other times you get things like this:

Alert from Mint.com: “In the past 30 days, you spent $359.49 on Taxes. Usually you spend $23.”

Okay, so ummm... what am I supposed to do about it?  If I could have payed only twenty-three dollars I would have.  Maybe they need an “e-mail a complaint about this to your congressman” button or something? :)

Kip

Everybody Votes... To watch movies out of order?

Written by Kip on Saturday, October 3, 2009 at 8:15 pm (EDT)
Tagged as:

Every so often, the popular answer on an Everybody Votes1 poll surprises me.  Here is one example from a few weeks ago:

Everybody Votes poll asking “What order should everyone watch the Star Wars franchise?”  The responses are: I, II, III, IV, V, VI: 60.8%, IV, V, VI, I, II, III: 39.2%.  Stephanie and I both picked and predicted IV, V, VI, I, II, III.

Is this really what the majority of people think about how a series with prequels should be viewed?  I imagine there is some portion of the population that didn’t understand the question and thought “well I don’t know anything about Star Wars but why would you watch them out of order”, and chose the “I, II, III, IV, V, VI” answer—inadvertently choosing the “watch them out of order” answer!  But as popular as Star Wars is, I doubt this could account for that many people.  The question also doesn’t specify whether the numbers correspond to episodes, which could have confused some people.

If this is really what most people think, though, then I guess that would explain why the The Chronicles Of Narnia compilations inevitably feature the books out of order, with The Magician’s Nephew first (even though it ruins the book to read it first!).  But I can’t imagine, for example, a compilation of the Metal Gear Solid games featuring Metal Gear Solid 3 as the first game, even though the MGS3 story takes place thirty years before the others, and the MGS4 story picks up right where MGS2 left off.  Of course I said the same thing about the Star Wars movies last year, when I was talking about the Narnia books....

I don’t know, maybe I’m wrong.  It happens sometimes.  Anyone care to weigh in with a good reason why someone approaching a series of movies/books/video games/whatever would want to start with the prequels first?  Or maybe you want to weigh in to tell me you agree with me.  That’d be cool too.

PS: I think another problem with the question is that neither answer was the correct answer.  The correct answer is “IV, V, VI, II, III.”  Episode One is unwatchable garbage.  Two and Three are just garbage, but they aren’t unwatchable.  Episode Five is still the best.

1 For those of you not familiar with Everyboy Votes: it is a free app on the Wii that lets you vote in polls (three a week I think), and you also predict the results.
Kip

A Turing Test

Written by Kip on Thursday, July 2, 2009 at 11:21 pm (EDT)
Tagged as:

I think I just participated in a Turing test.  I had a problem ordering a new cell phone from Sprint, so I did an online chat with a customer service representative.  They said they would e-mail me a transcript, but they haven’t yet.  Since the chat was in a Flash object, I couldn’t select the text to copy and paste it, so I just combined two screenshots, and added some annotations.1

annotated chat transcript

1 I suppose I could have used OCR to get it into text format, but I didn’t feel like it.
No Comments
Kip

I’m tweeting

Written by Kip on Thursday, April 16, 2009 at 10:07 am (EDT)
Tagged as:

I’m now tweeting.  You can follow kipthegreat on Twitter if you want to see what I’m up to.  So far I haven’t done much tweeting.  It just seems weird to use Twitter when I don’t have a Blackberry or iPhone.  Or maybe I just don’t get it yet.  I mainly signed up because my screen name was still available. :)

Kip

Free code giveaway

Written by Kip on Saturday, March 21, 2009 at 11:26 pm (EDT)
Tagged as:

I added some code to the site to improve the way source code is displayed, both in snippets in my blog and when viewing an entire file directly.  I’m adding line numbers on the server-side, but they are in a separate div so you won’t end up copying the line numbers if you copy and paste the code.  The syntax highlighting is all done in Javascript by prettify, an open-source library provided by Google.  After getting around two annoying jQuery bugs (one which is only present on IE6, and another which was fixed by upgrading to the latest jQuery level) I got it up and running, and it looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
  /**
   * Returns 1/this.
   * 
   * @throws ArithemeticException if this == 0.
   */
  public BigFraction reciprocal()
  {
    if(numerator.equals(BigInteger.ZERO))
      throw new ArithmeticException("Divide by zero: reciprocal of zero.");
    
    return new BigFraction(denominator, numerator, true);
  }

Anyway, I figured I’d show off the full-file view with some source code you’re free to use if you want to.  You can find the BigFraction class I wrote in Java when working on some Project Euler problems.  The class represents a fraction as a ratio of two BigIntegers, so it will never overflow, and there will never be roundoff error.  It was fun to write, because it involved lots of math and manipulation of base-2 numbers (especially for the constructors which took one or two double variables), and I’m one of those weirdos who really likes those things.  This works in all the Project Euler problems I’ve used it in, and I’ve done some pretty exhaustive ad-hoc testing, but there’s still a good chance I’ve missed a bug or two.  Especially since I didn’t bother writing any unit tests or anything (hey, this is spare-time coding!).  If you use this and happen to find any bugs, let me know.  And of course, I need to close with:

Disclaimer: the BigFraction class is provided as-is with no warranty expressed or implied.  If you use it to calculate missile trajectories and end up nuking the wrong city, you shouldn’t come whining to me.

No Comments | Add Comment
Kip

Guitar Hero-playing robot

Written by Kip on Monday, November 24, 2008 at 11:15 pm (EST)
Tagged as:

This is awesome.

That is all.

No Comments
Kip

A quick announcement

Written by Kip on Thursday, November 20, 2008 at 2:29 pm (EST)
Tagged as:

I experimented with using Feedburner to manage the feeds for this site, but I haven’t been pleased with the statistics they provide.  They seem to be inaccurate, and I think the problem is that Feedburner is geared towards sites much larger than mine.  So I’ve decided to revert to hosting my own feeds.

So.  If you subscribed to a feed from this site in the last three months, you may need to resubscribe sometime next week in order to keep getting updates.  If you’re not sure which feed you’re subscribed to, you should start getting notifications sometime next week that the feed is dead (if you’re subscribed to the Feedburner feed).  If you don’t get any notifications, and you keep getting my blog posts, then you don’t need to do anything.

If you have no idea what I’m talking about then none of this applies to you.

No Comments
Kip

Re: special characters

Written by Kip on Wednesday, August 27, 2008 at 12:20 am (EDT)
Tagged as:

I found it very ironic the way the title of my last post was displayed after being imported into Facebook:

Screenshot of my last post imported to Facebook, rendering the title as “What’s wrong with special characters?”

No Comments
RSS feeds: Kip's - Stephanie's - Both
Admin