20 January 2009

More Metal Fatigue

Following up on my Metal Fatigue post, I have set up a spreadsheet to demonstrate a simple example of the Birnbaum-Saunders fatigue life probability distribution. To quickly summarize, this is the version of the Central Limit Theorem that describes how many shocks or stresses a metal part will survive before the part wears out and breaks. It also happens to describe a probability distribution that applies to many types of games. My goal is to use this as the basis for an approximation for complex games (such as Battletech). The Birnbaum-Saunders distribution (henceforth BS) ranges from 0 to positive infinity, as opposed to the Normal distribution which ranges from negative infinity to positive infinity. The BS CDF formula can be evaluated using the Normal CDF function, which is readily available in Microsoft Excel.

What I did was to set up several spreadsheets that simulate a very simple one-player game. A player starts with 35 points, and every "turn" rolls one 6-sided die and subtracts the number rolled, keeping a keeping track of the remaining points until there are zero (or less) left. The object being to determine how many turns this takes. In terms of metal fatigue, the roll of the die is the shock which makes a crack grow, until it reaches the critical length 35, and the part breaks.
That's it - A very boring sort of game, but it serves the purpose of this demonstration.

The first worksheet (cleverly named "One") demonstrates just a single observation of survival time in this simple game. The first column "t" counts the number of turns or times the die has been rolled (starting with zero), the next column "1d6" shows a random number from 1 to 6, and the column "W (remain)" keeps track of how many points are left. The last column "Game Ends on t=" shows the final turn of the game. This spreadsheet will update every time you press "F9" (in Excel) or click "Recalculate" (Google documents), and show the results for a new instance of the game.
The other columns, "m, v, s" display parameters for the distribution. If you want to tinker with the spreadsheet, you can start by changing the starting number of points in the green shaded cell.

Next I set up another worksheet ("Many") that repeats this game many times, tallies up the results and displays them (blue) along with the theoretical distribution (red). This can be updated in the same way as the previous worksheet to see a different set of results (examples to the right and below). There is some randomness to the results, but they follow nicely along with what the Central Limit Theorem says they should be.









Still awake? Still reading?? I had fun playing with the spreadsheets but an awful time trying to write about it. Boring to read too I'm sure (sorry), but an important component of certain games, and something I needed to establish for some future posts.
Post a Comment