|No such thing as a small change|
Re^5: implementing a scrabble-esque game on Termux IIIby tybalt89 (Prior)
|on Dec 03, 2019 at 16:42 UTC||Need Help??|
Explanation of the masking in "matchrule"
Let's follow a call to matchrule('hello', '14222', 'world')
However, I want to change all non nulls ("\0") to "\xff" so that characters can pass through these positions unchanged.
Now we use this mask against the tile heights and look for any 5's, because the "\xff" in $newmask are at the positions where new tiles will be added.
and since there is no 5, the new word is not invalid (yet).
This leaves only the new tiles that must be played, ignoring the "\0"
because those positions use the old tile. So remove each new letter from
a string of the tile rack, and if any are not there, the move is invalid.