UNPKG

@scrabble-solver/solver

Version:
20 lines (14 loc) 425 B
import { Cell } from '@scrabble-solver/types'; const generateStartIndices = (cells: Cell[]): number[] => { if (cells.length === 0) { return []; } const startIndices: number[] = [0]; for (let startIndex = 1; startIndex < cells.length - 1; ++startIndex) { if (!cells[startIndex - 1].hasTile()) { startIndices.push(startIndex); } } return startIndices; }; export default generateStartIndices;