Word search computer program

Here is a list of best free word search maker software for Windows. These software let you create word search puzzles for kids and students. These lets you enter a grid size for puzzle i.e. number of rows and columns. You can then add desired words which you want to include in the output word search puzzles. A few of these even provide an option to create wordlist from text or HTML file and include it in the final puzzle. Most of these provide a lot of puzzle customization options including word directions, title and narrative, text color, circle color, footer image, font, etc. You can also include solution in final output puzzle and customize solution format.

The final puzzle can be directly printed in all of these word search puzzle makers. Many of these also let you export final puzzle in PDF, SVG, PNG, BMP, JPG, GIF, etc. formats.

My Favorite Word Search Maker Software For Windows:

Word Search Creator by Matthew Wellings is my favorite word search maker for Windows. It provides a lot of puzzle customization options along with a few handy features like wordlist creator, various export formats, etc.

You may also like some best free Jigsaw Puzzle Maker, Word Guessing Games, and Maze Maker Software for Windows.

Word Search Creator by Matthew Wellings

Word Search Creator by Matthew Wellings is a free open source word search maker software for Windows. You can create a grid with number of rows and columns and then create a word search puzzle for it. It provides a lot of puzzle customization options plus supports a good number of output formats.

The main features of this word search puzzle maker are as follows:

  • You can customize word search by changing grid shape (mask drawer), setting allowed directions, etc.
  • It provides a wordlist creator which can create a list of words from HTML and text files. For this, you can specify max number of words and minimum and maximum word length. The wordlist can be sorted in alphabetical, word length, etc. orders. You can use this wordlist to create word search puzzle. Else, you can enter words manually too.
  • You can customize output puzzle by enabling show answer option.
  • It lets you customize font and color of title, word search, and wordlist. Also, you can set grid color, background color, and highlight color.
  • You can customize page layout and edit footer too.
  • The final word search puzzle can be exported as PDF or SVG file or can be directly printed. You can also copy puzzle as an image and paste it in any photo editor.

Word Search Creator by Canopus-Ware

Word Search Creator by , as the name suggests, is a free word search maker software for Windows. In it, you can create word search puzzle of a grid containing 8 to 20 rows and column. Here are some of its features which lets you customize word search grid and help you create a word search puzzle easily:

  • It lets you manually add words to create a word search puzzle, or you can even import a text, DOC, or HTML file to do the same. A maximum of 40 words can be added to a word search puzzle.
  • You can choose word search directions to create a puzzle.
  • It lets you place random letters to the word search grid to camouflage the words.
  • You can add a puzzle name too which will be included in the output.
  • After creating a word search puzzle, you can directly print it or save it in its native format.

Allin all, it is a nice and simple yet effective word search puzzle maker software.

FindThatWord

FindThatWord is a free open source word search maker software in this list. Here is the step by step procedure to create word search puzzle using this software:

  • First, create a new puzzle and enable “Force grid size to” option and enter number of rows and columns.
  • Now, type title of puzzle, narrative, and add words in one by one manner. You can add a hidden message too.
  • It lets you select what elements to show in output word search puzzle including Title and narrative, Word list, Grid, and Solution.
  • You can now save word search puzzle in its native format or export it as a PDF, SVG, PNG, or text file.

Word Search Maker

Word Search Maker is yet another free word search puzzle maker software for Windows. All word search puzzle customization options are provided on its main screen. You can specify grid size, words, and word directions to create a word search puzzle. Furthermore, you can also format puzzle by entering puzzle title, text color, grid color, footer image, word list position, etc. It lets you customize solution format too by customizing text color, circle color, footer image, title, etc. The preview of puzzle and solution can be seen on its main interface.

The final word search puzzle can be saved as a PDF file or can be directly printed. You also have the flexibility to save puzzle and solution separately as an image (BMP, GIF, PNG, TIFF, JPG).

Note: You will need a license key to unlock this software everytime you launch it. The license key is provided on the homepage which is given below.

Wordsearch Maker Junior

