This commit is contained in:
Grail Finder
2025-05-01 14:12:35 +03:00
commit 91f0e93961
6 changed files with 9176 additions and 0 deletions

30
assign_colours.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/env/bin python
from random import choice
FNAME = "nouns.txt"
# 9 for blue
# 8 for red
# 1 for black
# 7 for white
BLUENUM = 9
REDNUM = 8
BLACKNUM = 1
WHITENUM = 7
ALLNUMS = {"blue": BLUENUM, "red": REDNUM, "black": BLACKNUM, "white": WHITENUM}
di = {}
def assign_words(words, num):
resp = set()
while len(resp) < num:
resp.add(choice(words).strip())
return resp
if __name__ == "__main__":
with open(FNAME) as lf:
data = lf.readlines()
for k,num in ALLNUMS.items():
di[k] = assign_words(data, num)
print(di)