mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 00:52:40 +00:00
Add adventure plugin, holdem CFR fixes, and wordle plugin
Adventure: Complete v1 daily idle RPG with DM-driven gameplay, equipment shop, treasure system, TwinBee NPC, streak/grudge/party mechanics, flavor text, and scheduled morning/evening/midnight tickers. Holdem CFR: Fix three critical training bugs (fold not forfeiting pot, free calls after raises, training/runtime key mismatch). Add performance optimizations (preflop lookup table, zero-alloc equity, integer keys, raise cap, regret pruning). Enrich abstraction with 12 equity buckets, board texture dimension, and 6-char action history. Replace validation with proper multi-street simulation. Also includes wordle plugin, holdem seed tooling, and schema additions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
57
internal/plugin/wordle_fallback.go
Normal file
57
internal/plugin/wordle_fallback.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log/slog"
|
||||
"math/rand/v2"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
fallbackWords map[int][]string
|
||||
fallbackWordsOnce sync.Once
|
||||
)
|
||||
|
||||
// loadFallbackWords loads the emergency word list from data/wordle_words.txt.
|
||||
// Each line is one word. Words are grouped by length.
|
||||
func loadFallbackWords() {
|
||||
fallbackWords = make(map[int][]string)
|
||||
|
||||
path := "data/wordle_words.txt"
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
slog.Warn("wordle: fallback word list not found", "path", path)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
word := strings.TrimSpace(scanner.Text())
|
||||
if word == "" || strings.HasPrefix(word, "#") {
|
||||
continue
|
||||
}
|
||||
word = strings.ToUpper(word)
|
||||
n := len([]rune(word))
|
||||
if n >= 5 && n <= 7 {
|
||||
fallbackWords[n] = append(fallbackWords[n], word)
|
||||
}
|
||||
}
|
||||
|
||||
for n, words := range fallbackWords {
|
||||
slog.Info("wordle: loaded fallback words", "length", n, "count", len(words))
|
||||
}
|
||||
}
|
||||
|
||||
// pickFallbackWord picks a random word of the given length from the fallback list.
|
||||
func pickFallbackWord(length int) string {
|
||||
fallbackWordsOnce.Do(loadFallbackWords)
|
||||
|
||||
words := fallbackWords[length]
|
||||
if len(words) == 0 {
|
||||
return ""
|
||||
}
|
||||
return words[rand.IntN(len(words))]
|
||||
}
|
||||
Reference in New Issue
Block a user