Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The searching you are trying to do now really becomes "heavy duty" - it's no longer a single word. I recommend you use grep., rather than making your own code. I am going to assume you can do this on a linux (Mac OS) type machine ... not too familiar with Windows, sorry.</p> <p>The basic approach is this: Your grid of 10x10 can be turned into a total of 40 strings (10 each horizontal and vertical) x 2 [ because you can read backwards ]. Put those 40 strings, one line at a time, into a file we call <code>file.txt</code></p> <p>Now comes the magic. There is a very fast version of grep that looks for an "exact match" of the key, using the <code>-F</code> option. Assume your "valid words" are in a second file named <code>valid.txt</code>. From the directory where both these files are located, execute the following command:</p> <pre><code>grep -oF valid.txt file.txt &gt; words.txt </code></pre> <p>Here is the explanation: </p> <pre><code>-o : output the matched string, not the line found -F : do not do pattern matching; look for an exact match (much, much faster - not available in all versions of grep. If you don't have it, use -f instead) valid.txt : file with the 'keys' (good words) file.txt : file to be searched for the keys &gt; : send the output of the command... words.txt : ... to this file </code></pre> <p>You could call this command from inside your java program (see for example <a href="http://javaevangelist.blogspot.com/2008/08/making-system-call-in-java.html" rel="nofollow">this link</a>), and read the file back in. It will save you some programming, and it will quite likely be much faster than anything you can code yourself.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload