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({
requiredLetters: REQUIRED_LETTERS,
optionalLetters: OPTIONAL_LETTERS,
wordList: EXAMPLE_WORD_LIST,
});
// result = [ "ambulance", "albumen", "alumnae", "balance", "calumba", "canulae", ... ]