Summary of What Needs to be Done
Fix games/Reverse-Hangman-Game/Reverse-Hangman-Game.py. The WORDS_BY_LENGTH dictionary is a module-level global (defined on line 8) that gets populated inside the main() function. If main() is called multiple times (e.g., via module import or recursive calls), the dictionary accumulates duplicate word entries across calls because it is never cleared before repopulating. This causes the game to contain duplicate word entries in WORDS_BY_LENGTH, potentially leading to incorrect AI behavior.
Changes that Need to be Made
Move WORDS_BY_LENGTH = {} inside the main() function so it resets on each call, preventing accumulation of duplicate entries.
Impact that it would Provide
The AI in Reverse-Hangman will always have correct word sets regardless of how many times main() is invoked, preventing duplicate word entries from causing unpredictable AI behavior.
Note: please assign this issue to the tmdeveloper007 account.
Summary of What Needs to be Done
Fix
games/Reverse-Hangman-Game/Reverse-Hangman-Game.py. TheWORDS_BY_LENGTHdictionary is a module-level global (defined on line 8) that gets populated inside themain()function. Ifmain()is called multiple times (e.g., via module import or recursive calls), the dictionary accumulates duplicate word entries across calls because it is never cleared before repopulating. This causes the game to contain duplicate word entries inWORDS_BY_LENGTH, potentially leading to incorrect AI behavior.Changes that Need to be Made
Move
WORDS_BY_LENGTH = {}inside themain()function so it resets on each call, preventing accumulation of duplicate entries.Impact that it would Provide
The AI in Reverse-Hangman will always have correct word sets regardless of how many times
main()is invoked, preventing duplicate word entries from causing unpredictable AI behavior.Note: please assign this issue to the
tmdeveloper007account.