You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.4 KiB
Python
29 lines
1.4 KiB
Python
2 years ago
|
from itertools import product
|
||
|
|
||
|
# colors = ("red", "blue", "green")
|
||
|
# clothes = ("shirt", "pants")
|
||
|
# typ = ("analog", "digital")
|
||
|
|
||
|
# print (len(list(product(colors, clothes, typ))))
|
||
|
|
||
|
|
||
|
import sys
|
||
|
from random import shuffle, randint, seed
|
||
|
import json
|
||
|
|
||
|
seed("house of ada, seeded 5 april 2023")
|
||
|
|
||
|
actors = ['silly', 'serious', 'naïve', 'smart', 'focused', 'dreamy','hungry','sad', 'embarassed', 'fantastic', 'stressed', 'caring','moody', 'angry', 'frustrated','big'];
|
||
|
action = ['pruning', 'swatching', 'grafting', 'composting', 'gleaning','fermenting','tilling','fertilizing','crop rotating','fallowing', 'weeding','companion planting','broadcasting' ];
|
||
|
objects = ['booklets', 'index cards', 'etherpads','books','e-books', 'html scripts', 'texts', 'python scripts', 'poems', 'stories', 'pdfs', 'carrier bag libraries', 'bootleg libraries', 'hero libraries'];
|
||
|
material = ['chocolate', 'marzipan', 'peanut butter', 'mozzarella', 'jam', 'butter', 'gingerbread','tomato sauce', 'candy', 'custard', 'cookie dough', 'honey', 'parmesan cheese','camambert', 'sour grapes', 'maple syrup'];
|
||
|
|
||
|
count = 100
|
||
|
all_possibilities = list(product(actors, action, objects, material))
|
||
|
print (f"wow there are {len(all_possibilities)} possible combinations, outputting a random set of {count}", file=sys.stderr)
|
||
|
shuffle(all_possibilities)
|
||
|
items = []
|
||
|
for combo in all_possibilities[:count]:
|
||
|
items.append({'words': combo, 'hue': randint(0, 255)})
|
||
|
print (json.dumps({'items': items}, indent=2))
|