UNPKG

scrabble-solver

Version:

Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.

16 lines (12 loc) 673 B
import { type Board, type Config, HorizontalPattern, type Pattern } from '@scrabble-solver/types'; import { generatePattern } from './generatePattern'; import { generateVectors } from './generateVectors'; export const generateHorizontalPatterns = (config: Config, board: Board): Pattern[] => { const getNthVector = (index: number) => board.getRow(index); const vectorsCount = config.boardHeight; const horizontalVectors = generateVectors({ getNthVector, vectorsCount }); const horizontalPatterns = horizontalVectors.flatMap((cells) => { return generatePattern({ board, config, PatternModel: HorizontalPattern, cells }); }); return horizontalPatterns; };