Wordsearch Maker Junior is a simple software to create word search puzzles. It has a fixed size grid (8×8) which is used in word search puzzle. The process of creating a word search puzzle is simple. First, you need to select a box in the grid and then right click on it to select a direction for word search. After that, you can type the word on the left side. Repeat this process to add multiple words to your puzzle. After creating word search puzzle, simply print it or save it as PDF using Options > Print option.

Word Search Generator UWP

Word Search Generator UWP is a free word search maker app for Windows 10. It lets you type a custom word list and specify grid width and height and filler letters to create a word search puzzle. You can customize output by enabling show puzzle, show answer, or show answer mark option and allow up to the right direction option. You can save the output puzzle as an image in PNG format or save it as a text file.

You can regenerate the puzzle to change the word positions.

Word Search Puzzle Maker

Word Search Puzzle Maker is a straightforward and basic word search puzzle maker for Windows. It provides separate tabs to add words and to create a word search puzzle using those words. Just add all words in Words tab; at most, 21 words can be added to a single word search puzzle. Then, move to Word Search tab to create word search puzzle. From here, you can save puzzle as PNG, BMP, or JPG image or you can print it. That’s it. You don’t get any customization options in it.

Top 4 Download periodically updates software information of word search full versions from the publishers,
but some information may be slightly out-of-date.

Using warez version, crack, warez passwords, patches, serial numbers, registration codes, key generator, pirate key, keymaker or keygen for
word search license key is illegal. Download links are directly from our mirrors or publisher’s website,
word search torrent files or shared files from free file sharing and free upload services,
including Rapidshare, MegaUpload, YouSendIt, Letitbit, DropSend, MediaMax, HellShare, HotFile, FileServe, LeapFile, MyOtherDrive or MediaFire,
are not allowed!

Your computer will be at risk getting infected with spyware, adware, viruses, worms, trojan horses, dialers, etc
while you are searching and browsing these illegal sites which distribute a so called keygen, key generator, pirate key, serial number, warez full version or crack for
word search. These infections might corrupt your computer installation or breach your privacy.
word search keygen or key generator might contain a trojan horse opening a backdoor on your computer.

Use the word processor’s search function to locate text and more

Updated on December 15, 2020

What to Know

  • Basic word search: Go to the Home tab. Select Find and enter the text for the search.
  • Advanced search: Go to Home > Find. Choose the search drop-down arrow. Select Options and select your criteria.

This article explains how to search for text in Microsoft Word. The information applies to Word 2019, Word 2016, Word 2013, Word 2010, Word Online, and Word for Microsoft 365.

How to Do a Basic Word Search in MS Word

Microsoft Word includes a search function that makes it easy to search for different elements in a document, including text. Use the basic tool to look for instances of a specific word, or the advanced options to perform tasks such as replace all instances of a word with another one or search for equations.

To run a basic search for a specific word or phrase in Word:

  1. Go to the Home tab and select Find, or press Ctrl+F.

    In older versions of Microsoft Word, select File > File Search.

  2. In the Navigation pane, enter the text you want to search for. A list of matching words displays in the Navigation pane and instances of the word are highlighted in the main document.

  3. Cycle through the results in the Navigation pane in one of three ways:

    • Press Enter to move to the next result.
    • Select a result with the mouse.
    • Select the Up and Down arrows to move to the previous or next result.
  4. Make any changes or edits to the document as needed.

  5. Select the Down arrow to move to the next instance of the word.

Match Case, Whole Words Only, and More

Beyond searching for every instance of a word, you can get more specific about what you want to find. For example, to find whole instances of a word and not every word that contains the letter combination or to find instances of a word that aren’t capitalized.

Here’s how to do an advanced search:

  1. Select Home > Find.

  2. In the Navigation pane, select the Search drop-down arrow.

  3. Choose Options.

  4. In the Find Options dialog box, choose the description that best fits what you’re trying to find. For example, to find instances of a word with the same capitalization, select Match case.

  5. Select OK.

Use Advanced Find

Many of the choices available in the Find Options dialog box are also available in Advanced Find. Advanced Find includes the option to replace the text with something new. Based on your selection, Word replaces one instance or all instances at once. You can also replace the formatting, or change the language, paragraph, and tab settings.

Find Instances of Other Elements

