Dice Percentages

Authors

Publication

Pub Details

Date

Pages

See all articles from QL Hacker's Journal 16

I’m still distracted by my other hobby, wargaming. In tying the two together, I thought about dice, percentages, and To-Hit rolls.

In gaming a To-Hit roll is a die roll, where your try to roll a certain value or less. For example, for a To-Hit roll of 10 with 2 six-sided die (2d6), you would have to roll a die total of 10 or less.

In designing a game or gaming system, it’s easy to determine the chances that something will happen by purely guessing the general percent chance that you feel that it will happen. The difficult part is translating that into terms of die. Some designers use a 10- or 20-sided die to work out the nice percentages, but others prefer to stick to 6-sided dice because of how common they are.

I wrote a short program that will take a given number of 6-sided dice and print out the possible die rolls with the percent change that that number will come up, and the percent change that that number or less will come up (the To-Hit roll).

** dice_ssb
** This program will simulate a number of 6
** sided dice. It will determine what
** percentage chance a certain number
** has of rolling, and what percentage
** a number or lower has of rolling.

dice = 2

DIM array(dice+1)
DIM total_array(6^dice)

** Calculation Section

** Set all dice to 1
FOR x = 1 to dice
array(x) = 1
NEXT x

** Set first dice to 0 so that it will
** INC to 1 in first run through the
** program.
array(1) = 0

FOR y = 1 TO 6^dice
array(1) = array(1)+1
total = 0

FOR x = 1 TO dice
IF array(x) = 7 THEN
array(x) = 1
array(x+1) = array(x+1)+1
END IF
total = total+array(x)
NEXT x
total_array(total) = total_array(total)+1
NEXT y

** Report Section

total = 0

FOR x = dice TO 6*dice

temp1 = INT((total_array(x)/6^dice)*100)
total = total + total_array(x)
temp2 = int(((total)/6^dice)*100)
print "Die roll of ";x;" ";total_array(x);" ";
temp1;" ";temp2

NEXT x

Products

 

Downloadable Media

 

Image Gallery

Scroll to Top