256999b42c
- Rename module to gitea.iliadenisov.ru/developer/scrabble-solver so it can be consumed as a versioned dependency (no go.work replace / CI clone). - De-internalize wordlist and dictdawg as public packages. - Remove cmd/builddict, dictprep/, the dictionaries submodule and the dawg Makefile: the word-list parsing and DAWG build now live in the separate scrabble-dictionary repository, which publishes the DAWG set as a release artifact. - internal/dict loads the committed dawg/en_sowpods.dawg fixture for cmd/stress. - Update README/CLAUDE docs accordingly.
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package selfplay_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/iliadenisov/alphabet"
|
|
|
|
"gitea.iliadenisov.ru/developer/scrabble-solver/dictdawg"
|
|
"gitea.iliadenisov.ru/developer/scrabble-solver/rules"
|
|
"gitea.iliadenisov.ru/developer/scrabble-solver/scrabble"
|
|
"gitea.iliadenisov.ru/developer/scrabble-solver/selfplay"
|
|
"gitea.iliadenisov.ru/developer/scrabble-solver/wordlist"
|
|
)
|
|
|
|
func TestPlayGameSmoke(t *testing.T) {
|
|
rs := rules.English()
|
|
words := wordlist.Encode([]string{
|
|
"cat", "cats", "car", "care", "cares", "cot", "cap", "cab", "at", "as",
|
|
"tea", "eat", "ear", "era", "are", "oat", "oats", "sat", "set", "sea",
|
|
"tar", "tars", "star", "arts", "rat", "rats", "ace", "aces", "scar", "scare",
|
|
}, alphabet.Latin(), 2, 15)
|
|
f, err := dictdawg.Build(alphabet.Latin(), words)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
gen := scrabble.NewDAWGGenerator(rs, f)
|
|
|
|
res := selfplay.PlayGame(rs, gen, scrabble.Both, 1, nil)
|
|
if res.Turns == 0 || res.Plays == 0 {
|
|
t.Errorf("degenerate game: %+v", res)
|
|
}
|
|
t.Logf("smoke game: turns=%d plays=%d scores=%v", res.Turns, res.Plays, res.Scores)
|
|
}
|