Rich, are the words in your files alphabetically sorted?
If you load all the words in a sorted order into an array, you could create another array with indices pointing to the first word starting with each letter. Then you would be able to select the words to check faster.
Further, if you added another level of indices to indicate the location for each letter in the second position, associated with the first position letter, your search would be even faster.
In T2, a tree could be created to quickly find a target match, or failure.
Doing the same in T1 is a bit more difficult, but probably not impossible. You would need an array of integers dimmed to 26 to the power of whatever level of indexing you want. E.g. for only the first letter, it would be 26^1. For first two it would be 26^2.
The array would then be structured something like this:
wrd_ind[1] = index to first word starting with 'A'
wrd_ind[2] = index to first word starting with 'AA'
wrd_ind[3] = index to first word starting with 'AB'
...
wrd_ind[27] = index to first word starting with 'AZ'
wrd_ind[28] = index to first word starting with 'B'
wrd_ind[29] = index to first word starting with 'BA'
The search might do something like:
// Target word is 'TEST', search array only goes to two characters
// Set up constants for the core ASC values
// Figure out the first 'pointer' index
ptr_ind = (ASC(LEFT(tstwrd$,1)) - ASC('A')) * 27 + 1 + (ASC(MID(tstwrd$,2,1)) - ASC('A')) + 1
// pick up the index range to compare to
ind_1 = wrd_ind[ptr_ind]
ind_2 = wrd_ind[ptr_ind+1] - 1
// search for match
for ind=ind_1 to ind_2
// check for match in your word array at ind to tstwrd$
next ind
This is a very quickly put together bit, not cleaned up.
Cheers,
Ancient Lady
AGK Community Tester