Files
tiennm99bot/internal/modules/wordle/compare.go
T
tiennm99 c0231ceadf feat(wordledaily): add the daily Wordle HTML5 game
/wordledaily sends a BotFather game card whose page plays one shared word
per day, changing at 07:00 ICT. The server checks guesses, saves each
player's board after every guess and keeps NYT-style stats. A win is
reported with setGameScore, and in a group one live results message shows
everyone's colour grids.

/wordledaily_subscribe and /wordledaily_unsubscribe opt a chat or topic in
to the 07:00 push: yesterday's recap, opening with the answer and the
group's win streak, then today's card.

The HTML5 game plumbing that noitu used is now shared in util/htmlgame, and
the wordle word list and scoring live in wordle/wordlist.
2026-10-09 17:20:02 +07:00

25 lines
997 B
Go

// Package wordle implements the classic 5-letter word-guess game, scored
// letter-by-letter green/yellow/grey. The word data and scoring live in the
// wordlist subpackage, shared with wordledaily.
package wordle
import "github.com/tiennm99/tiennm99bot/internal/modules/wordle/wordlist"
// WordLength is wordle's fixed 5.
const WordLength = wordlist.WordLength
// Letter result categories stored in LetterScore.Result. The values are part
// of the stored game document's shape, so changing one orphans saved rounds.
const (
ResultCorrect = wordlist.ResultCorrect
ResultPartial = wordlist.ResultPartial
ResultWrong = wordlist.ResultWrong
)
// LetterScore is one scored letter, stored per guess (nested in GameState).
type LetterScore = wordlist.LetterScore
// CompareWords scores guess against the answer letter-by-letter, handling
// duplicate letters the NYT way. See wordlist.Compare.
func CompareWords(guess, answer string) []LetterScore { return wordlist.Compare(guess, answer) }