Other options in the Navigation pane include searching for equations, tables, graphics, footnotes, endnotes, and comments.

Thanks for letting us know!

Get the Latest Tech News Delivered Every Day

Subscribe

So you’re looking for the best free search tools for your Windows PC? Don’t worry; you’re at the right place. We’ve all searched for a program, file, or folder only to discover that the system search takes even longer to find results than it does just to find them manually yourself.

While there have always been some neat Windows Search tips and tricks, it has never been on par with the search features of Mac or Linux. Although Windows 10 did lessen the gap in a lot of ways, it’s still slow and imperfect comparatively. And that’s precisely why we’ve rounded up a list of the best, free Windows third-party search tools instead that will do the job for you instead.

1. Everything

everything main menu

While you can always rely on the Enhanced Search Mode in Windows 10, third-party apps have their place. Everything is consistently lauded as one of the fastest search tools for Windows. Using it is as simple as it gets: install it, open the program, and give it a bit to index your entire system (It can index a fresh Windows install in under a minute).

Once that’s done, all you have to do is type anything into the text field, and you will get instantaneous results as you type. And as long as you allow Everything to sit in the background and monitor system changes, it will always be instantaneous.

Best of all, it’s lightweight and takes up less than 5MB RAM and 1MB disk space. This is the absolute best tool to use for old and slow computers.

2. Listary

listary options

Of all the software on this list, Listary is probably the most different. Not only is it extremely minimal in design, but it stays completely out of your way until you need it as well. When you want to search, just start typing. It’s as easy as that.

And as you type, Listary will show you a list of all files on your system that match the query in real-time. Listary can also execute commands like Open Folder and Copy Folder Path. You can even use Listary to quickly hop into a different folder just by typing that folder’s name.

Some of its best features require Listary Pro, which is $20. But even with Listary Free, you get a lot of power and flexibility, which is one of the many reasons it makes it onto this list of the best Windows File Explorer extensions for file management.

3. grepWin

grepWin app menu

If you’re someone who likes to have a more hands-on approach with your PC, then grepWin will be one of the most useful tools you’ll have at your disposal. With it, you can search through any directory tree, and it will find files by matching contents with your search query (regular expressions are supported).

If you’ve ever used Linux, it’s basically the grep command (one of the essential Linux commands to know), but designed for Windows and comes with a nifty interface. So, the next time you need to search for a specific line of code or a specific line of documentation, this will cut your search time by orders of magnitude.

4. AstroGrep

astroGrep app menu

AstroGrep is a great alternative to grepWin if the latter doesn’t fit your fancy. It does the same thing—finds files that match your search query by content rather than file name—but is slightly less advanced and easier to use.

You can designate which file types to search, view file contents within AstroGrep itself, and save or print results for later. Potential future features include searching through PDFs, MP3s, ZIPs, RARs, and more.

AstroGrep has been around since 2006 and continues to receive regular updates.

5. SearchMyFiles

searchmyfiles main menu

SearchMyFiles may seem helplessly primitive at first glance, but it’s deceptively flexible. Once you get over the slight learning curve, you’ll be able to put together complex search queries using filters and wild cards.

For example, search all files created in the last 15 minutes, between 300 and 600 bytes in size, and containing the word error. The application is lightweight and portable (no installation required), so you can carry it around on a USB stick. NirSoft also maintains hundreds of other useful utilities that are all clean, portable, and available free of charge.

6. Exselo Desktop

exselo desktop main menu

Exselo Desktop isn’t as well-known as other free Windows 10 search tool options, which is a shame because it’s actually excellent. It supports powerful search queries, has a simple interface, securely shares data, and even integrates with Outlook.

Not only can it search local drives, but Exselo can also comb through network and cloud stores. And best of all, the Free edition is feature complete. The only difference between Free and Enterprise is support for multiple users.

7. Duplicate & Same Files Searcher

duplicate files search & link menu

Duplicate & Same Files Searcher is a tiny portable Windows 10 search program—around 1MB in size—that finds all files that are identical by content (not by file name). As such, the scanning process can be a bit slow, but you can filter and set parameters to speed things up.

