feat: distinct response message for already-cited words#26
Merged
FlorentPoinsaut merged 3 commits intomainfrom Mar 8, 2026
Merged
feat: distinct response message for already-cited words#26FlorentPoinsaut merged 3 commits intomainfrom
FlorentPoinsaut merged 3 commits intomainfrom
Conversation
Copilot
AI
changed the title
[WIP] Add handling for already mentioned words
feat: distinct response message for already-cited words
Mar 6, 2026
- Add `already_cited` flag to `GuessResult` in game/state.py - Detect duplicate normalized words in `submit_guess()` before appending - Send a specific message in bot.py when a word was already suggested - Add `TestAlreadyCited` tests in test_game_state.py (7 tests) - Add 3 new tests in test_commands.py for the already-cited bot response Co-authored-by: FlorentPoinsaut <1256948+FlorentPoinsaut@users.noreply.github.com>
01fc049 to
4276c7a
Compare
Member
|
@copilot Les mots dupliqués sont quand même ajoutés au TOP GUESSES de l'overlay alors qu'ils ne devraient pas y être ajoutés |
Already-cited words are no longer appended to _history, so they no longer appear in top_guesses() and the overlay leaderboard. - game/state.py: skip _history.append() when already_cited=True - tests: assert duplicates NOT appended; fix test_top_guesses_respects_n to use distinct words; add test_already_cited_word_excluded_from_top_guesses Co-authored-by: FlorentPoinsaut <1256948+FlorentPoinsaut@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a player submits a word already guessed earlier in the same round, the bot responds with a distinct message and the duplicate word is excluded from the leaderboard and overlay.
Changes
game/state.py: Addedalready_cited: booltoGuessResult.submit_guess()checks whether the normalized word already exists in_historybefore appending. If the word was already cited, it is not appended to_history, preventing duplicates from appearing intop_guesses()and the overlay leaderboard.bot/bot.py: New branch inguesshandler for thealready_citedcase:'chien' has already been suggested (50% similarity).'chien' has already been suggested.is_foundstill takes priority — winning guesses always show the win message.Tests:
TestAlreadyCited(7 tests) intest_game_state.pycovering first-guess, same/different user, normalisation, duplicate exclusion from history, and new-game reset.TestGameStateLeaderboardupdated with a dedicated test verifying already-cited words are excluded fromtop_guesses(). Three new tests intest_commands.pycovering bot responses for scored, unscored, and winning already-cited words.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.