From b3c4d208b72c2a9b2c332e055c7179805b21ddfd Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sun, 19 Oct 2025 19:29:34 -0700 Subject: [PATCH] Update mmind.py --- modules/games/mmind.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/games/mmind.py b/modules/games/mmind.py index 6978efa..a9a6fa3 100644 --- a/modules/games/mmind.py +++ b/modules/games/mmind.py @@ -171,7 +171,7 @@ def getEmojiMMind(secret_code): return secret_code_emoji #compare userGuess with secret code and provide feedback -def compareCodeMMind(secret_code, user_guess): +def compareCodeMMind(secret_code, user_guess, nodeID): game_won = False perfect_pins = 0 wrong_position = 0 @@ -199,7 +199,15 @@ def compareCodeMMind(secret_code, user_guess): temp_code.remove(guess) # Remove the first occurrence of the matched color # display feedback if game_won: - msg += f"\nCorrect{getEmojiMMind(user_guess)}\n" + msg += f"\n🏆Correct{getEmojiMMind(user_guess)}\nYou are the master mind!🤯" + # reset turn count in tracker + msg += f"\nWould you like to play again? (N)ormal, (H)ard, or e(X)pert?" + # reset turn count in tracker + for i in range(len(mindTracker)): + if mindTracker[i]['nodeID'] == nodeID: + mindTracker[i]['turns'] = 1 + mindTracker[i]['secret_code'] = '' + mindTracker[i]['cmd'] = 'new' else: msg += f"\nGuess{getEmojiMMind(user_guess)}\n" @@ -224,7 +232,7 @@ def playGameMMind(diff, secret_code, turn_count, nodeID, message): if user_guess == "XXXX": msg += f"⛔️Invalid guess. Please enter 4 valid colors letters.\n🔴🟢🔵🔴 is RGBR" return msg - check_guess = compareCodeMMind(secret_code, user_guess) + check_guess = compareCodeMMind(secret_code, user_guess, nodeID) # display turn count and feedback msg += "Turn {}:".format(turn_count)