Solving a ‘Word Wheel’ with Deno
How many different words can you make with a ‘Word Wheel’?
Rules
Each word must always include the centre letter, and each letter can only be used as many times as it is on the wheel (in the example below - ‘a’ is on the wheel twice, so it can be used twice in the same word).
Valid words
- Calm
- Ale
- Bale
Invalid words
- Hello (Invalid Letters)
- Cane (Middle letter not used)
- Mama (‘M’ used twice, despite only appearing in the wheel once)
How to use
import { wordWheel } from "word-wheel";
import { EXAMPLE_WORD_LIST } from "./example-word-list"; // use your own list of words
const REQUIRED_LETTERS = ["L"];
const OPTIONAL_LETTERS = ["A", "N", "C", "M", "U", "A", "B", "E"];
const result = wordWheel({
letters: {
requiredLetters: REQUIRED_LETTERS,
optionalLetters: OPTIONAL_LETTERS,
},
dictionary: EXAMPLE_WORD_LIST,
});
// result = [ "ambulance", "albumen", "alumnae", "balance", "calumba", "canulae", ... ]
By adding the lettersCanBeUsedMultipleTimes
option, you could use this
library to cheat the
NYT Spelling Bee. However, as
the dictionary the New York Times use isn’t public - you may get some false
positives. Best of luck getting those pangrams!
import { wordWheel } from "word-wheel";
import { EXAMPLE_WORD_LIST } from "./example-word-list"; // use your own list of words
const REQUIRED_LETTERS = ["L"];
const OPTIONAL_LETTERS = ["A", "N", "C", "M", "U", "A", "B", "E"];
const result = wordWheel({
letters: {
requiredLetters: REQUIRED_LETTERS,
optionalLetters: OPTIONAL_LETTERS,
},
dictionary: EXAMPLE_WORD_LIST,
options: {
lettersCanBeUsedMultipleTimes: true,
},
});
// result = [ "ambulanceman", "ambulancemen", "accumulable", "balanceable", "cancellable", "unblameable", ... ]
If you need an example dictionary to use checkout the word list used in the tests.