Speed up a slow loop
alex at tweedly.net
Wed Mar 9 19:23:12 EST 2022
Hmmm - I have to correct myself :-)
It's not 110; there are 144 digraphs on a 5x5 board
- nine centre tiles each have 8 neighbours
- four corner tiles each have 3 neighbours
- twelve remaining edge tiles each have 5 neighbours
giving 72 + 12 + 60 - so 144 pairs (already including both directions
for each adjacency).
Now if you allow edge-to-edge wrapping (i.e. from the top right tile you
can move to the right - and find yourself back on the top left, etc.)
then there are simply 25 * 8 pairs - but then you've moved a long way
from genuine Boggle rules :-)
On 09/03/2022 23:09, Alex Tweedly via use-livecode wrote:
> Yes, Quentin's allowing for diagonals (that's how the number of
> digraphs on a 5x5 board gets up to 110).
> And it's probably a good idea, allowing an even finer filter - if you
> aren't doing the boardwalk method..
> If you do use the boardwalk to generate the exact list of words, you
> get no benefit from single-letter or digraph filtering, because the
> tree-walk is constrained to only those valid "next char"s, and so
> implicitly avoids using those non-present digraphs.
> Oh - so many different ways to do things, all interesting, and all
> good for some variation of the problem.
> btw - that reminds me - back when I used to play real, physical Boggle
> with friends, we often played variants of the word rules; either
> - you can reuse the same tile later in a word (e.g.
> Y L A
> X E T
> would allow "lately" as a word.
> - you can double-up on a tile (e.g. M I L would allow 'mill')
> (more important if you're British than if you're American :-)
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode