import json from random import randint, choice def load_json(filename): with open(filename) as f: return json.load(f) actions = [ "*tilts head*", "*twitches ears slightly*", "*purrs*", "*falls asleep*", "*sits on ur keyboard*", "*nuzzles*", "*stares at u*", "*points towards case of monster zero ultra*", "*sneezes*", "*plays with yarn*", "*eats all ur doritos*", "*lies down on a random surface*", ] catgirl_table = load_json("catgirl_nonsense.json") keymash_table = load_json("keyboard_mash.json") scrunkly_table = load_json("aww_the_scrunkly.json") def gen_uwu(): return "uwu" def gen_colon_three(): return ":3" def gen_owo(): return "owo" def gen_nyaa(): return "ny" + ("a" * randint(1, 6)) def gen_blush(): return ">" + ("/" * randint(3, 6)) + "<" def gen_actions(): return choice(actions) def gen_screaming(): return "A" * randint(5, 16) def gen_catgirl_nonsense(): result = "mr" state = 7 for _ in range(randint(25, 149)): rand = randint(0, catgirl_table[state]["totalProbability"] - 1) for choice in catgirl_table[state]["choices"]: if choice["cumulativeProbability"] > rand: result += choice["nextChar"] state = choice["nextNgram"] break result += "nya" return result def gen_keyboard_mash(): result = "" state = randint(0, len(keymash_table) - 1) for _ in range(randint(25, 149)): rand = randint(0, keymash_table[state]["totalProbability"] - 1) for choice in keymash_table[state]["choices"]: if choice["cumulativeProbability"] > rand: result += choice["nextChar"] state = choice["nextNgram"] break return result def gen_scrunkly(): result = "aw" state = 37 for _ in range(randint(25, 99)): rand = randint(0, scrunkly_table[state]["totalProbability"] - 1) for choice in scrunkly_table[state]["choices"]: if choice["cumulativeProbability"] > rand: result += choice["nextChar"] state = choice["nextNgram"] break return result generators = [ gen_uwu, gen_colon_three, gen_owo, gen_nyaa, gen_blush, gen_actions, gen_screaming, gen_catgirl_nonsense, gen_keyboard_mash, gen_scrunkly, ] prev = None cur = None while True: prev = cur cur = choice(generators) while cur == prev: cur = choice(generators) print(cur(), end=" ")