unscrambler 1.0.0+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 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:

  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


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:

  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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
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.

Analysis 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://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


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