import { describe, expect, it } from 'vitest'; import { BOARD_SIZE, centre, premiumGrid } from './premiums'; // Premium-square geometry parity with scrabble-solver/rules/rules.go: english/russian // share standardBoard (centre is a double word); erudit shares the geometry but a // non-doubling centre. Tile-value and alphabet parity moved to the Go engine test // (backend/internal/engine AlphabetTable) in Stage 13 — the server now owns that table. describe('premium layout', () => { it('is a 15x15 grid with TW corners', () => { const g = premiumGrid('english'); expect(g.length).toBe(BOARD_SIZE); expect(g[0].length).toBe(BOARD_SIZE); for (const [r, c] of [ [0, 0], [0, 14], [14, 0], [14, 14], ]) { expect(g[r][c]).toBe('TW'); } }); it('doubles the centre for standard variants but not for erudit', () => { expect(centre('english')).toEqual({ row: 7, col: 7 }); expect(premiumGrid('english')[7][7]).toBe('DW'); expect(premiumGrid('russian')[7][7]).toBe('DW'); expect(centre('erudit')).toEqual({ row: 7, col: 7 }); expect(premiumGrid('erudit')[7][7]).toBe(''); }); it('keeps the standard premium counts', () => { const flat = premiumGrid('english').flat(); const count = (p: string) => flat.filter((x) => x === p).length; expect(count('TW')).toBe(8); expect(count('TL')).toBe(12); expect(count('DL')).toBe(24); expect(count('DW')).toBe(17); // 16 double-word squares + the centre }); });