unscrambler 1.0.0+2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 72

unscrambler

Dart scrabble word unscrambler, for use in word games (i.e. Scrabble) or as an int32 benchmark reference.

Unscrambler requires a word list, sowpods is included (official Scrabble word list, over 200000 words).

The program will preprocess each word and convert it into a list of int32 values.

To find matches, it will then run over all word int32 values and find matches using only 2 bitwise operations.

The algo is quite fast, on my machine it can find all matching words for a given scrambled word in about 4ms.

Build Status

Try It Now

Add the unscramble package to your pubspec.yaml file:

dependencies:
  unscramble: any

Usage

  void main() {
    final String V = 'stbalet'; // scrambled word
    final int numBlanks = 0; // Scrabble blank letters
    final String C = new File('bin/sowpods.txt').readAsStringSync(); // word list
    final Dictionary D = new Dictionary(C);
    
    print(match(D, V, numBlanks)); // all matches
    print(anagrams(D, V)); // all anagrams of the same word length
  }

1.0.0

  • Some cleanups for Dart 2

example/example.dart

import 'dart:io';

import 'package:unscrambler/unscrambler.dart';

void main() {
  /// Fetch the English words dictionary file
  final allWords = new File('bin/sowpods.txt').readAsStringSync(),
      dictionary = new Dictionary(allWords);

  /// let's define a Scrabble play state:
  /// We have 7 letters, 6 of those are random, 1 is blank (wildcard)
  const rndLetters = 'paenxd', numWildcards = 1;
  final allWordMatches = dictionary.match(rndLetters, numWildcards);

  /// now we only care for words that are 7 letters large
  print(allWordMatches.where((bin) => bin.word.length >= 7));

  /// yields (expands, spandex)

  /// you can also list all anagrams of any given word:
  print(dictionary.anagrams('battles', 0));

  /// yields [batlets, battels, battles, blatest, tablets]
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  unscrambler: "^1.0.0+2"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:unscrambler/unscrambler.dart';
  
Version Uploaded Documentation Archive
1.0.0+2 Jun 26, 2018 Go to the documentation of unscrambler 1.0.0+2 Download unscrambler 1.0.0+2 archive
1.0.0+1 Jun 26, 2018 Go to the documentation of unscrambler 1.0.0+1 Download unscrambler 1.0.0+1 archive
1.0.0 Jun 26, 2018 Go to the documentation of unscrambler 1.0.0 Download unscrambler 1.0.0 archive
0.9.6 Aug 21, 2014 Go to the documentation of unscrambler 0.9.6 Download unscrambler 0.9.6 archive
0.9.5 Aug 21, 2014 Go to the documentation of unscrambler 0.9.5 Download unscrambler 0.9.5 archive
0.9.4 Aug 20, 2014 Go to the documentation of unscrambler 0.9.4 Download unscrambler 0.9.4 archive
0.9.3 Aug 20, 2014 Go to the documentation of unscrambler 0.9.3 Download unscrambler 0.9.3 archive
0.9.1 Aug 20, 2014 Go to the documentation of unscrambler 0.9.1 Download unscrambler 0.9.1 archive
0.9.0 Aug 20, 2014 Go to the documentation of unscrambler 0.9.0 Download unscrambler 0.9.0 archive

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
43 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
72
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:unscrambler/unscrambler.dart.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.51.0 <2.0.0
Dev dependencies
benchmark_harness any
test any