Rolling the Dice.

A sub-forum for players new to WIF, containing information on how to get started and become an experienced player.

Moderator: Shannon V. OKeets

Post Reply
User avatar
rkr1958
Posts: 31635
Joined: Thu May 21, 2009 10:23 am

Rolling the Dice.

Post by rkr1958 »

In my current game/AAR, which I started back on 12/27/2108, I'm rolling the dice for all random events. In the case of 1D10 (e.g., naval search) or 2D10 (e.g., land, air-to-air combat) events, it's obvious how to do this. That is, roll either 1 or 2 10-sided die/dice as appropriate. However, for other events (e.g., chit draws, fractional odds) it may not be so obvious how I'm doing it and I thought I'd share it with you how I am. Especially, since I've figured out a way to roll for 0-14 (uniform) with two dice, but more on that later.

Fractional odds (0-999): I first select and order three different colored 10-sided dice (e.g., Blue-Green-Red in order from left to right). I then roll the three dice and construct the number with Blue=100's, Green=10's and Red=1's. For example a roll of Blue=5, Green=7, Red=0 would produce the 3-digit number 570.

Chit draws (0-3017, 0-365, 0-920, 0-5097, 0-6113): I select and order four different colored 10-sided dice (e.g., Purple-Blue-Green-Red). I then roll the 4 dice to produce a 4-digit decimal number with Purple (in this case) being the digit closest to the decimal. For example, Purple=7, Blue=1, Green=0, Red=5 would produce the 4-digital decimal number 0.7105. I then multiple this number by the number of chits for the given year I'm in and round off to the nearest integer. In continuing with my example say it's 1940. There are 920 chits and chit draws vary between 0 and 920, inclusively. So, the chit draw in continuing my example would be 0.7305 x 920 = 653.6600 which rounds off (to the nearest integer) to 654.

Partisans (0-99, 0-9, 0-14). For 0-99 I just select two different colored dice and order them (e.g., White-Yellow). In this example White is the 10's and Yellow the 1's. So White = 3 and Yellow = 5 would produce 35. 0-9 roll should be obvious how to do with a 10-sided die. What wasn't obvious was how to roll and produce a uniform draw between 0 and 14, inclusively. Until today, I've been using a similar, but not exactly the same, method as I did for chit draws. I select and order four different colored 10-sided dice to produce a four digit decimal number between 0.0000 and 0.9999. I then multiply that number by 15 and round down. That is, 14.9985 is 14. While this method did indeed produce a uniform equivalent roll between 0 and 14, inclusively, it entailed a lot of "bookkeeping" during the partisan phase especially when I needed two or three 0-14 numbers.

It was today when I had an aha moment and came up with a way that only required rolling two dice to get this number (i.e., uniform integer between 0 and 14, inclusively). For this new method I used one 10-sided die and one 6-sided die. For a roll of 1-4 on the 6-sided die, the resulting number was whatever was rolled on the 10-sided die (i.e., 0-9). For a roll of 5-6 on the 6-sided die, the resulting number was 10 + modulo 5 of the 10-sided die roll. So in this last case (i.e., 5 or 6 on the 1d6), 1d10 rolls of 0 & 5 are 0, 1 & 6 are 1, 2 & 7 are 2, 3 & 8 are 3, 4 & 9 are 4 and when added to 10 would produce the numbers 10 - 14.

Anyway, for someone not familiar with the board version of MWiF, I've found "rolling the dice" and working through all the game tables is not only fun but has help me better understand the game.
Ronnie
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: Rolling the Dice.

Post by Shannon V. OKeets »

The program always generates enough single digit random numbers to cover the maximum value. For example, to generate a number between 0 and 920, the program generates 3 random numbers between 0 and 10. The first and second are the first two digits and the third is the third digit. If the numbers turn out to be 945, which is outside the necessary range, the program simply generates a new set of (in this case 3) random numbers.

----

Using the 6 sided die is correct in this case, but it is a rare case indeed.

The probability of any number between 0 and 14 should be 1/15 = 0.06666666...

Your system yields the correct values for 0 through 9: 2/3 * 1/10 = 0.066666666...

For 10 through 14 it also yields 1/3 * 1/5 = 0.06666666...

----

A simpler system is to roll the first 10 sided die and use even or odd to determine the first digit of 0 or 1. Then roll it a second time until you get a value between 0 and 4. Or you could Mod 5 and use the remainder (as you did).

In general, I think it would be easiest to just roll a 10 sided die until you get a valid first digit. Roll it again for the middle digits (accepting all outcomes), and roll it again for a valid last digit. If you have multiple color dice, then all four could be rolled simultaneously for a digit between 0 and 3017. The Purple and Red dice may have to be rerolled if their first value is invalid: Purple > 3, Red > 7. This avoids having to multiply and round. You just reroll any digits that are invalid.
Steve

Perfection is an elusive goal.
User avatar
rkr1958
Posts: 31635
Joined: Thu May 21, 2009 10:23 am

RE: Rolling the Dice.

Post by rkr1958 »

ORIGINAL: Shannon V. OKeets

n general, I think it would be easiest to just roll a 10 sided die until you get a valid first digit. Roll it again for the middle digits (accepting all outcomes), and roll it again for a valid last digit. If you have multiple color dice, then all four could be rolled simultaneously for a digit between 0 and 3017. The Purple and Red dice may have to be rerolled if their first value is invalid: Purple > 3, Red > 7. This avoids having to multiply and round. You just reroll any digits that are invalid.
Unless I'm missing something, wouldn't just re-rolling the digits out of range skew your distribution? For example, lets take 0 to 3017 (uniform, inclusive). Purple = 1000's, Red = 100's, White = 10's, Green = 1's. So for purple (i.e, 1000's) any roll any 0, 1, 2 or 3 is valid. The probability of getting a 3, if you always and only re-roll 4-9, for the 1000's (e.g., purple die) is 0.25 (i.e., 1 out of 4 or 25%). This means 25% of the time the roll will be 3000 to 3017. However, for a truly uniform distribution from 0 to 3017 the probability of rolling 3000 to 3017 would equal 18/3018 = 0.006, or 0.6% not 25%.
Ronnie
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: Rolling the Dice.

Post by Shannon V. OKeets »

I would like to add that what the program does for generating a random number is that it starts by filling a table with digits between 0 and 9. To do this it uses a "random number generator". Those can have tendencies to repeat which numbers they generate after several trillion iterations.

The table is 100 by 100, which is 10,000 cells.

When a random number is needed, the program 'generates' two numbers between 0 and 99 to define a row and column. It then takes the value from that cell in the table. It immediately replaces the cell it has just 'used' with a new random number.

This convoluted process introduces a few more 'random' elements in the selection of which values to use in MWIF for 'die rolls'.
Steve

Perfection is an elusive goal.
Post Reply

Return to “WIF School”