1
0
mirror of https://github.com/osmarks/random-stuff synced 2025-06-10 14:04:05 +00:00
random-stuff/compare_things.py
2025-05-18 14:09:06 +01:00

24 lines
704 B
Python

import json
import random
with open("nouns.json", "r") as f:
nouns = set(json.load(f))
with open("comparisons.jsonl", "a") as f:
def writeline(obj):
f.write(json.dumps(obj, separators=(",", ":")) + "\n")
for noun in nouns:
other_noun = random.choice(list(nouns - {noun}))
print(noun, "/",other_noun)
pref = input("a/b/e/x/y: ")
writeline({"a": noun, "b": other_noun, "pref": pref})
if pref == "x":
writeline({"a": noun, "b": other_noun, "pref": "x"})
nouns.remove(noun)
elif pref == "y":
writeline({"a": other_noun, "b": noun, "pref": "y"})
nouns.remove(other_noun)
f.flush()