scrabble: single-word rule requires in-line connection
Under PlayOptions.IgnoreCrossWords a play connected to the board through any perpendicular contact, even one forming a non-word, because connected() reused the standard rule's touchesPerpendicular test while cross-words were suppressed. That let an all-new word merely abut the board sideways and be accepted, and the generator, with relaxed cross-sets, offered such plays. Require the main word to run through an existing tile along the play direction when cross-words are ignored, and filter generated moves by the same predicate so generation agrees with ValidatePlayOpts. Standard rules are unchanged.
This commit is contained in:
+3
-2
@@ -79,7 +79,8 @@ type PlayOptions struct {
|
||||
// IgnoreCrossWords makes a play's perpendicular cross-words irrelevant: they are not
|
||||
// formed, validated, scored or used to constrain move generation. It expresses the
|
||||
// "single word per turn" house rule, under which only the main word along the play
|
||||
// direction must be a valid word; board connectivity and the first-move centre rule
|
||||
// still apply.
|
||||
// direction must be a valid word. That main word must still connect by running through
|
||||
// an existing tile along its line — a tile that only abuts the board perpendicular to
|
||||
// that line does not connect — and the first-move centre rule still applies.
|
||||
IgnoreCrossWords bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user