From 5bf7676b68e3731269f40da751a5359cb8106035 Mon Sep 17 00:00:00 2001 From: Simon Junod Date: Mon, 3 Oct 2022 11:12:36 +0200 Subject: [PATCH] Ajout d'un maximum pour la longueur des mots dans Wordle --- cambot/settings_example.py | 3 ++- cambot/wordle.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cambot/settings_example.py b/cambot/settings_example.py index e322f28..232ecf2 100644 --- a/cambot/settings_example.py +++ b/cambot/settings_example.py @@ -15,6 +15,7 @@ WORDLE_TARGET_WORDS = "cambot/wordlists/target_words.txt" WORDLE_POINTS = (1, 3, 6) WORDLE_SLOWMODE = 0 WORDLE_MINLENGTH = 8 +WORDLE_MAXLENGTH = 10 WORDLE_FORCE_ALTERNATION = True HEARTBEAT = 60 @@ -22,4 +23,4 @@ EPHEMERIS = 0 WORDLE = 1 EVENTS = ((EPHEMERIS, time(8)), (WORDLE, time(8)), - (WORDLE, time(20))) \ No newline at end of file + (WORDLE, time(20))) diff --git a/cambot/wordle.py b/cambot/wordle.py index c8506fb..b892299 100644 --- a/cambot/wordle.py +++ b/cambot/wordle.py @@ -49,7 +49,7 @@ class Game: output = "" if self.target and not self.winner: output = f"Le mot précédent était : `{self.target}`\n\n" - self.target = random.choice(tuple(x for x in target_words if len(x) >= WORDLE_MINLENGTH)) + self.target = random.choice(tuple(x for x in target_words if WORDLE_MAXLENGTH >= len(x) >= WORDLE_MINLENGTH)) self.winner = None self.tries = 0 self.last_player = None