Scramble Move Constraints

The following is a list of 8 move constraints, each of which corresponds to its own rule governing the legality of Scramble moves. Four of these constraints affect the outcome of the user clicking the "Next" button: only if all 4 are true does the next-player method of the game-server object get called. Two more constraints govern mouse operations (double-clicking and dragging) on the board, and the final 2 constraints determine whether or not the user may drag the table-top Card-stack to the bag Card-stack.

 

Next Button

1.  At least one letter placed on board in current turn must be adjacent to a letter placed on board in a previous turn. If this is the first turn, at least one letter must cover the center square.

2.  If the word is across, all letters must be in the same row. If the word is down, all letters must be in the same column. There can be no empty squares in the middle of the word.

3.  If challenging is disabled, all newly formed words, including those perpendicular to the main word, if any, must be in dictionary.

4.  If interchange-blanks enabled, and use-on-same-turn enabled, then the no. of blanks placed on board must be greater than or equal to the no. of interchanged blanks picked up in current turn.

 

Double-Click on Board

If interchange-blanks enabled, and clicked board square is a blank, and value of blank exists on rack, then interchange the blank.

 

Drag from Board

Disable drag if letter being dragged was not placed on board in current turn (see Feature 3 in Scramble Automation). No code is necessary to prevent dragging of letter/word premium Card objects, since their draggable property is false. Also, the user cannot drag a letter tile on top of another letter tile on the board, since the coverable property of every letter tile is false.

 

Drop on Bag

The table-top Card-stack is the only object that can be dragged to the bag. The grabbable property of the table-top is true, meaning that the user can "grab" the entire table-top by dragging a small semicircular "handle" jutting out of the left border of the table-top.

1.  If three-of-a-kind or four-of-a-kind enabled, and all letters in table-top, if included with letters on rack, are part of a 3-of-a-kind (or 4-of-a-kind), then accept drop. Otherwise do next rule.

2.  Assume the user is Scrambling. Prompt the user for confirmation: if yes then accept drop and end user's turn. If no then cancel drop.