scrabble-solver 2.18.1 → 2.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +1721 -1473
- package/.nx/workspace-data/lockfile-dependencies.hash +1 -1
- package/.nx/workspace-data/lockfile-nodes.hash +1 -1
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/parsed-lock-file.dependencies.json +184 -209
- package/.nx/workspace-data/parsed-lock-file.nodes.json +374 -419
- package/.nx/workspace-data/project-graph.json +610 -653
- package/.nx/workspace-data/source-maps.json +68 -0
- package/CLAUDE.md +13 -11
- package/README.md +3 -3
- package/bun.lock +115 -130
- package/e2e/bugs/398-digraphs-in-created-words.spec.ts +2 -2
- package/e2e/bugs/445-tile-text-selection.spec.ts +38 -0
- package/e2e/bugs/451-results-list-gap-hover.spec.ts +35 -0
- package/e2e/bugs/452-stale-translations-cache.spec.ts +32 -0
- package/e2e/features/427-highlight-created-words.spec.ts +86 -0
- package/e2e/features/430-highlight-unreachable-cells-results.spec.ts +75 -0
- package/e2e/features/91-hover-remaining-tile-highlights.spec.ts +22 -0
- package/e2e/features/result-candidate-picker.spec.ts +21 -0
- package/e2e/features/results-interactions.spec.ts +170 -0
- package/e2e/features/words-dictionary-search.spec.ts +36 -0
- package/e2e/features/words-empty-state.spec.ts +42 -0
- package/e2e/features/words-interactions.spec.ts +179 -0
- package/e2e/features/words-preview.spec.ts +140 -0
- package/e2e/features/words-table-filtering.spec.ts +22 -0
- package/e2e/features/words-table-sorting.spec.ts +33 -0
- package/e2e/lib/actions.ts +76 -6
- package/e2e/lib/selectors.ts +40 -3
- package/lerna.json +1 -1
- package/package.json +10 -10
- package/packages/configs/build/games/index.d.ts +1 -0
- package/packages/configs/build/games/index.js +1 -0
- package/packages/configs/build/games/wyrazy.d.ts +19 -0
- package/packages/configs/build/games/wyrazy.js +73 -0
- package/packages/configs/build/languages/polish.d.ts +1 -0
- package/packages/configs/build/languages/polish.js +39 -1
- package/packages/configs/package.json +5 -4
- package/packages/configs/src/games/index.ts +1 -0
- package/packages/configs/src/games/wyrazy.ts +71 -0
- package/packages/configs/src/languages/polish.ts +40 -1
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package.json +1 -1
- package/packages/logger/scripts/stats.js +52 -31
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +14 -14
- package/packages/scrabble-solver/.next/cache/.previewinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.rscinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -1
- package/packages/scrabble-solver/.next/dynamic-css-manifest.json +2 -2
- package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
- package/packages/scrabble-solver/.next/react-loadable-manifest.json +37 -37
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/309.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/344.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/371.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/392.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/465.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/546.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/641.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/67.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/712.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/812.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/846.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/886.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/942.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/953.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/961.js +1 -1
- package/packages/scrabble-solver/.next/server/dynamic-css-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/500.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/_app.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js +2 -2
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/index.js +4 -4
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/not-found.html +3 -3
- package/packages/scrabble-solver/.next/server/pages/not-found.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages-manifest.json +1 -1
- package/packages/scrabble-solver/.next/static/{5KOWzYqfY1Z2rjrzptr8D → 8WnIUTe-yJvPD6stltvYI}/_buildManifest.js +1 -1
- package/packages/scrabble-solver/.next/static/chunks/100.305bdf9c75b1758f.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/256.6a20b23a766cfebd.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{307.67f52f13e3d60d4e.js → 307.89e6100f58443679.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/{363.01eed3233f92b6a4.js → 363.cec65b1f9668a75e.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/{422.1559ae6756912ca5.js → 422.3e55b4c94e328701.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/{663.d2c9ca36b26695b8.js → 663.bd2c45413fbca518.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/693.677c88e0eb1340b5.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{820.97b82f751ca49579.js → 820.823e9e885ebb66af.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/827.c81b92b383a748c9.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{865.a9b563a45848a83c.js → 865.59baba8296c9b116.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/912.077603e4f0bc6cca.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{939.19b33a3d3c351d73.js → 939.2ad86b50405c7897.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/980.7ce17464fc56648a.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{main-b92e08f3fc96dd8d.js → main-7e52da35a4beea0b.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-e3fe880e24c024ab.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-b073a1686818dd26.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/webpack-d7138f1ef6b8c9d6.js +1 -0
- package/packages/scrabble-solver/.next/static/css/65bcc9440e067113.css +1 -0
- package/packages/scrabble-solver/.next/static/css/{4dbcacc1122ac6b9.css → 92f85ce358a0a468.css} +1 -1
- package/packages/scrabble-solver/.next/static/css/a691348b788f8bc0.css +1 -0
- package/packages/scrabble-solver/.next/static/css/cd4d7f2458487399.css +1 -0
- package/packages/scrabble-solver/.next/trace +22 -21
- package/packages/scrabble-solver/.next/trace-build +1 -1
- package/packages/scrabble-solver/AGENTS.md +9 -0
- package/packages/scrabble-solver/CLAUDE.md +1 -0
- package/packages/scrabble-solver/package.json +13 -11
- package/packages/scrabble-solver/public/llms.txt +1 -1
- package/packages/scrabble-solver/public/service-worker.js +1 -1
- package/packages/scrabble-solver/src/components/Board/Board.tsx +3 -1
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +26 -20
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +4 -4
- package/packages/scrabble-solver/src/components/Board/lib.test.ts +106 -0
- package/packages/scrabble-solver/src/components/Board/lib.ts +34 -3
- package/packages/scrabble-solver/src/components/Board/selectors.ts +17 -5
- package/packages/scrabble-solver/src/components/Button/Button.module.scss +1 -1
- package/packages/scrabble-solver/src/components/Modal/Modal.module.scss +0 -4
- package/packages/scrabble-solver/src/components/Results/Header.tsx +30 -5
- package/packages/scrabble-solver/src/components/Results/Result.tsx +45 -55
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +0 -126
- package/packages/scrabble-solver/src/components/Results/Results.module.scss.d.ts +0 -10
- package/packages/scrabble-solver/src/components/Results/Results.tsx +25 -5
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +4 -4
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +5 -3
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +5 -1
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss.d.ts +1 -0
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +5 -2
- package/packages/scrabble-solver/src/components/Table/Cell.tsx +42 -0
- package/packages/scrabble-solver/src/components/Table/Header.tsx +11 -0
- package/packages/scrabble-solver/src/components/{Results → Table}/HeaderButton.tsx +22 -14
- package/packages/scrabble-solver/src/components/Table/Row.tsx +59 -0
- package/packages/scrabble-solver/src/components/{ResultsInput/ResultsInput.tsx → Table/Search.tsx} +9 -11
- package/packages/scrabble-solver/src/components/Table/Table.module.scss +147 -0
- package/packages/scrabble-solver/src/components/Table/Table.module.scss.d.ts +19 -0
- package/packages/scrabble-solver/src/components/Table/index.ts +5 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +2 -1
- package/packages/scrabble-solver/src/hooks/useColumns.ts +7 -5
- package/packages/scrabble-solver/src/hooks/useIsCompactLayout.ts +14 -0
- package/packages/scrabble-solver/src/i18n/languages/english.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/french.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/german.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/persian.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/polish.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/romanian.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/spanish.json +6 -1
- package/packages/scrabble-solver/src/i18n/languages/turkish.json +6 -1
- package/packages/scrabble-solver/src/icons/QuestionSquare.svg +5 -0
- package/packages/scrabble-solver/src/lib/createCoordinatesComparator.ts +23 -0
- package/packages/scrabble-solver/src/lib/createKeyComparator.ts +1 -4
- package/packages/scrabble-solver/src/lib/createSortComparator.ts +22 -0
- package/packages/scrabble-solver/src/lib/getCoordinates.test.ts +21 -0
- package/packages/scrabble-solver/src/lib/getCoordinates.ts +16 -0
- package/packages/scrabble-solver/src/lib/getNextSort.ts +12 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +3 -1
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.tsx +8 -9
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +14 -10
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss +16 -27
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss.d.ts +3 -6
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +56 -42
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordRow.tsx +92 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss +69 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss.d.ts +16 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.tsx +137 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/pages/api/verify.ts +7 -6
- package/packages/scrabble-solver/src/pages/index.tsx +29 -4
- package/packages/scrabble-solver/src/parameters/index.ts +2 -0
- package/packages/scrabble-solver/src/sdk/verify.ts +3 -2
- package/packages/scrabble-solver/src/solver-worker/client.test.ts +10 -3
- package/packages/scrabble-solver/src/solver-worker/index.worker.ts +7 -7
- package/packages/scrabble-solver/src/solver-worker/messages.ts +3 -3
- package/packages/scrabble-solver/src/state/hoveredWord/index.ts +4 -0
- package/packages/scrabble-solver/src/state/hoveredWord/initialState.ts +5 -0
- package/packages/scrabble-solver/src/state/hoveredWord/selectors.ts +5 -0
- package/packages/scrabble-solver/src/state/hoveredWord/slice.ts +18 -0
- package/packages/scrabble-solver/src/state/hoveredWord/types.ts +5 -0
- package/packages/scrabble-solver/src/state/index.ts +1 -0
- package/packages/scrabble-solver/src/state/localStorage.ts +13 -2
- package/packages/scrabble-solver/src/state/results/lib.ts +9 -26
- package/packages/scrabble-solver/src/state/results/selectors.ts +9 -1
- package/packages/scrabble-solver/src/state/results/slice.ts +4 -16
- package/packages/scrabble-solver/src/state/sagas.ts +26 -1
- package/packages/scrabble-solver/src/state/selectors.ts +18 -1
- package/packages/scrabble-solver/src/state/store.ts +2 -0
- package/packages/scrabble-solver/src/state/types.ts +2 -0
- package/packages/scrabble-solver/src/state/verify/initialState.ts +7 -0
- package/packages/scrabble-solver/src/state/verify/lib.test.ts +55 -0
- package/packages/scrabble-solver/src/state/verify/lib.ts +49 -0
- package/packages/scrabble-solver/src/state/verify/selectors.ts +37 -0
- package/packages/scrabble-solver/src/state/verify/slice.ts +13 -2
- package/packages/scrabble-solver/src/state/verify/types.ts +6 -2
- package/packages/scrabble-solver/src/styles/_tokens.scss +2 -0
- package/packages/scrabble-solver/src/styles/mixins.scss +5 -0
- package/packages/scrabble-solver/src/styles/variables.module.scss +1 -0
- package/packages/scrabble-solver/src/styles/variables.module.scss.d.ts +1 -0
- package/packages/scrabble-solver/src/styles/variables.scss +1 -1
- package/packages/scrabble-solver/src/types/index.ts +24 -11
- package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -1
- package/packages/solver/package.json +5 -5
- package/packages/types/build/Bingo.d.ts +0 -3
- package/packages/types/build/Bingo.js +0 -14
- package/packages/types/build/Board.d.ts +3 -1
- package/packages/types/build/Board.js +5 -40
- package/packages/types/build/BoardJson.d.ts +0 -1
- package/packages/types/build/BoardJson.js +0 -19
- package/packages/types/build/BoardWord.d.ts +7 -0
- package/packages/types/build/BoardWord.js +2 -0
- package/packages/types/build/CellJson.d.ts +0 -1
- package/packages/types/build/CellJson.js +0 -11
- package/packages/types/build/Game.d.ts +2 -2
- package/packages/types/build/Game.js +2 -4
- package/packages/types/build/Locale.d.ts +0 -1
- package/packages/types/build/Locale.js +1 -4
- package/packages/types/build/Result.js +3 -3
- package/packages/types/build/TileJson.d.ts +0 -1
- package/packages/types/build/TileJson.js +0 -6
- package/packages/types/build/index.d.ts +9 -8
- package/packages/types/build/index.js +14 -17
- package/packages/types/build/lib/getBoardWords.d.ts +3 -0
- package/packages/types/build/lib/getBoardWords.js +10 -0
- package/packages/types/build/lib/getCells.d.ts +4 -0
- package/packages/types/build/lib/getCells.js +27 -0
- package/packages/types/build/lib/getCollidingWords.d.ts +3 -0
- package/packages/types/build/lib/getCollidingWords.js +19 -0
- package/packages/types/build/lib/getCollision.d.ts +3 -0
- package/packages/types/build/lib/getCollision.js +31 -0
- package/packages/types/build/lib/getCollisions.d.ts +3 -0
- package/packages/types/build/lib/getCollisions.js +17 -0
- package/packages/types/build/lib/getPlacedCell.d.ts +3 -0
- package/packages/types/build/lib/getPlacedCell.js +10 -0
- package/packages/types/build/lib/getWordThrough.d.ts +4 -0
- package/packages/types/build/lib/getWordThrough.js +23 -0
- package/packages/types/build/lib/getWordsInRows.d.ts +8 -0
- package/packages/types/build/lib/getWordsInRows.js +29 -0
- package/packages/types/build/lib/index.d.ts +5 -0
- package/packages/types/build/lib/index.js +21 -0
- package/packages/types/build/lib/isSameBoardWord.d.ts +2 -0
- package/packages/types/build/lib/isSameBoardWord.js +6 -0
- package/packages/types/build/lib/toBoardWord.d.ts +4 -0
- package/packages/types/build/lib/toBoardWord.js +11 -0
- package/packages/types/build/lib/transpose.d.ts +1 -0
- package/packages/types/build/lib/transpose.js +16 -0
- package/packages/types/build/type-guards/index.d.ts +10 -0
- package/packages/types/build/type-guards/index.js +23 -0
- package/packages/types/build/type-guards/isBingo.d.ts +2 -0
- package/packages/types/build/type-guards/isBingo.js +9 -0
- package/packages/types/build/type-guards/isBoardJson.d.ts +2 -0
- package/packages/types/build/type-guards/isBoardJson.js +21 -0
- package/packages/types/build/type-guards/isCellJson.d.ts +2 -0
- package/packages/types/build/type-guards/isCellJson.js +13 -0
- package/packages/types/build/type-guards/isGame.d.ts +2 -0
- package/packages/types/build/type-guards/isGame.js +7 -0
- package/packages/types/build/type-guards/isLocale.d.ts +2 -0
- package/packages/types/build/type-guards/isLocale.js +7 -0
- package/packages/types/build/type-guards/isMultiplierBingo.d.ts +2 -0
- package/packages/types/build/type-guards/isMultiplierBingo.js +8 -0
- package/packages/types/build/type-guards/isScoreBingo.d.ts +2 -0
- package/packages/types/build/type-guards/isScoreBingo.js +8 -0
- package/packages/types/build/type-guards/isTileJson.d.ts +2 -0
- package/packages/types/build/type-guards/isTileJson.js +8 -0
- package/packages/types/package.json +2 -2
- package/packages/types/src/Bingo.ts +0 -14
- package/packages/types/src/Board.test.ts +85 -0
- package/packages/types/src/Board.ts +8 -49
- package/packages/types/src/BoardJson.ts +1 -21
- package/packages/types/src/BoardWord.ts +8 -0
- package/packages/types/src/CellJson.ts +1 -12
- package/packages/types/src/Game.ts +1 -4
- package/packages/types/src/Locale.ts +0 -4
- package/packages/types/src/Result.ts +3 -3
- package/packages/types/src/TileJson.ts +0 -6
- package/packages/types/src/index.ts +20 -8
- package/packages/types/src/lib/getBoardWords.ts +11 -0
- package/packages/types/src/lib/getCells.test.ts +127 -0
- package/packages/types/src/lib/getCells.ts +31 -0
- package/packages/types/src/lib/getCollidingWords.ts +25 -0
- package/packages/types/src/lib/getCollision.ts +38 -0
- package/packages/types/src/lib/getCollisions.test.ts +82 -0
- package/packages/types/src/lib/getCollisions.ts +22 -0
- package/packages/types/src/lib/getPlacedCell.ts +9 -0
- package/packages/types/src/lib/getWordThrough.ts +30 -0
- package/packages/types/src/lib/getWordsInRows.ts +34 -0
- package/packages/types/src/lib/index.ts +5 -0
- package/packages/types/src/lib/isSameBoardWord.ts +5 -0
- package/packages/types/src/lib/toBoardWord.ts +12 -0
- package/packages/types/src/lib/transpose.ts +15 -0
- package/packages/types/src/type-guards/index.ts +10 -0
- package/packages/types/src/type-guards/isBingo.ts +8 -0
- package/packages/types/src/type-guards/isBoardJson.test.ts +33 -0
- package/packages/types/src/type-guards/isBoardJson.ts +23 -0
- package/packages/types/src/type-guards/isCellJson.ts +14 -0
- package/packages/types/src/type-guards/isGame.ts +5 -0
- package/packages/types/src/type-guards/isLocale.ts +5 -0
- package/packages/types/src/type-guards/isMultiplierBingo.ts +7 -0
- package/packages/types/src/type-guards/isScoreBingo.ts +7 -0
- package/packages/types/src/type-guards/isTileJson.ts +7 -0
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package.json +2 -2
- package/playwright-report/index.html +1 -1
- package/screencast.gif +0 -0
- package/packages/scrabble-solver/.next/server/chunks/316.js +0 -1
- package/packages/scrabble-solver/.next/server/chunks/916.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/106.e414e88694add27f.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/127.125d896a19061d71.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/18.8b91e137d239e15c.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/583.7a46807be14c377e.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/711.ba7b8f900dfd40d0.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/912.ff8037ba9d4db5c8.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-2e607dcd4135f340.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/index-e0087247c995328d.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/webpack-cfb34d175e081981.js +0 -1
- package/packages/scrabble-solver/.next/static/css/b74cd7de82dabcdd.css +0 -1
- package/packages/scrabble-solver/.next/static/css/c403ce739a9c0d83.css +0 -1
- package/packages/scrabble-solver/.next/static/css/fbfdce70731d0d2b.css +0 -1
- package/packages/scrabble-solver/src/components/Results/Cell.tsx +0 -32
- package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss +0 -12
- package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss.d.ts +0 -7
- package/packages/scrabble-solver/src/components/ResultsInput/index.ts +0 -1
- package/packages/types/build/readResultCells.d.ts +0 -5
- package/packages/types/build/readResultCells.js +0 -75
- package/packages/types/src/readResultCells.test.ts +0 -140
- package/packages/types/src/readResultCells.ts +0 -90
- /package/packages/scrabble-solver/.next/static/{5KOWzYqfY1Z2rjrzptr8D → 8WnIUTe-yJvPD6stltvYI}/_ssgManifest.js +0 -0
- /package/packages/types/build/{isError.d.ts → type-guards/isError.d.ts} +0 -0
- /package/packages/types/build/{isError.js → type-guards/isError.js} +0 -0
- /package/packages/types/build/{isObject.d.ts → type-guards/isObject.d.ts} +0 -0
- /package/packages/types/build/{isObject.js → type-guards/isObject.js} +0 -0
- /package/packages/types/src/{isError.ts → type-guards/isError.ts} +0 -0
- /package/packages/types/src/{isObject.ts → type-guards/isObject.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/solver",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.3",
|
|
4
4
|
"description": "Scrabble move-generation engine: anchor-based GADDAG search that finds and scores every legal move for a given board, rack, and game config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"scrabble",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@kamilmielnik/gaddag": "^2.0.0",
|
|
37
|
-
"@scrabble-solver/types": "^2.18.
|
|
37
|
+
"@scrabble-solver/types": "^2.18.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@scrabble-solver/configs": "^2.18.
|
|
41
|
-
"@scrabble-solver/constants": "^2.18.
|
|
42
|
-
"@scrabble-solver/dictionaries": "^2.18.
|
|
40
|
+
"@scrabble-solver/configs": "^2.18.3",
|
|
41
|
+
"@scrabble-solver/constants": "^2.18.3",
|
|
42
|
+
"@scrabble-solver/dictionaries": "^2.18.3"
|
|
43
43
|
},
|
|
44
44
|
"gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
|
|
45
45
|
}
|
|
@@ -5,6 +5,3 @@ export type ScoreBingo = {
|
|
|
5
5
|
score: number;
|
|
6
6
|
};
|
|
7
7
|
export type Bingo = MultiplierBingo | ScoreBingo;
|
|
8
|
-
export declare const isBingo: (value: unknown) => value is Bingo;
|
|
9
|
-
export declare const isScoreBingo: (value: unknown) => value is ScoreBingo;
|
|
10
|
-
export declare const isMultiplierBingo: (value: unknown) => value is MultiplierBingo;
|
|
@@ -1,16 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMultiplierBingo = exports.isScoreBingo = exports.isBingo = void 0;
|
|
4
|
-
const isObject_1 = require("./isObject");
|
|
5
|
-
const isBingo = (value) => {
|
|
6
|
-
return (0, exports.isScoreBingo)(value) || (0, exports.isMultiplierBingo)(value);
|
|
7
|
-
};
|
|
8
|
-
exports.isBingo = isBingo;
|
|
9
|
-
const isScoreBingo = (value) => {
|
|
10
|
-
return (0, isObject_1.isObject)(value) && 'score' in value && typeof value.score === 'number';
|
|
11
|
-
};
|
|
12
|
-
exports.isScoreBingo = isScoreBingo;
|
|
13
|
-
const isMultiplierBingo = (value) => {
|
|
14
|
-
return (0, isObject_1.isObject)(value) && 'multiplier' in value && typeof value.multiplier === 'number';
|
|
15
|
-
};
|
|
16
|
-
exports.isMultiplierBingo = isMultiplierBingo;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BoardJson } from './BoardJson';
|
|
2
|
+
import { type BoardWord } from './BoardWord';
|
|
2
3
|
import { Cell } from './Cell';
|
|
3
4
|
export declare class Board {
|
|
4
5
|
static create: (width: number, height: number) => Board;
|
|
@@ -19,10 +20,11 @@ export declare class Board {
|
|
|
19
20
|
collidesUp({ x, y }: Cell): boolean;
|
|
20
21
|
equals(other: Board): boolean;
|
|
21
22
|
getBlanksCount(): number;
|
|
23
|
+
getCollidingWords(word: BoardWord): BoardWord[];
|
|
22
24
|
getColumn(index: number): Cell[];
|
|
23
25
|
getRow(index: number): Cell[];
|
|
24
26
|
getTilesCount(): number;
|
|
25
|
-
getWords():
|
|
27
|
+
getWords(): BoardWord[];
|
|
26
28
|
isEmpty(): boolean;
|
|
27
29
|
toJson(): BoardJson;
|
|
28
30
|
toString(): string;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Board = void 0;
|
|
4
4
|
const constants_1 = require("@scrabble-solver/constants");
|
|
5
5
|
const Cell_1 = require("./Cell");
|
|
6
|
+
const lib_1 = require("./lib");
|
|
6
7
|
const Tile_1 = require("./Tile");
|
|
7
8
|
class Board {
|
|
8
9
|
static fromStringArray(stringArray) {
|
|
@@ -58,6 +59,9 @@ class Board {
|
|
|
58
59
|
return count + row.reduce((rowCount, cell) => rowCount + (cell.tile.isBlank ? 1 : 0), 0);
|
|
59
60
|
}, 0);
|
|
60
61
|
}
|
|
62
|
+
getCollidingWords(word) {
|
|
63
|
+
return (0, lib_1.getCollidingWords)(this, word);
|
|
64
|
+
}
|
|
61
65
|
getColumn(index) {
|
|
62
66
|
return this.rows.map((row) => row[index]);
|
|
63
67
|
}
|
|
@@ -70,9 +74,7 @@ class Board {
|
|
|
70
74
|
}, 0);
|
|
71
75
|
}
|
|
72
76
|
getWords() {
|
|
73
|
-
|
|
74
|
-
const verticalWords = getHorizontalWords(transpose(this.rows));
|
|
75
|
-
return [...horizontalWords, ...verticalWords];
|
|
77
|
+
return (0, lib_1.getBoardWords)(this);
|
|
76
78
|
}
|
|
77
79
|
isEmpty() {
|
|
78
80
|
return this.rows.every((row) => row.every(({ isEmpty }) => isEmpty));
|
|
@@ -102,40 +104,3 @@ Board.fromJson = (json) => {
|
|
|
102
104
|
rows: json.map((row) => row.map(Cell_1.Cell.fromJson)),
|
|
103
105
|
});
|
|
104
106
|
};
|
|
105
|
-
const transpose = (array) => {
|
|
106
|
-
const rows = array.length;
|
|
107
|
-
const cols = array[0].length;
|
|
108
|
-
const transposed = Array(cols)
|
|
109
|
-
.fill(null)
|
|
110
|
-
.map(() => Array(rows));
|
|
111
|
-
for (let y = 0; y < rows; ++y) {
|
|
112
|
-
for (let x = 0; x < cols; ++x) {
|
|
113
|
-
transposed[x][y] = array[y][x];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return transposed;
|
|
117
|
-
};
|
|
118
|
-
const getHorizontalWords = (cells) => {
|
|
119
|
-
const words = [];
|
|
120
|
-
for (const row of cells) {
|
|
121
|
-
let currentWord = [];
|
|
122
|
-
for (const cell of row) {
|
|
123
|
-
if (!cell.isEmpty) {
|
|
124
|
-
currentWord.push(cell);
|
|
125
|
-
}
|
|
126
|
-
else if (currentWord.length > 0) {
|
|
127
|
-
if (currentWord.length > 1) {
|
|
128
|
-
words.push(wordToString(currentWord));
|
|
129
|
-
}
|
|
130
|
-
currentWord = [];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (currentWord.length > 1) {
|
|
134
|
-
words.push(wordToString(currentWord));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return words;
|
|
138
|
-
};
|
|
139
|
-
const wordToString = (word) => {
|
|
140
|
-
return word.map((cell) => cell.tile.character).join('');
|
|
141
|
-
};
|
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBoardJson = void 0;
|
|
4
|
-
const CellJson_1 = require("./CellJson");
|
|
5
|
-
const isBoardJson = (value) => {
|
|
6
|
-
if (!Array.isArray(value)) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
for (const row of value) {
|
|
10
|
-
if (!Array.isArray(value)) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
for (const cell of row) {
|
|
14
|
-
if (!(0, CellJson_1.isCellJson)(cell)) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
};
|
|
21
|
-
exports.isBoardJson = isBoardJson;
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCellJson = void 0;
|
|
4
|
-
const isObject_1 = require("./isObject");
|
|
5
|
-
const TileJson_1 = require("./TileJson");
|
|
6
|
-
const isCellJson = (value) => {
|
|
7
|
-
return ((0, isObject_1.isObject)(value) &&
|
|
8
|
-
typeof value.isEmpty === 'boolean' &&
|
|
9
|
-
((0, TileJson_1.isTileJson)(value.tile) || value.tile === null) &&
|
|
10
|
-
typeof value.x === 'number' &&
|
|
11
|
-
typeof value.y === 'number');
|
|
12
|
-
};
|
|
13
|
-
exports.isCellJson = isCellJson;
|
|
@@ -5,6 +5,6 @@ export declare enum Game {
|
|
|
5
5
|
Literaki = "literaki",
|
|
6
6
|
Scrabble = "scrabble",
|
|
7
7
|
ScrabbleDuel = "scrabble-duel",
|
|
8
|
-
SuperScrabble = "super-scrabble"
|
|
8
|
+
SuperScrabble = "super-scrabble",
|
|
9
|
+
Wyrazy = "wyrazy"
|
|
9
10
|
}
|
|
10
|
-
export declare const isGame: (locale: unknown) => locale is Game;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Game = void 0;
|
|
4
4
|
var Game;
|
|
5
5
|
(function (Game) {
|
|
6
6
|
Game["Crossplay"] = "crossplay";
|
|
@@ -10,7 +10,5 @@ var Game;
|
|
|
10
10
|
Game["Scrabble"] = "scrabble";
|
|
11
11
|
Game["ScrabbleDuel"] = "scrabble-duel";
|
|
12
12
|
Game["SuperScrabble"] = "super-scrabble";
|
|
13
|
+
Game["Wyrazy"] = "wyrazy";
|
|
13
14
|
})(Game || (exports.Game = Game = {}));
|
|
14
|
-
const games = Object.values(Game);
|
|
15
|
-
const isGame = (locale) => games.includes(locale);
|
|
16
|
-
exports.isGame = isGame;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Locale = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Locales are defined using IETF language tags
|
|
6
6
|
* @see https://en.wikipedia.org/wiki/IETF_language_tag
|
|
@@ -18,6 +18,3 @@ var Locale;
|
|
|
18
18
|
Locale["RO_RO"] = "ro-RO";
|
|
19
19
|
Locale["TR_TR"] = "tr-TR";
|
|
20
20
|
})(Locale || (exports.Locale = Locale = {}));
|
|
21
|
-
const locales = Object.values(Locale);
|
|
22
|
-
const isLocale = (locale) => locales.includes(locale);
|
|
23
|
-
exports.isLocale = isLocale;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Result = void 0;
|
|
4
4
|
const constants_1 = require("@scrabble-solver/constants");
|
|
5
|
-
const
|
|
5
|
+
const lib_1 = require("./lib");
|
|
6
6
|
class Result {
|
|
7
7
|
constructor({ cells, id, collisions, points, }) {
|
|
8
8
|
const tiles = getTiles(cells);
|
|
@@ -42,10 +42,10 @@ class Result {
|
|
|
42
42
|
}
|
|
43
43
|
exports.Result = Result;
|
|
44
44
|
Result.fromJson = (json, board) => {
|
|
45
|
-
const cells = (0,
|
|
45
|
+
const cells = (0, lib_1.getCells)(board, json);
|
|
46
46
|
return new Result({
|
|
47
47
|
cells,
|
|
48
|
-
collisions: (0,
|
|
48
|
+
collisions: (0, lib_1.getCollisions)(board, cells, json.isHorizontal),
|
|
49
49
|
id: json.id,
|
|
50
50
|
points: json.points,
|
|
51
51
|
});
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTileJson = void 0;
|
|
4
|
-
const isObject_1 = require("./isObject");
|
|
5
|
-
const isTileJson = (value) => {
|
|
6
|
-
return (0, isObject_1.isObject)(value) && typeof value.character === 'string' && typeof value.isBlank === 'boolean';
|
|
7
|
-
};
|
|
8
|
-
exports.isTileJson = isTileJson;
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
export { Bingo
|
|
1
|
+
export { Bingo } from './Bingo';
|
|
2
2
|
export { Board } from './Board';
|
|
3
|
-
export { BoardJson
|
|
3
|
+
export { BoardJson } from './BoardJson';
|
|
4
|
+
export { BoardWord } from './BoardWord';
|
|
4
5
|
export { Bonus } from './Bonus';
|
|
5
6
|
export { BonusJson } from './BonusJson';
|
|
6
7
|
export { BonusValue } from './BonusValue';
|
|
7
8
|
export { Cell } from './Cell';
|
|
8
|
-
export { CellJson
|
|
9
|
+
export { CellJson } from './CellJson';
|
|
9
10
|
export { CharacterBonus } from './CharacterBonus';
|
|
10
11
|
export { Collision } from './Collision';
|
|
11
12
|
export { Config } from './Config';
|
|
12
13
|
export { ConfigJson } from './ConfigJson';
|
|
13
14
|
export { Dictionary } from './Dictionary';
|
|
14
15
|
export { Direction } from './Direction';
|
|
15
|
-
export { Game
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export { isLocale, Locale } from './Locale';
|
|
16
|
+
export { Game } from './Game';
|
|
17
|
+
export { isSameBoardWord } from './lib';
|
|
18
|
+
export { Locale } from './Locale';
|
|
19
19
|
export { Result } from './Result';
|
|
20
20
|
export { ResultJson } from './ResultJson';
|
|
21
21
|
export { ShowCoordinates } from './ShowCoordinates';
|
|
22
22
|
export { TextDirection } from './TextDirection';
|
|
23
23
|
export { Tile } from './Tile';
|
|
24
24
|
export { TileConfig } from './TileConfig';
|
|
25
|
-
export {
|
|
25
|
+
export { TileJson } from './TileJson';
|
|
26
|
+
export { isBingo, isBoardJson, isCellJson, isError, isGame, isLocale, isMultiplierBingo, isObject, isScoreBingo, isTileJson, } from './type-guards';
|
|
26
27
|
export { WordBonus } from './WordBonus';
|
|
27
28
|
export { WordDefinition } from './WordDefinition';
|
|
28
29
|
export { WordDefinitionJson } from './WordDefinitionJson';
|
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WordDefinition = exports.WordBonus = exports.isTileJson = exports.
|
|
4
|
-
var Bingo_1 = require("./Bingo");
|
|
5
|
-
Object.defineProperty(exports, "isBingo", { enumerable: true, get: function () { return Bingo_1.isBingo; } });
|
|
6
|
-
Object.defineProperty(exports, "isMultiplierBingo", { enumerable: true, get: function () { return Bingo_1.isMultiplierBingo; } });
|
|
7
|
-
Object.defineProperty(exports, "isScoreBingo", { enumerable: true, get: function () { return Bingo_1.isScoreBingo; } });
|
|
3
|
+
exports.WordDefinition = exports.WordBonus = exports.isTileJson = exports.isScoreBingo = exports.isObject = exports.isMultiplierBingo = exports.isLocale = exports.isGame = exports.isError = exports.isCellJson = exports.isBoardJson = exports.isBingo = exports.Tile = exports.Result = exports.Locale = exports.isSameBoardWord = exports.Game = exports.Config = exports.CharacterBonus = exports.Cell = exports.Bonus = exports.Board = void 0;
|
|
8
4
|
var Board_1 = require("./Board");
|
|
9
5
|
Object.defineProperty(exports, "Board", { enumerable: true, get: function () { return Board_1.Board; } });
|
|
10
|
-
var BoardJson_1 = require("./BoardJson");
|
|
11
|
-
Object.defineProperty(exports, "isBoardJson", { enumerable: true, get: function () { return BoardJson_1.isBoardJson; } });
|
|
12
6
|
var Bonus_1 = require("./Bonus");
|
|
13
7
|
Object.defineProperty(exports, "Bonus", { enumerable: true, get: function () { return Bonus_1.Bonus; } });
|
|
14
8
|
var Cell_1 = require("./Cell");
|
|
15
9
|
Object.defineProperty(exports, "Cell", { enumerable: true, get: function () { return Cell_1.Cell; } });
|
|
16
|
-
var CellJson_1 = require("./CellJson");
|
|
17
|
-
Object.defineProperty(exports, "isCellJson", { enumerable: true, get: function () { return CellJson_1.isCellJson; } });
|
|
18
10
|
var CharacterBonus_1 = require("./CharacterBonus");
|
|
19
11
|
Object.defineProperty(exports, "CharacterBonus", { enumerable: true, get: function () { return CharacterBonus_1.CharacterBonus; } });
|
|
20
12
|
var Config_1 = require("./Config");
|
|
21
13
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return Config_1.Config; } });
|
|
22
14
|
var Game_1 = require("./Game");
|
|
23
15
|
Object.defineProperty(exports, "Game", { enumerable: true, get: function () { return Game_1.Game; } });
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return isError_1.isError; } });
|
|
27
|
-
var isObject_1 = require("./isObject");
|
|
28
|
-
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return isObject_1.isObject; } });
|
|
16
|
+
var lib_1 = require("./lib");
|
|
17
|
+
Object.defineProperty(exports, "isSameBoardWord", { enumerable: true, get: function () { return lib_1.isSameBoardWord; } });
|
|
29
18
|
var Locale_1 = require("./Locale");
|
|
30
|
-
Object.defineProperty(exports, "isLocale", { enumerable: true, get: function () { return Locale_1.isLocale; } });
|
|
31
19
|
Object.defineProperty(exports, "Locale", { enumerable: true, get: function () { return Locale_1.Locale; } });
|
|
32
20
|
var Result_1 = require("./Result");
|
|
33
21
|
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return Result_1.Result; } });
|
|
34
22
|
var Tile_1 = require("./Tile");
|
|
35
23
|
Object.defineProperty(exports, "Tile", { enumerable: true, get: function () { return Tile_1.Tile; } });
|
|
36
|
-
var
|
|
37
|
-
Object.defineProperty(exports, "
|
|
24
|
+
var type_guards_1 = require("./type-guards");
|
|
25
|
+
Object.defineProperty(exports, "isBingo", { enumerable: true, get: function () { return type_guards_1.isBingo; } });
|
|
26
|
+
Object.defineProperty(exports, "isBoardJson", { enumerable: true, get: function () { return type_guards_1.isBoardJson; } });
|
|
27
|
+
Object.defineProperty(exports, "isCellJson", { enumerable: true, get: function () { return type_guards_1.isCellJson; } });
|
|
28
|
+
Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return type_guards_1.isError; } });
|
|
29
|
+
Object.defineProperty(exports, "isGame", { enumerable: true, get: function () { return type_guards_1.isGame; } });
|
|
30
|
+
Object.defineProperty(exports, "isLocale", { enumerable: true, get: function () { return type_guards_1.isLocale; } });
|
|
31
|
+
Object.defineProperty(exports, "isMultiplierBingo", { enumerable: true, get: function () { return type_guards_1.isMultiplierBingo; } });
|
|
32
|
+
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return type_guards_1.isObject; } });
|
|
33
|
+
Object.defineProperty(exports, "isScoreBingo", { enumerable: true, get: function () { return type_guards_1.isScoreBingo; } });
|
|
34
|
+
Object.defineProperty(exports, "isTileJson", { enumerable: true, get: function () { return type_guards_1.isTileJson; } });
|
|
38
35
|
var WordBonus_1 = require("./WordBonus");
|
|
39
36
|
Object.defineProperty(exports, "WordBonus", { enumerable: true, get: function () { return WordBonus_1.WordBonus; } });
|
|
40
37
|
var WordDefinition_1 = require("./WordDefinition");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBoardWords = getBoardWords;
|
|
4
|
+
const getWordsInRows_1 = require("./getWordsInRows");
|
|
5
|
+
const transpose_1 = require("./transpose");
|
|
6
|
+
function getBoardWords(board) {
|
|
7
|
+
const horizontalWords = (0, getWordsInRows_1.getWordsInRows)(board.rows, 'horizontal');
|
|
8
|
+
const verticalWords = (0, getWordsInRows_1.getWordsInRows)((0, transpose_1.transpose)(board.rows), 'vertical');
|
|
9
|
+
return [...horizontalWords, ...verticalWords];
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCells = getCells;
|
|
4
|
+
const getPlacedCell_1 = require("./getPlacedCell");
|
|
5
|
+
function getCells(board, json) {
|
|
6
|
+
const stepX = json.isHorizontal ? 1 : 0;
|
|
7
|
+
const stepY = json.isHorizontal ? 0 : 1;
|
|
8
|
+
const cells = [];
|
|
9
|
+
let placedIndex = 0;
|
|
10
|
+
let { x, y } = json;
|
|
11
|
+
while (y < board.rowsCount && x < board.columnsCount) {
|
|
12
|
+
const boardCell = board.rows[y][x];
|
|
13
|
+
if (boardCell.isFilled()) {
|
|
14
|
+
cells.push(boardCell.clone());
|
|
15
|
+
}
|
|
16
|
+
else if (placedIndex < json.tiles.length) {
|
|
17
|
+
cells.push((0, getPlacedCell_1.getPlacedCell)(json, placedIndex, x, y));
|
|
18
|
+
placedIndex += 1;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
x += stepX;
|
|
24
|
+
y += stepY;
|
|
25
|
+
}
|
|
26
|
+
return cells;
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCollidingWords = getCollidingWords;
|
|
4
|
+
const getWordThrough_1 = require("./getWordThrough");
|
|
5
|
+
function getCollidingWords(board, word) {
|
|
6
|
+
const isHorizontal = word.direction === 'horizontal';
|
|
7
|
+
const collidingDirection = isHorizontal ? 'vertical' : 'horizontal';
|
|
8
|
+
const collidingWords = [];
|
|
9
|
+
let { x, y } = word;
|
|
10
|
+
while (x < board.columnsCount && y < board.rowsCount && !board.rows[y][x].isEmpty) {
|
|
11
|
+
const collidingWord = (0, getWordThrough_1.getWordThrough)(board, x, y, collidingDirection);
|
|
12
|
+
if (collidingWord) {
|
|
13
|
+
collidingWords.push(collidingWord);
|
|
14
|
+
}
|
|
15
|
+
x += isHorizontal ? 1 : 0;
|
|
16
|
+
y += isHorizontal ? 0 : 1;
|
|
17
|
+
}
|
|
18
|
+
return collidingWords;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCollision = getCollision;
|
|
4
|
+
function getCollision(placed, board, isHorizontal) {
|
|
5
|
+
const stepX = isHorizontal ? 0 : 1;
|
|
6
|
+
const stepY = isHorizontal ? 1 : 0;
|
|
7
|
+
let x = placed.x - stepX;
|
|
8
|
+
let y = placed.y - stepY;
|
|
9
|
+
while (x >= 0 && y >= 0 && board.rows[y][x].isFilled()) {
|
|
10
|
+
x -= stepX;
|
|
11
|
+
y -= stepY;
|
|
12
|
+
}
|
|
13
|
+
x += stepX;
|
|
14
|
+
y += stepY;
|
|
15
|
+
const collision = [];
|
|
16
|
+
while (y < board.rowsCount && x < board.columnsCount) {
|
|
17
|
+
if (x === placed.x && y === placed.y) {
|
|
18
|
+
collision.push(placed);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const boardCell = board.rows[y][x];
|
|
22
|
+
if (!boardCell.isFilled()) {
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
collision.push(boardCell.clone());
|
|
26
|
+
}
|
|
27
|
+
x += stepX;
|
|
28
|
+
y += stepY;
|
|
29
|
+
}
|
|
30
|
+
return collision;
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCollisions = getCollisions;
|
|
4
|
+
const getCollision_1 = require("./getCollision");
|
|
5
|
+
function getCollisions(board, cells, isHorizontal) {
|
|
6
|
+
const collisions = [];
|
|
7
|
+
for (const cell of cells) {
|
|
8
|
+
if (cell.isFilled()) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const collision = (0, getCollision_1.getCollision)(cell, board, isHorizontal);
|
|
12
|
+
if (collision.length > 1) {
|
|
13
|
+
collisions.push(collision);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return collisions;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPlacedCell = getPlacedCell;
|
|
4
|
+
const Cell_1 = require("../Cell");
|
|
5
|
+
const Tile_1 = require("../Tile");
|
|
6
|
+
function getPlacedCell(json, placedIndex, x, y) {
|
|
7
|
+
const character = json.tiles[placedIndex];
|
|
8
|
+
const isBlank = json.blankIndices.includes(placedIndex);
|
|
9
|
+
return new Cell_1.Cell({ isEmpty: true, tile: new Tile_1.Tile({ character, isBlank }), x, y });
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWordThrough = getWordThrough;
|
|
4
|
+
const toBoardWord_1 = require("./toBoardWord");
|
|
5
|
+
function getWordThrough(board, x, y, direction) {
|
|
6
|
+
const stepX = direction === 'horizontal' ? 1 : 0;
|
|
7
|
+
const stepY = direction === 'horizontal' ? 0 : 1;
|
|
8
|
+
let startX = x;
|
|
9
|
+
let startY = y;
|
|
10
|
+
while (startX - stepX >= 0 && startY - stepY >= 0 && !board.rows[startY - stepY][startX - stepX].isEmpty) {
|
|
11
|
+
startX -= stepX;
|
|
12
|
+
startY -= stepY;
|
|
13
|
+
}
|
|
14
|
+
const cells = [];
|
|
15
|
+
let cellX = startX;
|
|
16
|
+
let cellY = startY;
|
|
17
|
+
while (cellX < board.columnsCount && cellY < board.rowsCount && !board.rows[cellY][cellX].isEmpty) {
|
|
18
|
+
cells.push(board.rows[cellY][cellX]);
|
|
19
|
+
cellX += stepX;
|
|
20
|
+
cellY += stepY;
|
|
21
|
+
}
|
|
22
|
+
return cells.length > 1 ? (0, toBoardWord_1.toBoardWord)(cells, direction) : undefined;
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type BoardWord } from '../BoardWord';
|
|
2
|
+
import { type Cell } from '../Cell';
|
|
3
|
+
import { type Direction } from '../Direction';
|
|
4
|
+
/**
|
|
5
|
+
* Cells in transposed rows keep their original coordinates,
|
|
6
|
+
* so the first cell of a run is the word's start in both directions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getWordsInRows(cells: Cell[][], direction: Direction): BoardWord[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWordsInRows = getWordsInRows;
|
|
4
|
+
const toBoardWord_1 = require("./toBoardWord");
|
|
5
|
+
/**
|
|
6
|
+
* Cells in transposed rows keep their original coordinates,
|
|
7
|
+
* so the first cell of a run is the word's start in both directions.
|
|
8
|
+
*/
|
|
9
|
+
function getWordsInRows(cells, direction) {
|
|
10
|
+
const words = [];
|
|
11
|
+
for (const row of cells) {
|
|
12
|
+
let currentWord = [];
|
|
13
|
+
for (const cell of row) {
|
|
14
|
+
if (!cell.isEmpty) {
|
|
15
|
+
currentWord.push(cell);
|
|
16
|
+
}
|
|
17
|
+
else if (currentWord.length > 0) {
|
|
18
|
+
if (currentWord.length > 1) {
|
|
19
|
+
words.push((0, toBoardWord_1.toBoardWord)(currentWord, direction));
|
|
20
|
+
}
|
|
21
|
+
currentWord = [];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (currentWord.length > 1) {
|
|
25
|
+
words.push((0, toBoardWord_1.toBoardWord)(currentWord, direction));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return words;
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./getBoardWords"), exports);
|
|
18
|
+
__exportStar(require("./getCells"), exports);
|
|
19
|
+
__exportStar(require("./getCollidingWords"), exports);
|
|
20
|
+
__exportStar(require("./getCollisions"), exports);
|
|
21
|
+
__exportStar(require("./isSameBoardWord"), exports);
|