And not only can the program delete said duplicates, but it can replace them with hard links that are basically shortcuts to one single file, thus saving you space without breaking anything in the meanwhile.

Can you guess how much of your hard drive space is wasted by duplicate files? The answer might surprise you. Duplicate files are more common than we tend to think, and if those duplicates are image, audio, or video files, they can take up a lot of unnecessary space.

8. Registry Finder

registry founder main menu

Registry Finder is another free Windows 10 search tool that makes registry navigation easy. It can also search keys according to when they were last modified, meaning this tool is helpful when you want to see all recent changes that were made (e.g., for troubleshooting).

Despite the improved search features in Windows 10, the registry is still a bit crude and could use a lot of love. Whether you would like to fix errors in the registry or make a few tweaks for usability, the process of finding keys can be slow and tedious—and that’s why Registry Finder really shines.

9. UltraSearch

ultrasearch app main window

UltraSearch is a creation of JAM Software. They are also the creators of the popular hard drive space recovery program, TreeSize. UltraSearch offers essential search features plus a few extras, all while keeping it simple and fast.

It works by directly searching the Master File Table (MFT). Within the search window, all important file information is displayed. It also displays all of your computer’s partitions and their total size and free space. Additional options include showing folders and/or files in a search, exclude filters, and printing the search results.

10. FileSearchEX

filesearchex-app-menu

If you prefer the style of search from Windows XP, FileSearchEX is the program for you. Not only is the search interface familiar and comfortable, the app itself is portable and uses minimal system resources.

However, there is one drawback: the free version is a trial—not in the sense that the program will expire and become unusable, but the search window will time out. Open the window, complete your search, then close it. If you do this promptly, you should be fine.

Overall, the search performance is OK. It isn’t nearly as fast as the other programs we tested, but we still noticed it was quicker than the default Windows Search and remains a good alternative.

11. Launchy

launchy app menu

Launchy is a nifty app that’s meant to replace the Start Menu, the Taskbar, the File Explorer, and desktop shortcuts. If you’ve ever used a Mac, then it’s a bit like Spotlight. Launchy indexes your entire system, then lets you launch files, apps, folders, and bookmarks with just a few keystrokes.

Most people think Launchy can only launch apps, but it can search files and folders if you enable the setting. Open Launchy with the Alt + Space shortcut, click the gear icon at the top right, go to the Catalog tab, find File Types in the right panel, then click «+» to add file types and directories that you want to include in the search.

12. Wise JetSearch

wise jetsearch main menu

Wise JetSearch is a free search tool for Windows 10. It is capable of searching all types of important files such as videos, music, images, and texts from the local drives and the removable drives.

Wise JetSearch can search all the hard drives and partitions, be they removable disks or secondary disk. It supports a variety of drive formats such as NTFS, FAT, and exFAT. Features like Quick Search and Preview Pane make using a Wise JetSearch a suitable alternative to the default Windows Search tool.

13. FileSeek

fileseek-pro-menu

If you are a Windows power user looking for more control of your searches, then FileSeek is your best bet. Through its Advance Querying feature, you can use regular expressions to go specific in your search commands.

Then there’s the feature of Tabbed Interface. You know how you have to wait for a search to get completed before you can look up something else on Windows? With FileSeek, you won’t have to wait like that anymore. Thanks to Tabbed Interface, you can look up multiple files in a single go.

You can also filter the search results by date (creation date, modification date, etc.) and size. There’s also a feature to copy the search result to a clipboard, and the ability to export them in formats like CSV and HTML.

These and many more such features make FileSeek an attractive choice for those of you who spend a lot of time using Windows 10. Also, you’ll receive a trial version of the Pro version after installation, which switches back to the free version after a short period.

14. Agent Ransack

agent ransack menu

Agent Ransack is a free Windows search tool available for both personal and commercial use. We like this app because it gives immediate results without you having to open the files and then look up the right information.

You can also share the search results with others through the printing, exporting, and reporting features that come with this tool. Agent Ransack is also available as a free commercial Windows search tool. For commercial purpose, the creators have branded it as FileLocator Lite, although, it’s essentially the same tool by the same company.

15. DocFetcher

docfetcher app main menu

Are you an open-source aficionado? Then you’ll probably like DocFetcher. It’s a free, open-source desktop search application that can help you search through heaps of files on your computer with blazing fast speed.

«You can think of it as Google for your local files. The application runs on Windows, Linux and OS X, and is made available under the Eclipse Public License,» writes DocFetcher on their homepage.

It supports the search of numerous types of files such as PST, HTML, RTF, ODT, MP3, JPEG, plain texts, .zip, and much more. With support for both 32- and 64-bit comes the pro-privacy policy of DocFetcher, which can be verified from their publicly accessible source code.

In times like ours, where privacy has become a joke, products like DocFetcher offer a breath of fresh air.

16. Glarysoft Quick Search

menu of the quick seach app

It’s a free PC search utility to help you find your files in a fast and efficient manner. Packed with a minimalist interface, the tool offers a search filter, real-time display panel, and a search box.

The software also offers a pro version that comes with added features, but the free version will do the job for most use cases. Apart from giving you relevant results, it will also notify you about junk files that you haven’t used and probably don’t even need.

17. SSuite Desktop Search

ssuitesoft main menu

Apart from its clutter-free and smooth searching abilities, SSuite Desktop Search tool offers a different but fledgling approach to software and its development: green software.

To put it briefly, green software is a type of software designed to be environmentally sustainable over a period of time.

The SSuite Desktop Search is designed to run on native Windows operating systems using the Win32 API structure, as opposed to other software products that run on Java or .NET. As a result, the latter products have higher memory requirements, resulting in a comparatively higher electrical consumption.

Also, note that when you install the free desktop search app, you’ll get a .zip file. To run it, you’ll first have to extract it locally on your PC. After that, you’ll be good to use the app.

For better and faster search results, go ahead and pick one of the above tools. The built-in Windows 10 search is getting better, but there’s still a long way to go before you can rely solely on it.

There might be many things that annoy and frustrate you in Windows 10, but the user base is so large that you’ll always be able to find a third-party software that improves upon Microsoft’s shortcomings. These nifty Windows search utilities here are proof of that.

This C# algorithm article demonstrates a way to search for words in a block of letters.

Word search puzzles contain hidden words.

We investigate a computer program that solves this kind of puzzle, such as those given to children to keep them busy.

English words are hidden in any direction inside a grid of letters.

Input puzzle

cat
dog
ead

Words found in this puzzle

cat found [top]
cod found [diagonal right]
dog found [middle]
toe found [diagonal left]
god found [middle backwards]
doc found [diagonal left backwards]

Example. To start, this is the complete implementation of a program that solves these puzzles. It uses several dictionary collections and populates one with data from a text file containing a list of English words.

And: An array is built from the input string, and then each square is searched in every direction using the word dictionary as a guide.

Word search program: C#

using System;
using System.Collections.Generic;
using System.IO;

enum WordType : byte
{
    FullWord,
    PartialWord,
    FullWordAndPartialWord
}

class Program
{
    static Dictionary<string, WordType> _words = new Dictionary<string, WordType>(400000, StringComparer.Ordinal);
    static Dictionary<string, bool> _found = new Dictionary<string, bool>(StringComparer.Ordinal);
    const int _minLength = 3; // Minimum length of matching words.
    const string _pattern = @"cat
dog
ead";

    static void Main()
    {
	// Read in dictionary.
	using (StreamReader reader = new StreamReader("enable1.txt"))
	{
	    while (true)
	    {
		string line = reader.ReadLine();
		if (line == null)
		{
		    break;
		}
		if (line.Length >= _minLength)
		{
		    for (int i = 1; i <= line.Length; i++)
		    {
			string substring = line.Substring(0, i);
			WordType value;
			if (_words.TryGetValue(substring, out value))
			{
			    // If this is a full word.
			    if (i == line.Length)
			    {
				// If only partial word is stored.
				if (value == WordType.PartialWord)
				{
				    // Upgrade type.
				    _words[substring] = WordType.FullWordAndPartialWord;
				}
			    }
			    else
			    {
				// If not a full word and only partial word is stored.
				if (value == WordType.FullWord)
				{
				    _words[substring] = WordType.FullWordAndPartialWord;
				}
			    }
			}
			else
			{
			    // If this is a full word.
			    if (i == line.Length)
			    {
				_words.Add(substring, WordType.FullWord);
			    }
			    else
			    {
				_words.Add(substring, WordType.PartialWord);
			    }
			}
		    }
		}
	    }
	}

	Console.WriteLine("[Read completed]");
	Console.ReadLine();

	// Write pattern.
	Console.WriteLine(_pattern);
	Console.WriteLine();

	// Split on newlines.
	string[] lines = _pattern.Split(new char[] { 'r', 'n' }, StringSplitOptions.RemoveEmptyEntries);

	// Put into 2D array.
	int height = lines.Length;
	int width = lines[0].Length;
	char[,] array = new char[height, width];
	for (int i = 0; i < width; i++)
	{
	    for (int a = 0; a < height; a++)
	    {
		array[a, i] = lines[a][i];
	    }
	}
	// Start at each square in the 2D array.
	for (int i = 0; i < width; i++)
	{
	    for (int a = 0; a < height; a++)
	    {
		// Search all directions.
		for (int d = 0; d < 8; d++)
		{
		    SearchAt(array, i, a, width, height, "", d);
		}
	    }
	}

	Console.WriteLine("[Search completed]");
	Console.ReadLine();
    }

    static void SearchAt(char[,] array,
	int i,
	int a,
	int width,
	int height,
	string build,
	int direction)
    {
	// Don't go past around array bounds.
	if (i >= width ||
	    i < 0 ||
	    a >= height ||
	    a < 0)
	{
	    return;
	}
	// Get letter.
	char letter = array[a, i];
	// Append.
	string pass = build + letter;
	// See if full word.
	WordType value;
	if (_words.TryGetValue(pass, out value))
	{
	    // Handle all full words.
	    if (value == WordType.FullWord ||
		value == WordType.FullWordAndPartialWord)
	    {
		// Don't display same word twice.
		if (!_found.ContainsKey(pass))
		{
		    Console.WriteLine("{0} found", pass);
		    _found.Add(pass, true);
		}
	    }
	    // Handle all partial words.
	    if (value == WordType.PartialWord ||
		value == WordType.FullWordAndPartialWord)
	    {
		// Continue in one direction.
		switch (direction)
		{
		    case 0:
			SearchAt(array, i + 1, a, width, height, pass, direction);
			break;
		    case 1:
			SearchAt(array, i, a + 1, width, height, pass, direction);
			break;
		    case 2:
			SearchAt(array, i + 1, a + 1, width, height, pass, direction);
			break;
		    case 3:
			SearchAt(array, i - 1, a, width, height, pass, direction);
			break;
		    case 4:
			SearchAt(array, i, a - 1, width, height, pass, direction);
			break;
		    case 5:
			SearchAt(array, i - 1, a - 1, width, height, pass, direction);
			break;
		    case 6:
			SearchAt(array, i - 1, a + 1, width, height, pass, direction);
			break;
		    case 7:
			SearchAt(array, i + 1, a - 1, width, height, pass, direction);
			break;
		}
	    }
	}
    }
}

Output

[Read completed]

cat
dog
ead

cat found
cod found
dog found
toe found
god found
doc found
[Search completed]

Description. How is the words Dictionary used? The words Dictionary is built up from the list of words on the disk. Each substring is taken from the word from the first character to further characters.

So: The word «man» has the substrings «m», «ma», and man encoded into the dictionary.

And: As the dictionary is built, the FullWord, PartialWord, and FullWordAndPartialWord enums are managed.

The search starts by looping over each element in the 2D array of letters we built. Then, the eight directions that each word can continue in are further scanned. SearchAt is where a search at a square on the grid continues.

The SearchAt method is recursive, which means it calls itself. It first detects invalid coordinates and returns early in this case. It takes the specified letter and builds up a new string with that letter at the end.

And: If that string is found in the Dictionary, we use additional logic to determine how to proceed.

Full words. In SearchAt, then, we check the built-up string to see if it is a full word. If it is, we display it unless we have already found it. No recursion is necessary on full words.

For partial words in SearchAt, we determine the search direction. The directions are restricted. The direction int is translated into a coordinate shift on the grid. Then SearchAt is recursively called to continue searching.

Note: The program uses a lot of knowledge from other articles on Dot Net Perls. Please see the relevant articles.

Dictionary StringComparerStreamReaderEnumTryGetValueSplitConsole.WriteLineConsole.ReadLine2D ArraySwitch

Text file. It is important you download the enable1.txt file for use in this program. This text file is available from the obsolete TheDeveloperBlog-controls project where it has been downloaded 156,000 times. It is 1.8 megabytes.

enable1.txt

Multidirectional. In this example, we enable multidirectional searching. As words are searched for in a puzzle, we can change direction to get each letter. With the complete code here, we explore a recursive searching algorithm guided by a hashtable.

Input puzzle 2

abc
def
ghi

Words found in the puzzle

abed found [top left]
defi found [middle]
bead found [top left]
bade found [top left]
badge found [left]
hied found [bottom]
head found [bottom]

There are some significant changes in this program. The input puzzle is read in from the console each time. It uses a 2D array indicating which squares have been used. And the search is not restricted to any direction.

C# program that implements multidirectional word search

using System;
using System.Collections.Generic;
using System.IO;

enum WordType : byte
{
    FullWord,
    PartialWord,
    FullWordAndPartialWord
}

class Program
{
    static Dictionary<string, WordType> _words = new Dictionary<string, WordType>(400000);
    static Dictionary<string, bool> _found = new Dictionary<string, bool>();
    const int _minLength = 4; // Minimum length of matching words.

    static string Input()
    {
	Console.WriteLine("Input lines of text and then a blank line.");
	string total = "";
	while (true)
	{
	    // Get line.
	    string line = Console.ReadLine();
	    if (string.IsNullOrWhiteSpace(line))
	    {
		return total.Trim();
	    }
	    total += line.Trim();
	    total += "rn";
	}
    }

    static void Main()
    {
	// Read in dictionary.
	using (StreamReader reader = new StreamReader("enable1.txt"))
	{
	    while (true)
	    {
		string line = reader.ReadLine();
		if (line == null)
		{
		    break;
		}
		if (line.Length >= _minLength)
		{
		    for (int i = 1; i <= line.Length; i++)
		    {
			string substring = line.Substring(0, i);
			WordType value;
			if (_words.TryGetValue(substring, out value))
			{
			    // If this is a full word.
			    if (i == line.Length)
			    {
				// If only partial word is stored.
				if (value == WordType.PartialWord)
				{
				    // Upgrade type.
				    _words[substring] = WordType.FullWordAndPartialWord;
				}
			    }
			    else
			    {
				// If not a full word and only partial word is stored.
				if (value == WordType.FullWord)
				{
				    _words[substring] = WordType.FullWordAndPartialWord;
				}
			    }
			}
			else
			{
			    // If this is a full word.
			    if (i == line.Length)
			    {
				_words.Add(substring, WordType.FullWord);
			    }
			    else
			    {
				_words.Add(substring, WordType.PartialWord);
			    }
			}
		    }
		}
	    }
	}

	// Get pattern.
	string pattern = Input();

	// Write pattern.
	Console.WriteLine(pattern);
	Console.WriteLine();

	// Split on newlines.
	string[] lines = pattern.Split(new char[] { 'r', 'n' },
	    StringSplitOptions.RemoveEmptyEntries);

	// Put into 2D array.
	int height = lines.Length;
	int width = lines[0].Length;
	char[,] array = new char[height, width];
	for (int i = 0; i < width; i++)
	{
	    for (int a = 0; a < height; a++)
	    {
		array[a, i] = lines[a][i];
	    }
	}
	// Create empty covered array.
	bool[,] covered = new bool[height, width];

	// Start at each square in the 2D array.
	for (int i = 0; i < width; i++)
	{
	    for (int a = 0; a < height; a++)
	    {
		Search(array, i, a, width, height, "", covered);
	    }
	}
    }

    static void Search(char[,] array,
	int i,
	int a,
	int width,
	int height,
	string build,
	bool[,] covered)
    {
	// Don't go past around array bounds.
	if (i >= width ||
	    i < 0 ||
	    a >= height ||
	    a < 0)
	{
	    return;
	}
	// Don't deal with already covered squares.
	if (covered[a, i])
	{
	    return;
	}
	// Get letter.
	char letter = array[a, i];
	// Append.
	string pass = build + letter;
	// See if full word.
	WordType value;
	if (_words.TryGetValue(pass, out value))
	{
	    // Handle all full words.
	    if (value == WordType.FullWord ||
		value == WordType.FullWordAndPartialWord)
	    {
		// Don't display same word twice.
		if (!_found.ContainsKey(pass))
		{
		    Console.WriteLine("{0} found", pass);
		    _found.Add(pass, true);
		}
	    }
	    // Handle all partial words.
	    if (value == WordType.PartialWord ||
		value == WordType.FullWordAndPartialWord)
	    {
		// Copy covered array.
		bool[,] cov = new bool[height, width];
		for (int i2 = 0; i2 < width; i2++)
		{
		    for (int a2 = 0; a2 < height; a2++)
		    {
			cov[a2, i2] = covered[a2, i2];
		    }
		}
		// Set this current square as covered.
		cov[a, i] = true;

		// Continue in all directions. [8]
		Search(array, i + 1, a, width, height, pass, cov);
		Search(array, i, a + 1, width, height, pass, cov);
		Search(array, i + 1, a + 1, width, height, pass, cov);
		Search(array, i - 1, a, width, height, pass, cov);
		Search(array, i, a - 1, width, height, pass, cov);
		Search(array, i - 1, a - 1, width, height, pass, cov);
		Search(array, i - 1, a + 1, width, height, pass, cov);
		Search(array, i + 1, a - 1, width, height, pass, cov);
	    }
	}
    }
}

Output

Input lines of text and then a blank line.
abc
def
ghi

abc
def
ghi

abed found
defi found
bead found
bade found
badge found
hied found
head found

The Search method is a recursive method: it calls itself. It can call itself eight times on each call. This is to go in every possible direction from a single square. At the start of Search, we have some bounds checking logic.

Then: We check the covered array to make sure a letter has not already been used.

Recursion

The algorithm uses an array of booleans. This indicates what squares have been used already in the search path. The array must be copied each time it is changed. At the start of Search, we see if the current square is already covered.

Info: If we did not copy the covered array, the algorithm would fail because previous search paths would have covered squares.

Summary. With this program, we search for and list all the words embedded in word search puzzles. The hard part is inputting the text file into the program. Further changes to this program could make the pattern of letters read in from a text file.

Caution: The implementation here is inefficient. The most efficient representation of the word dictionary would be a DAWG structure.

Finally: Programming game algorithms is one of the best ways to learn complex programming techniques.

DAWG


Related Links

Adjectives
Ado
Ai
Android
Angular
Antonyms
Apache
Articles
Asp
Autocad
Automata
Aws
Azure
Basic
Binary
Bitcoin
Blockchain
C
Cassandra
Change
Coa
Computer
Control
Cpp
Create
Creating
C-Sharp
Cyber
Daa
Data
Dbms
Deletion
Devops
Difference
Discrete
Es6
Ethical
Examples
Features
Firebase
Flutter
Fs
Git
Go
Hbase
History
Hive
Hiveql
How
Html
Idioms
Insertion
Installing
Ios
Java
Joomla
Js
Kafka
Kali
Laravel
Logical
Machine
Matlab
Matrix
Mongodb
Mysql
One
Opencv
Oracle
Ordering
Os
Pandas
Php
Pig
Pl
Postgresql
Powershell
Prepositions
Program
Python
React
Ruby
Scala
Selecting
Selenium
Sentence
Seo
Sharepoint
Software
Spellings
Spotting
Spring
Sql
Sqlite
Sqoop
Svn
Swift
Synonyms
Talend
Testng
Types
Uml
Unity
Vbnet
Verbal
Webdriver
What
Wpf

Понравилась статья? Поделить с друзьями:
  • Word search blank form
  • Word search bible words
  • Word search assistant скачать
  • Word search app game
  • Word search app android