From b853eade5d4df118160b3b89b2017d10b9c45ead Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Thu, 25 Jul 2024 21:43:00 -0600 Subject: [PATCH] Mods --- cromulant/game.py | 20 +++++++++++--------- cromulant/utils.py | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/cromulant/game.py b/cromulant/game.py index c8df2c6..fb45d61 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -53,8 +53,7 @@ class Opts: triumph = Opt(2, Method.triumph) hit = Opt(2, Method.hit) travel = Opt(2, Method.travel) - think_1 = Opt(2, Method.think) - think_2 = Opt(2, Method.think) + think = Opt(2, Method.think) words_1 = Opt(3, Method.words) words_2 = Opt(3, Method.words) words_3 = Opt(3, Method.words) @@ -70,7 +69,7 @@ class Opts: @staticmethod def opts_think() -> list[Opt]: - return [Opts.think_1, Opts.think_2] + return [Opts.think] @staticmethod def opts_words() -> list[Opt]: @@ -309,13 +308,16 @@ class Game: status = Utils.random_country([]) method = Opts.travel.method - elif value == Opts.think_1.value: - status = Utils.random_name([], Ants.get_names()) - method = Opts.think_1.method + elif value == Opts.think.value: + n = random.randint(1, 3) + method = Opts.think.method - elif value == Opts.think_2.value: - status = Utils.random_emoji(3) - method = Opts.think_2.method + if n == 1: + status = Utils.random_name([], Ants.get_names()) + elif n == 2: + status = Utils.random_emoji(3) + elif n == 3: + status = Utils.random_words(1)[0].capitalize() elif value == Opts.words_1.value: status = Utils.words_1() diff --git a/cromulant/utils.py b/cromulant/utils.py index 8154dff..9eca23c 100644 --- a/cromulant/utils.py +++ b/cromulant/utils.py @@ -160,10 +160,19 @@ class Utils: return random.choice(filtered) @staticmethod - def random_word() -> str: - word = Utils.rand_word.word( - include_parts_of_speech=["nouns", "adjectives"], word_max_length=8 - ) + def random_word(noun: bool = True, adj: bool = True) -> str: + opts = [] + + if noun: + opts.append("noun") + + if adj: + opts.append("adjective") + + if not len(opts): + return "" + + word = Utils.rand_word.word(include_parts_of_speech=opts, word_max_length=8) return str(word)