package engine import "testing" // TestSingleWordRuleWiring confirms Options.MultipleWordsPerTurn reaches the solver. The // single-word game ignores perpendicular cross-words, so move generation from a shared // position is a superset of the standard game's; the standard game does not relax them. func TestSingleWordRuleWiring(t *testing.T) { const seed = 7 mk := func(multipleWords bool) *Game { g, err := New(testReg, Options{ Variant: VariantEnglish, Version: testVersion, Players: 2, Seed: seed, MultipleWordsPerTurn: multipleWords, }) if err != nil { t.Fatalf("new game: %v", err) } return g } std, single := mk(true), mk(false) if std.playOpts().IgnoreCrossWords { t.Error("standard game must not ignore cross-words") } if !single.playOpts().IgnoreCrossWords { t.Error("single-word game must ignore cross-words") } // Play the same opening (the standard game's top move) in both games, then compare // the next player's candidate moves. Both games share the seed, so the next rack is // identical; relaxed (single-word) generation never drops a legal standard move. hint, ok := std.HintView() if !ok { t.Fatal("opening game has no hint") } if _, err := std.SubmitPlay(hint.Tiles); err != nil { t.Fatalf("standard opening: %v", err) } if _, err := single.SubmitPlay(hint.Tiles); err != nil { t.Fatalf("single-word opening: %v", err) } stdMoves, singleMoves := len(std.GenerateMoves()), len(single.GenerateMoves()) if singleMoves < stdMoves { t.Errorf("single-word generation produced %d moves, want >= standard %d", singleMoves, stdMoves) } }