Monocles

My brothers have finished and launched their first totally independent game from our game company, Butterscotch Shenanigans. It’s called Towelfight 2: Monocle of Destiny. It is exactly as insane as the title suggests.

I had a lot of fun testing and watching as the game progressed and, even if I didn’t have an automatic bias, I honesty have to say that the game came out amazing. It is getting rave reviews everywhere, with the only consistent complaint being about the controls. But it’s a dual-stick shooter on a touchscreen, so the controls are destined to be at least a little annoying. The bros did push out a final patch on Android (and that will eventually make its way through Apple’s iTunes guardians) that fixes the control issues as much as possible.

Go download it on Google Play, Amazon, or iTunes and start shooting animals out of your face! It does cost a little cash ($3) but is definitely worth skipping a latte for!

CPR

The weekend of my last post (over a month ago…) my brothers and I did indeed complete a Game Jam with a crazy game called “I know CPR!”. It was a little inspired by QWOP (though it is not even almost as difficult) and otherwise followed the theme for the weekend: the sound of a beating heart. The executables (PC/Mac) are free to download, so go try it out (and see the video below)!

Average gene length in prokaryotes (part 2)

Hm. So it appears that, two years ago, I wrote a post on calculating the average gene length in prokaryotes. I found a half-draft of the second part and decided to finish it off.

In part 1 we defined mGenes (“maybe-genes”) as the pieces you get after breaking the genome at each stop codon, and predicted that the probability of finding an mGene of length L is given by the following equation:

Equation 1: The probability of finding an mGene of length L.

By plotting this function it is clear that the probability of a set of codons being an mGene plummets quickly, so that there is nearly a 0 probility of finding an mGene of 100 codons (300 bases) in a random sequence (black line in Fig. 1). I confirmed this with a 1,000,000 base synthetic genome (all code is at the end of this entry), resulting in the red circles in Fig. 1 that perfectly overlap with the prediction line.

Fig. 1: Predicted frequency of mGenes. Red circles, results from 1Megabase simulated genome. Black line, function shown in Equation 1.

So now we know what to expect from a completely random genome: Nearly all mGenes will be less than 100 codons (300 bases) in length. This is much shorter than your typical gene, and so I would expect there to be a large number of mGenes larger than this size in a real genome. So let’s check it out, using a fully sequenced prokaryotic genome!

Continue reading

Allele frequency problem in “Looper”

Time travel movies are always full of bad physics and and contradictory logic, though certainly some do it better than others. I usually just try not to think about them too hard so that I can take in the entertainment value. Looper (streaming|DVD) is no exception, but the most glaring error in the movie’s science was not in the physics; it was in the biology.

The beginning of the movie tells of a new mutation, the “TK mutation”, that has crept into the population to give people weak telekinetic powers. The idea of a gene, and more importantly a mutation in an existing gene, somehow allowing telekinesis is of course absurd, but that isn’t what I’m talking about.

I’m talking about the allele frequency. The movie takes place in the 2040’s. Only thirty years from now. And, at that time, the movie says that 10% of the human population has the TK mutation. This frequency is fantastically improbable.

Why? Well, right now 0% of the human population has this mutation. The thirty years between now and then have to bring that to 10%. That sounds impossible – let’s see if my suspicion is correct.

Continue reading

arduino: reaction time game

I’ve been perusing a pretty good book by Michael McRoberts called “Beginning Arduino”, and after putting together one of the first projects I decided to have fun with it and write some more interesting code than the one provided. The original scheme gave a series of three LEDs that would turn on as if they were a stop light, and then allow someone to press a button to get the light to change to red so that another LED, representing the pedestrian walk sign, could turn on. This wasn’t very interesting to me, so I made it into a reaction game instead otherwise using the same circuit. See the video immediately below, and the circuit diagram (made using Fritzing) and code below the fold.

Continue reading

The Birthday “Problem” in Python

A few days ago I found myself having a vague recollection of an interesting statistics problem. All I could remember was that it had to do with having a room full of people and the probability that any two people in that room would have the same birthday. I remembered the point, which was that it is much more likely than you might think, but I was fuzzy on the details.

After trying to define the problem and find an answer mathematically, I remembered that I suck at statistical reasoning about as much as the average person. So I decided to model the problem with a short Python script and find the answer that way.

Sure, I could’ve looked it up, but where’s the fun in that?

The problem: There are n people (say, at a party) drawn randomly from a population in which the chances of having a birthday on any day is equal to having a birthday on any other (which is not true of real populations (probably)). What is the probability of there being at least two people with the same birthday in the sample?

To put this thing together, I figure we need three things:

  1. The ability to generate random numbers (provided by Python’s random module);
  2. An object representing each person;
  3. A party object full of those people.

Then we can add things like the ability to choose how many people we want at the party and how many parties to have, as well as some output for making plots!

First, the Person object. All each person needs is a birthday:

import random
random.seed()

class Person:
    def __init__( self ):
        self.birthday = random.randint( 1, 365 )

Continue reading