Enhance randoms function
This commit is contained in:
parent
b334f8c64b
commit
c5b18b9943
1 changed files with 8 additions and 4 deletions
12
colors.py
12
colors.py
|
@ -1717,13 +1717,17 @@ def studio():
|
||||||
studiostring += "\"exchange\":{\"dupes\":" + str(dupeswant) + ",\"new\":" + str(newwant) + ",\"sigs\":" + str(sigswant) + ",\"choice\":" + str(choicewant) + ",\"special\":" + str(specialwant) + "}}"
|
studiostring += "\"exchange\":{\"dupes\":" + str(dupeswant) + ",\"new\":" + str(newwant) + ",\"sigs\":" + str(sigswant) + ",\"choice\":" + str(choicewant) + ",\"special\":" + str(specialwant) + "}}"
|
||||||
print("\n" + studiostring)
|
print("\n" + studiostring)
|
||||||
|
|
||||||
def randoms():
|
def randoms(specials=False):
|
||||||
totalrandoms = int(input("How many? "))
|
totalrandoms = int(input("How many? "))
|
||||||
pool = []
|
pool = []
|
||||||
for card in cardlist:
|
for card in cardlist:
|
||||||
if card["priority"] == 4 and card["dupe"] == False and card["colour"] != "special" and card["colour"] != "sig" and card["colour"] != "limited":
|
if card["priority"] == 4 and card["dupe"] == False and card["colour"] != "sig" and card["colour"] != "limited":
|
||||||
pool.append(card["name"])
|
if specials:
|
||||||
chosen = random.sample(pool,totalrandoms)
|
pool.append(card["name"])
|
||||||
|
else:
|
||||||
|
if card["colour"] != "special":
|
||||||
|
pool.append(card["name"])
|
||||||
|
chosen = sorted(random.sample(pool,totalrandoms))
|
||||||
print(", ".join(chosen))
|
print(", ".join(chosen))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue