ActionScript Olympic Race, featuring Math.random

Watching the Olympics, I thought it would be cool to simulate a race with ActionScript. Below is my first version of the ActionScript Olympic Race, where each colored circle has an equal chance at winning. The script features a Math.random() based algorithm that calculates the distance each circle will move as a Timer instance runs. Once a circle (a tie is possible) passes the finish line, the race ends, and that circle gets a notch in the win column.

See how many races it takes for each circle to have at least one win!

I’m hoping to polish this up before the actual Olympics end, maybe adding country flags and allowing you to give a country an edge. Suggestions are welcome and appreciated!

6 Comments

Leave a comment
  1. Claus Wahlers 13. Aug, 2008 at 2:57 pm #

    It doesn’t take doping into account.

    Took 9 races here btw, where in the last race both the blue and the yellow circle won. weird.

  2. Tony Fendall 13. Aug, 2008 at 5:26 pm #

    I can’t find the full text of this article online for free anywhere (a local library should have it), but your little app looks like it could be a cool replication of the experiments the guy in this article did:
    http://www.newscientist.com/article/mg17523555.700-golden-goals.html

    He analyzed sports competitions by assigning weighings to a set of imaginary teams, and then used a random number generator combined with those weightings to prove that the best team doesn’t always win.

  3. chuckstar22 13. Aug, 2008 at 6:32 pm #

    @Claus, yes, as noted, there is a case where there can be a tie. I’ll probably remove this in the next version. Thanks for your feedback!

  4. Brendan Lee 14. Aug, 2008 at 1:39 pm #

    How can we get some pay pal integration for some heated bets? and can we add trifecta/quinella support? thnx dude-

  5. Zach Graves 16. Aug, 2008 at 2:15 am #

    Blue keeps winning. Must be Michael Phelps.

  6. Scott Morgan 31. Aug, 2008 at 12:57 am #

    I made a similar olympic style flash game which also used Math.random() to randomize the results. My little game took place post finish line and you have to urinate into a cup. The results are strikingly similar to the summer games!