chillmeter: prevent dupes

master
Casey Link 2011-09-08 15:50:13 -05:00
parent 4a475bd030
commit 2ae48cfb1b
1 changed files with 12 additions and 2 deletions

View File

@ -27,7 +27,10 @@ chill_words = [
"lax pinny", "lax pinny",
"lacrosse", "lacrosse",
"a bowl", "a bowl",
"slampiece" "slampiece",
"smirnoff",
"ices",
"iced"
] ]
# words that unchill the place # words that unchill the place
@ -54,7 +57,8 @@ chill_things = [
("case of keystone", "cases of keystone"), ("case of keystone", "cases of keystone"),
("fist bump", "fist bumps"), ("fist bump", "fist bumps"),
("head nod", "head nods"), ("head nod", "head nods"),
("bro", "bros") ("bro", "bros"),
("bowl", "bowls")
] ]
# keeps a finger on the pulse of the chillness # keeps a finger on the pulse of the chillness
@ -91,12 +95,18 @@ def chill(phenny, input):
n = random.randint(1,2) n = random.randint(1,2)
items = [] items = []
used = set()
for i in range(n): for i in range(n):
if level == 0: if level == 0:
amount = random.randint(5, 10) amount = random.randint(5, 10)
else: else:
amount = random.randint(1, level) amount = random.randint(1, level)
item = random.choice(chill_things) item = random.choice(chill_things)
while item in used:
item = random.choice(chill_things)
used.add(item)
if amount == 1: if amount == 1:
item = item[0] # singular item = item[0] # singular
else: else: