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.

18 lines (13 loc) 414 B
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; export const getCoordinate = (index: number, type: 'letter' | 'number'): string => { if (type === 'number') { return String(index + 1); } let result = ''; let nextIndex = index; while (nextIndex >= 0) { result = alphabet[nextIndex % alphabet.length] + result; nextIndex = Math.floor(nextIndex / alphabet.length) - 1; } return result; };