Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def Target_input():
- target_count = input("How many Targets?")
- Target_List = [0]*target_count
- for x in range(0,target_count):
- Conq = str(x+1)
- Target_List[x] = input("What is the " + Conq + " target?: ")
- Target_List = sorted(Target_List, reverse=True)
- return Target_List
- def Random_Roll(Random_Dice_Number):
- Random_List = [0]*Random_Dice_Number
- Random_Dice_Number_extra=Random_Dice_Number
- Random_Dice_Number_extra - 1
- for x in range(0,Random_Dice_Number_extra):
- Random_List[x]=random.randint(1,6)
- Random_List = sorted(Random_List, reverse=True)
- return Random_List
- def Combine_dice(Random_List, Target_Number):
- for x in range(0,len(Random_List)):
- if(Random_List[0] == Target_Number):
- Holder = [Random_List, True]
- return Holder
- break
- if (x+1 >= len(Random_List)):
- Holder = [Random_List, False]
- return Holder
- break
- if (Random_List[x] == Random_List[x+1]):
- del Random_List[x]
- Random_List[x] = Random_List[x] + 1
- x = 0
- def Compare_Dice_To_Targets(Target_List_Extra, Random_List):
- check = True
- Combine =0
- for x in range(0,len(Random_List)):
- if (len(Target_List_Extra) > len(Random_List) ):
- return (False,0)
- break
- if (Target_List_Extra[0] <= Random_List[0]):
- del Target_List_Extra[0]
- del Random_List[0]
- if (Target_List_Extra[:] == []):
- return (True,Combine)
- break
- if (Target_List_Extra[0] > Random_List[0]):
- Random_List_True = Combine_dice(Random_List, Target_List_Extra[0])
- Random_List = Random_List_True[0]
- check = Random_List_True[1]
- if(check == True):
- x = 0;
- Combine = Combine + 1
- else:
- return (False,0)
- break
- def Alchemy_Method(Rolls_Count,Dice_rolling,Target_List,Combination,Try_Again):
- while(Try_Again==True):
- Success = 0
- Fail = 0
- Total = 0
- Precent_Chance = 0
- Fuckups = 0
- Test = (True,0)
- x=0
- while(x<Rolls_Count):
- Random_List = Random_Roll(Dice_rolling)
- New_List = Random_List[:]
- Target_List_Extra = Target_List[:]
- Test = Compare_Dice_To_Targets(Target_List_Extra, Random_List)
- if (Test[0] == True):
- Success = Success + 1
- Total = Total + 1
- x = x+1
- if(Test[1] == Combination):
- """print" "
- print"||||||||||||||||||||||||||||||||||||||"
- Dazy = Test[1]
- Dazy = str(Dazy)
- print "Number of combinations: " + Dazy
- print "Dice Rolle: "
- print New_List
- print "Targets: "
- print Target_List"""
- if (Test[0] == False):
- Fail = Fail + 1
- Total = Total + 1
- x = x+1
- if (Test[0] != True and Test[0] != False):
- print Test
- print " MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
- x = x+1
- Fuckups = Fuckups +1
- precent_chance = round((float(Success)/float(Total)*100),9)
- Fail = str(Fail)
- Success = str(Success)
- Total = str(Total)
- precent_chance = str(precent_chance)
- Fuckups = str(Fuckups)
- print "\n"
- print 'Success: ' + Success + ' Fail: ' + Fail + ' Total: ' + Total + " Precent Chance To win: " + precent_chance + "% Fuckups: " + Fuckups
- print "\n"
- Try_Again = Try_Some_More()
- def Try_Some_More():
- Try_Again = raw_input("Would you like to try again? [y/n], Press 'y' and enter for Yess. Press 'n' and enter for No.")
- if (Try_Again == "y"):
- return True
- if (Try_Again== "n"):
- return False
- def How_many_trials():
- Test = True
- while(Test == True):
- Rolls_Count = input("How many roll trials would you like to run?: ")
- if (Rolls_Count < 10000000 and Rolls_Count > 0):
- return Rolls_Count
- break
- else:
- "You fucked up, try again."
- def Number_Of_Dice_Rolling():
- Test = True
- while(Test == True):
- Dice_rolling = input("The # of dice are you rolling? ")
- if (Dice_rolling < 10000000 and Dice_rolling > 0):
- return Dice_rolling
- break
- else:
- "You fucked up, try again."
- Rolls_Count = How_many_trials()
- Dice_rolling =Number_Of_Dice_Rolling()
- Target_List = Target_input()
- Combination = input("Enter a # and I'll display every roll that required that I combine that many dice to hit the Targets ")
- Try_Again = True
- Alchemy_Method(Rolls_Count,Dice_rolling,Target_List,Combination,Try_Again)
Advertisement
Add Comment
Please, Sign In to add comment