Hi all,
I created a simple dice roller to handle Feng Shui game nights and make the flow of the game progress faster and smoother.
Below is the code for the script, in Python 3.1.
Currently, it is designed to randomly generate the positive and negative rolls while allowing for the exploding dice on both ends of the spectrum.
#Feng Shui Dice Roller
#Version 1.0
#Derek A. Drake
#7 September 2010
#Purpose: To roll a positive dice (Pos), rerolling sixes, and less a negative dice (Neg)
#also rerolling sixes, and display a total with history
from random import randint
print ("Feng Shui Dice Roller v1.0")
print ("")
posdie = randint (1,6) #Generates the positive dice roll.
if posdie == 6: #Checks for the exploding dice
positeration = 1 #If yes, then it will roll a bonus die
print ("The Positive Dice is: ", posdie) #Outputs the positive roll
else:
positeration = 0 #If no bonus die
print ("The Positive Dice is: ", posdie) #Outputs the positive roll
totalpos = posdie #Holder for positive die value
while positeration == 1: #Bonus die section
bondie = randint (1,6) #Generates random die roll
totalpos += bondie #Increments the positive total
print ("Bonus Positive Die is: ", bondie) #Outputs the bonus roll
if bondie != 6: #Checks for a non-six roll of the bonus die
positeration = positeration - 1 #Stops the generation of bonus die
print ("The Total Positive Value is: ", totalpos) #Outputs the sum of the positive value
#Code for the negative section mirrors the positive section
negdie = randint (1,6)
if negdie == 6:
negiteration = 1
print ("The Negative Dice is: ", negdie)
else:
negiteration = 0
print ("The Negative Dice is: ", negdie)
totalneg = negdie
while negiteration == 1:
negbondie = randint (1,6)
totalneg += negbondie
print ("Bonus Negative Die is: ", negbondie)
if negbondie != 6:
negiteration = negiteration - 1
print ("The Total Negative Value is: ", totalneg)
print ("---")
SumTotal = totalpos - totalneg #Calculates the overall total of the shot
print ("Your Total Roll is: ", SumTotal) #Outputs the roll total