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!

chuckstar

6 Comments

Claus Wahlers

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.

Tony Fendall

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.

chuckstar22

@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!

Brendan Lee

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

Zach Graves

Blue keeps winning. Must be Michael Phelps.

Scott Morgan

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!

Comments are closed.