Advertisement
Guest User

AlchemyERic

a guest
Feb 8th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. import random
  2.  
  3. def Target_input():
  4. target_count = input("How many Targets?")
  5. Target_List = [0]*target_count
  6. for x in range(0,target_count):
  7. Conq = str(x+1)
  8. Target_List[x] = input("What is the " + Conq + " target?: ")
  9. Target_List = sorted(Target_List, reverse=True)
  10. return Target_List
  11.  
  12. def Random_Roll(Random_Dice_Number):
  13. Random_List = [0]*Random_Dice_Number
  14. Random_Dice_Number_extra=Random_Dice_Number
  15. Random_Dice_Number_extra - 1
  16. for x in range(0,Random_Dice_Number_extra):
  17. Random_List[x]=random.randint(1,6)
  18. Random_List = sorted(Random_List, reverse=True)
  19. return Random_List
  20.  
  21. def Combine_dice(Random_List, Target_Number):
  22. for x in range(0,len(Random_List)):
  23. if(Random_List[0] == Target_Number):
  24. Holder = [Random_List, True]
  25. return Holder
  26. break
  27. if (x+1 >= len(Random_List)):
  28. Holder = [Random_List, False]
  29. return Holder
  30. break
  31. if (Random_List[x] == Random_List[x+1]):
  32. del Random_List[x]
  33. Random_List[x] = Random_List[x] + 1
  34. x = 0
  35.  
  36. def Compare_Dice_To_Targets(Target_List_Extra, Random_List):
  37. check = True
  38. Combine =0
  39. for x in range(0,len(Random_List)):
  40. if (len(Target_List_Extra) > len(Random_List) ):
  41. return (False,0)
  42. break
  43. if (Target_List_Extra[0] <= Random_List[0]):
  44. del Target_List_Extra[0]
  45. del Random_List[0]
  46. if (Target_List_Extra[:] == []):
  47. return (True,Combine)
  48. break
  49. if (Target_List_Extra[0] > Random_List[0]):
  50. Random_List_True = Combine_dice(Random_List, Target_List_Extra[0])
  51. Random_List = Random_List_True[0]
  52. check = Random_List_True[1]
  53. if(check == True):
  54. x = 0;
  55. Combine = Combine + 1
  56. else:
  57. return (False,0)
  58. break
  59. def Alchemy_Method(Rolls_Count,Dice_rolling,Target_List,Combination,Try_Again):
  60. while(Try_Again==True):
  61. Success = 0
  62. Fail = 0
  63. Total = 0
  64. Precent_Chance = 0
  65. Fuckups = 0
  66. Test = (True,0)
  67. x=0
  68. while(x<Rolls_Count):
  69. Random_List = Random_Roll(Dice_rolling)
  70. New_List = Random_List[:]
  71. Target_List_Extra = Target_List[:]
  72. Test = Compare_Dice_To_Targets(Target_List_Extra, Random_List)
  73. if (Test[0] == True):
  74. Success = Success + 1
  75. Total = Total + 1
  76. x = x+1
  77. if(Test[1] == Combination):
  78. """print" "
  79. print"||||||||||||||||||||||||||||||||||||||"
  80. Dazy = Test[1]
  81. Dazy = str(Dazy)
  82. print "Number of combinations: " + Dazy
  83. print "Dice Rolle: "
  84. print New_List
  85. print "Targets: "
  86. print Target_List"""
  87. if (Test[0] == False):
  88. Fail = Fail + 1
  89. Total = Total + 1
  90. x = x+1
  91. if (Test[0] != True and Test[0] != False):
  92. print Test
  93. print " MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
  94. x = x+1
  95. Fuckups = Fuckups +1
  96. precent_chance = round((float(Success)/float(Total)*100),9)
  97. Fail = str(Fail)
  98. Success = str(Success)
  99. Total = str(Total)
  100. precent_chance = str(precent_chance)
  101. Fuckups = str(Fuckups)
  102. print "\n"
  103. print 'Success: ' + Success + ' Fail: ' + Fail + ' Total: ' + Total + " Precent Chance To win: " + precent_chance + "% Fuckups: " + Fuckups
  104. print "\n"
  105. Try_Again = Try_Some_More()
  106.  
  107. def Try_Some_More():
  108. Try_Again = raw_input("Would you like to try again? [y/n], Press 'y' and enter for Yess. Press 'n' and enter for No.")
  109. if (Try_Again == "y"):
  110. return True
  111. if (Try_Again== "n"):
  112. return False
  113.  
  114. def How_many_trials():
  115. Test = True
  116. while(Test == True):
  117. Rolls_Count = input("How many roll trials would you like to run?: ")
  118. if (Rolls_Count < 10000000 and Rolls_Count > 0):
  119. return Rolls_Count
  120. break
  121. else:
  122. "You fucked up, try again."
  123. def Number_Of_Dice_Rolling():
  124. Test = True
  125. while(Test == True):
  126. Dice_rolling = input("The # of dice are you rolling? ")
  127. if (Dice_rolling < 10000000 and Dice_rolling > 0):
  128. return Dice_rolling
  129. break
  130. else:
  131. "You fucked up, try again."
  132.  
  133. Rolls_Count = How_many_trials()
  134. Dice_rolling =Number_Of_Dice_Rolling()
  135. Target_List = Target_input()
  136. Combination = input("Enter a # and I'll display every roll that required that I combine that many dice to hit the Targets ")
  137. Try_Again = True
  138. Alchemy_Method(Rolls_Count,Dice_rolling,Target_List,Combination,Try_Again)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement