Skip to content

Instantly share code, notes, and snippets.

@PastaPastaPasta
Last active August 8, 2018 20:06
Show Gist options
  • Save PastaPastaPasta/710621fa5169c9a5d811e4868fa80019 to your computer and use it in GitHub Desktop.
Save PastaPastaPasta/710621fa5169c9a5d811e4868fa80019 to your computer and use it in GitHub Desktop.
import random
VinRounds = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
#Number of rounds to mix up to
goal = int(float(input("PS Goal:")))
completed = False
totalMixes = 0
while not completed:
forThisMix = []
totalMixes = totalMixes + 1
mixsize = random.randint(1,8)
#Sorts is so largest are at '0'
VinRounds = sorted(VinRounds, reverse=True)
i = 0
#second part is so that if there are no more denoms to include in a mix it doesn't get into an infinate loop
while i < mixsize and i < len(list(filter((goal).__ne__, VinRounds))):
rand = random.random()
i2 = int(((rand * len(VinRounds) * rand * len(VinRounds)))/len(VinRounds))
if not forThisMix.__contains__(i2) and VinRounds[i2] < goal:
forThisMix.append(i2)
i = i+1
#increase the round count for those that are included in the mix
for x in range(len(forThisMix)):
VinRounds[forThisMix[x]] = VinRounds[forThisMix[x]] + 1
#Remove all denoms which real the goal, aka those denoms are done
if VinRounds.__contains__(goal):
c = VinRounds.count(goal)
VinRounds = list(filter((goal).__ne__, VinRounds))
print("#### ", c, " denom(s) Reached Goal in ", totalMixes)
print(totalMixes, VinRounds)
#stop if no more denoms to mix
completed = len(VinRounds) == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment