Advertisement
Guest User

Untitled

a guest
May 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. def main():
  2.   data = {1:0.000, 2:0.000, 3:0.000, 4:0.000, 5:0.000, 6:0.000}
  3.   #data = {4:0.0}
  4.   spacer = ""
  5.   d = roll(data, spacer, 0)
  6.   for die in d:
  7.     print "Die face [" + str(die) + "]: " + str(d[die])
  8.  
  9. def roll(data, spacer, fromV):
  10.   potential_value = 0.0
  11.   spacer = spacer + " "
  12.   newdata = data
  13.   for d in newdata:
  14.     print spacer + str(fromV) + "> [" + str(d) + "]: " + str(data[d])
  15.   for dieface in data:
  16.     print "* Checking die face " + str(dieface) + ": " + str(data[dieface])
  17.     if (dieface > 3):
  18.       newdata[dieface] = data.pop(dieface) + dieface * .17
  19.       potential_value += newdata[dieface]
  20.  
  21.   if (potential_value > fromV):
  22.     for dieface in data:
  23.       data = roll(newdata, spacer, dieface)
  24.  
  25.   return newdata
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement