Unscramble 1.0.3

dotnet add package Unscramble --version 1.0.3                
NuGet\Install-Package Unscramble -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Unscramble" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Unscramble --version 1.0.3                
#r "nuget: Unscramble, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Unscramble as a Cake Addin
#addin nuget:?package=Unscramble&version=1.0.3

// Install Unscramble as a Cake Tool
#tool nuget:?package=Unscramble&version=1.0.3                

Unscramble

Unscramble is a .NET package that can help you find all possible words from a list of letters. It is useful for solving word puzzles, crossword clues, or anagrams. Unscramble is fast, easy to use, and highly optimized.

publish NuGet Version NuGet Downloads

Installation

You can install Unscramble from NuGet, the package manager for .NET. To install Unscramble, run the following command in your terminal:

dotnet add package Unscramble

Usage

Loading words

Before you can use Unscramble to find words, you need to load the words into the an instance of IUnscramble. You can use any list of words that you want, as long as they are in a text file where each word is on a new line. You can find some examples of word lists online, such as:

To load the words from a file, you can use the BasicWordLoader class that comes with the package. It takes an IUnscramble object and a file path as parameters, and returns a boolean value indicating whether the loading was successful or not.

IUnscramble Unscramble = new BasicUnscramble();
IWordLoader loader = new BasicWordLoader("words.txt");

// Load words from a file
bool success = await loader.LoadFromFileAsync(Unscramble);

// If success is true, the words are loaded successfully
Implementing your own word loader

If you are already loading your words from a database or another source, can add the words to a IUnscramble like this:

IUnscramble Unscramble = new BasicUnscramble();
foreach (string word in words)
{
    Unscramble.AddWord(word);
}

You can also create your own implementation of the IWordLoader interface if you want to load words from a different source.

Finding words

Once you have loaded the words into the package, you can use the Unscramble method to find all the words that can be made from a list of letters. The method takes a string of letters as a parameter, and returns a HashSet<string> object that contains all the words found.

HashSet<string> words = Unscramble.Unscramble("letters");

You can then iterate over the HashSet<string> object to access the words, or use any other methods that are available for the HashSet<T> class.

Example

Here is a full example of how to use Unscramble to find words from a list of letters and print them to the console:

IUnscramble Unscramble = new BasicUnscramble();
IWordLoader loader = new BasicWordLoader("words.txt");

// Load words from a file
bool success = await loader.LoadFromFileAsync(Unscramble);

if (success)
{
    // Find words from a list of letters
    HashSet<string> words = Unscramble.Unscramble("letters");

    // Print the words to the console
    foreach (string word in words)
    {
        Console.WriteLine(word);
    }
}
else
{
    Console.WriteLine("Failed to load words from file.");
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 125 2/15/2024