unscrambler 1.0.0+2

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

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

Alternatively, your editor might support pub 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
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

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