David Barry (pappubahry) wrote,
David Barry

Notes on Flappy Bird and clones

The other week I got (from work) one of these for the first time. It was just after Flappy Bird had been taken down from the App/Play Store, but I'd played a Flash clone of it (then-highest score: 15, with no other scores greater than 10), and so I downloaded Clumsy Bird, then and now the top free game on the Play Store.

Clumsy Bird is a little bit easier than Flappy Bird: in the former, you don't get as much impulse from flapping, relative to the size of the gaps you have to fly through. This leaves more margin for error, since a slightly early tap won't necessarily see you crashing into the roof of one of the gaps. Still, it takes some getting used to.

I played it by feel for a while – I tried to avoid any rages and just mindlessly tap away, almost always dying before I scored 5, hoping that eventually my brain would work things out. And it did, eventually. I passed 10 points, I passed 20 points, and suddenly the game was quite fun – an endless series of scrolling trees to fly my way through in some kind of Zen-like state.

It didn't last. I learned to read the score in my peripheral vision, a disastrous new skill that caused me to choke whenever I approached a new record, followed by the inevitable anger at dying all the times I failed to set that new record. After at least half a dozen scores in the 60's – an absurd deviation from the distribution of scores I should have had, and indeed would have had with some better sports psychology – I eventually broke the 70 barrier, and then without the pressure of a long-standing best score, I soon made over 100, with a score of 140. That's a number that will be satisfyingly large for as long as I don't talk to anyone who's done better.

After all this practice and skill-learning on Clumsy Bird, I wondered what would happen if I tried the Flash Flappy Bird clone again. My early efforts were predictably poor – having built up my feel for the game with the relatively small flaps of Clumsy Bird, the big Flappy Bird flaps saw me crash into the top of the gaps very quickly, typically before I'd scored 4 points.

I thought that this showed something interesting about a lack of transferability of skills in at least one direction between Clumsy Bird and Flappy Bird, but I was wrong. I tried a strategy of, whenever possible, flapping only when the bird had fallen below the bottom of the next gap. The idea was that, to get through the gap itself, I needed to flap near the bottom of it, and it would be easier to do this (greater margin of error in time) if the bottom of the gap was only a little below the peak of the bird's pre-flap trajectory.

And it worked. The skills I'd built up by feel on Clumsy Bird transferred to Flappy Bird once I had a sound playing strategy. I very soon had a score of over 20, and now my highest is 43. I found this transfer of skills quite interesting to experience.


Above, I mentioned in passing the distribution of scores I should have had. The simplest way to model Flappy-Bird-type games is to say that, at every point during the game, you have some probability p of dying before you score another point. Over a game, this probability is treated as a constant; your hope as a player is that, with practice and/or strategy, you decrease p so that your skill level rises. Of course, p isn't constant throughout the game – some transitions are harder than others, and the probability of making it through the next gap is a function of the position of the previous flap. But as a toy model, a constant-p looks OK to me.

It immediately follows from constant-p that your scores will be geometrically distributed (with scores of zero allowed). In other words, they will look a lot like a batsman's cricket scores, only you won't have as many scores of zero in Flappy Bird.

But while in cricket we calculate a batsman's average and can directly infer from that the average probability of being dismissed before scoring the next run, in Flappy Bird we usually only keep track of the highest score. If you've played Flappy Bird N times, all at a constant p, what high score "should" you have?

Let Xi be N independent geometrically-distributed random variables with failure probability p; these are the scores of each game of Flappy Bird you play. Let H = max(Xi); this is your highest score. Then

P(H ≤ h) = PRODUCT P(Xi ≤ h) = [1 - (1-p)h+1]N.

This gives us the basic relation between a high score h, skill level p, and the number of times N that you've played the game at your current skill level.

For a given p and N, what high score should we "expect"? I think that the natural way to answer this is to ask for the value of h such that P(H ≤ h) = 0.5. We get

h = ln[1 - 0.51/N] / ln(1-p) - 1.

Alternatively, given your high score of h, you could impute your skill level from

p = 1 - (1 - 0.51/N)1/(h+1).

An interesting exercise for a data-minded Flappy Bird player would be to plot a histogram of their scores and see how it compares to some of these theoretical values. Choking will show up as a spike in the probability density just below the highest score.

Assuming that I've played 100 games at my current skill level (this could be wrong by a lot), my Clumsy Bird highest score of 140 suggests p ≈ 0.035, and a cricket-style average = (1-p)/p of around 28. By the model I should have scored three centuries by now, and I've only scored one, so I suppose you can call me the Shane Watson of Clumsy Bird.
Tags: uni (academic)

  • Brief notes on partially franked dividends

    On a recent trip to Brisbane I was having dinner with a group of old friends, and I realised that we had become incredibly boring people who talked…

  • In which I write about myself

    When I was little, perhaps eight or nine years old, I experienced a certain phenomenon for the first time. Perhaps it's a common thing that I just…

  • Monte Carlo for substitution ciphers

    The Markov chain Monte Carlo revolution by Persi Diaconis opens with an example now used as an exercise for undergraduates. The goal is to decrypt…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.