Skip to content

feat(wordgame): add multiplayer PvP word guessing cog#184

Merged
psykzz merged 1 commit into
mainfrom
feature/wordgame
Jun 22, 2026
Merged

feat(wordgame): add multiplayer PvP word guessing cog#184
psykzz merged 1 commit into
mainfrom
feature/wordgame

Conversation

@psykzz

@psykzz psykzz commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new wordgame cog — a multiplayer PvP word-guessing game (Wordle-style) played entirely inside Discord threads. Anyone in a guild can start a game; players compete for points by probing letters rather than racing to guess the word.

Changes

  • wordgame/wordgame.py — main cog: /wordgame start [length] slash command, [p]wordgame end admin prefix command, on_message listener for in-thread guess processing, live scoreboard editing
  • wordgame/game.py — pure scoring logic: compute_feedback (produces ?!- strings, Wordle-style duplicate handling), compute_score (global position-claim tracking, word bonus), word-list helpers
  • wordgame/views.pyScoreboardView with a persistent 🔚 End Game button (admin-only); survives bot restarts via stable custom_id
  • wordgame/data/answers.txt — ~6k curated answer words (ENABLE list intersected with Google 10k common words, lengths 3–8)
  • wordgame/data/valid_words.txt — ~80k valid-guess dictionary (full ENABLE public-domain list, lengths 3–8)

How it works

  1. /wordgame start [length=5] picks a random word, posts an announcement in the channel, and creates a thread from it
  2. The first message in the thread is a live scoreboard — edited after every guess
  3. Players type words directly in the thread; the bot validates length + dictionary membership, scores the guess, and replies with feedback (! ? - per letter)
  4. Scoring (global scope): +1 per unique correct letter, +1 position bonus if no other player has already claimed that (letter, position) pair, +2 bonus for guessing the full word
  5. Max 3 guesses per player; game auto-ends when everyone is done
  6. Admins can force-end via [p]wordgame end or the 🔚 button on the scoreboard
  7. Game state is persisted to Red Config — active games resume after a bot restart

Testing

  • Python syntax: python -m py_compile wordgame/*.py
  • Lint: flake8 wordgame/ --max-line-length=100
  • Manual testing requires a running Red-bot instance with the cog loaded

Risk

  • No external dependencies added
  • No migrations required — new Config namespace (active_games per guild)
  • Word lists are public-domain (ENABLE lexicon)
  • on_message listener is scoped to active game threads only; no impact on other channels

Thread-based Wordle-style game. Anyone can start via slash
command; guesses are typed freely in the thread. Scoring is
global — first player to claim a (letter, position) pair takes
the points; no one else can score it. Full word guess earns +2
bonus. Up to 3 guesses per player; game ends when all are done
or an admin force-ends via command or scoreboard button.

Bundles ENABLE word list (public domain) split into a curated
answer pool (~6k words, lengths 3-8) and a broader valid-guess
dictionary (~80k). Word length is configurable at game start.
@psykzz psykzz added the enhancement New feature or request label Jun 22, 2026
@psykzz psykzz self-assigned this Jun 22, 2026
@psykzz psykzz merged commit 01610db into main Jun 22, 2026
3 checks passed
@psykzz psykzz deleted the feature/wordgame branch June 22, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant