I'm working on a program to calculate the most efficient spending of in-game currency on perks. To do this, im finding all possible combinations of perks and then making a list of the viable ones (it's not viable to spend too much currency or not spend as much as it can).
def findAllLvlCombos(powder, perkMaxLvls):
lvlCombo = [1, 1, 1]
lvlCombos = []
for a in range(perkMaxLvls[0]):
lvlCombo[0] = a + 1
for b in range(perkMaxLvls[1]):
lvlCombo[1] = b + 1
for c in range(perkMaxLvls[2]):
lvlCombo[2] = c + 1
# see if combo is viable and append it
validity = findComboValidity(powder, lvlCombo)
if validity == True:
**lvlCombos.append(lvlCombo)**
print('Done: ' + str(a) + '/' + str(perkMaxLvls[0]), end='\r')
return lvlCombos
I'm having issues with the lvlCombos.append(lvlCombo) line.
If I print lvlCombo, it prints fine, and when I print lvlCombos afterwards, it prints a list with tons of the current lvlCombo. I was expecting for it to append the current lvlCombo and move on. If more info is needed, I'm happy to accomodate