[+] A3 P2 Q3 1/2

This commit is contained in:
Hykilpikonna
2021-10-23 01:28:06 -04:00
parent cda633fbb0
commit 66c333c88e
+8
View File
@@ -64,6 +64,7 @@ def choose_from_keys(transitions: dict[str, list[str]]) -> str:
Preconditions:
- transitions != {}
"""
return random.choice(list(transitions.keys()))
def choose_from_follow_list(key: str, transitions: dict[str, list[str]]) -> str:
@@ -77,6 +78,13 @@ def choose_from_follow_list(key: str, transitions: dict[str, list[str]]) -> str:
- key in transitions
- transitions[key] != []
"""
word = random.choice(transitions[key])
transitions[key].remove(word)
if len(transitions[key]) == 0:
del transitions[key]
return word
def generate_text_owc(count: int, transitions: dict[str, list[str]]) -> str: