scrabble-solver 2.11.7 → 2.11.9
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/lerna.json +1 -1
- package/package.json +11 -11
- package/packages/configs/build/literaki/literaki.js +7 -7
- package/packages/configs/build/scrabble/scrabble.js +7 -7
- package/packages/configs/package.json +3 -3
- package/packages/configs/src/literaki/literaki.ts +7 -7
- package/packages/configs/src/scrabble/scrabble.ts +8 -8
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package-lock.json +10 -3
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package-lock.json +227 -6
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +7 -7
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/packages/scrabble-solver/.next/cache/next-server.js.nft.json +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/edge-server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +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/next-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +1 -1
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/131.js +153 -115
- package/packages/scrabble-solver/.next/server/chunks/277.js +1430 -691
- package/packages/scrabble-solver/.next/server/chunks/44.js +3 -0
- package/packages/scrabble-solver/.next/server/chunks/50.js +20 -78
- package/packages/scrabble-solver/.next/server/chunks/865.js +153 -115
- package/packages/scrabble-solver/.next/server/chunks/911.js +14 -14
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js +8 -0
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +44 -11
- package/packages/scrabble-solver/.next/server/pages/index.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +169 -15
- 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/static/9oRWxnZ1xFLSs55FJtiYi/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/{404-ca203fa27afc37d8.js → 404-b4b5ce15153d4825.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-b0231bed954dd413.js +28 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-4e8566409753e1c3.js +1 -0
- package/packages/scrabble-solver/.next/static/css/60e8258da7362a1a.css +1 -0
- package/packages/scrabble-solver/.next/static/css/fcc46fec97b11afc.css +2 -0
- package/packages/scrabble-solver/.next/trace +52 -50
- package/packages/scrabble-solver/package-lock.json +4991 -214
- package/packages/scrabble-solver/package.json +13 -12
- package/packages/scrabble-solver/src/components/Board/Board.module.scss +18 -4
- package/packages/scrabble-solver/src/components/Board/Board.tsx +145 -76
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +32 -40
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.module.scss +6 -17
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.tsx +36 -18
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.module.scss +12 -13
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +53 -3
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.module.scss +47 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.tsx +81 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.module.scss +21 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +34 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/components/index.ts +2 -0
- package/packages/scrabble-solver/src/components/Board/hooks/index.ts +4 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useBackgroundImage.tsx +13 -9
- package/packages/scrabble-solver/src/components/Board/hooks/useBoardStyle.ts +27 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingActions.ts +22 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingFocus.ts +10 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingInputPrompt.ts +19 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useGrid.ts +19 -2
- package/packages/scrabble-solver/src/components/Key/Key.module.scss +7 -11
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +2 -2
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss +6 -6
- package/packages/scrabble-solver/src/components/Rack/Rack.tsx +102 -24
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.module.scss +22 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.tsx +89 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/RackTile.module.scss +11 -0
- package/packages/scrabble-solver/src/components/Rack/{RackTile.tsx → components/RackTile/RackTile.tsx} +59 -9
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Rack/components/index.ts +2 -0
- package/packages/scrabble-solver/src/components/Radio/Radio.module.scss +0 -8
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +0 -20
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +2 -4
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +2 -10
- package/packages/scrabble-solver/src/components/Solver/components/index.ts +0 -1
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +5 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.tsx +8 -6
- package/packages/scrabble-solver/src/components/Tile/TilePure.tsx +8 -0
- package/packages/scrabble-solver/src/hooks/useAppLayout.ts +3 -1
- package/packages/scrabble-solver/src/hooks/useLocalStorage.ts +8 -0
- package/packages/scrabble-solver/src/i18n/de.json +6 -1
- package/packages/scrabble-solver/src/i18n/en.json +6 -1
- package/packages/scrabble-solver/src/i18n/es.json +6 -1
- package/packages/scrabble-solver/src/i18n/fa.json +6 -1
- package/packages/scrabble-solver/src/i18n/fr.json +6 -1
- package/packages/scrabble-solver/src/i18n/pl.json +6 -1
- package/packages/scrabble-solver/src/icons/Keyboard.svg +4 -3
- package/packages/scrabble-solver/src/icons/KeyboardFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/index.ts +1 -0
- package/packages/scrabble-solver/src/lib/extractCharacters.test.ts +26 -0
- package/packages/scrabble-solver/src/lib/extractCharacters.ts +11 -9
- package/packages/scrabble-solver/src/lib/extractCharactersByCase.test.ts +31 -0
- package/packages/scrabble-solver/src/lib/extractCharactersByCase.ts +31 -0
- package/packages/scrabble-solver/src/lib/index.ts +4 -1
- package/packages/scrabble-solver/src/lib/isCtrl.ts +7 -0
- package/packages/scrabble-solver/src/lib/isUpperCase.ts +7 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/KeyMapModal.tsx +20 -4
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/Mapping.module.scss +10 -4
- package/packages/scrabble-solver/src/modals/SettingsModal/SettingsModal.tsx +5 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.tsx +55 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/lib.ts +13 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/types.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/state/localStorage.ts +10 -1
- package/packages/scrabble-solver/src/state/selectors.ts +2 -0
- package/packages/scrabble-solver/src/state/slices/settingsInitialState.ts +4 -1
- package/packages/scrabble-solver/src/state/slices/settingsSlice.ts +6 -1
- package/packages/scrabble-solver/src/styles/mixins.scss +1 -0
- package/packages/scrabble-solver/src/styles/variables.scss +2 -0
- package/packages/scrabble-solver/src/types/index.ts +7 -0
- package/packages/solver/build/getCellsScore.js +3 -2
- package/packages/solver/package-lock.json +10 -3
- package/packages/solver/package.json +5 -5
- package/packages/solver/src/getCellsScore.ts +3 -2
- package/packages/types/build/Config.d.ts +2 -0
- package/packages/types/build/Config.js +3 -0
- package/packages/types/build/ConfigJson.d.ts +2 -0
- package/packages/types/package.json +2 -2
- package/packages/types/src/Config.ts +5 -0
- package/packages/types/src/ConfigJson.ts +2 -0
- package/packages/word-definitions/package-lock.json +18 -18
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package-lock.json +403 -11
- package/packages/word-lists/package.json +2 -2
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-e89a3c225b87516a.js +0 -28
- package/packages/scrabble-solver/.next/static/chunks/pages/index-58744f49bf6b891f.js +0 -1
- package/packages/scrabble-solver/.next/static/css/34adfcf12a7d9bb6.css +0 -1
- package/packages/scrabble-solver/.next/static/css/edaeaa48321b4cf2.css +0 -2
- package/packages/scrabble-solver/.next/static/uhB6d-q63uRC6RubwepLq/_buildManifest.js +0 -1
- package/packages/scrabble-solver/src/components/Solver/components/FloatingSolveButton/FloatingSolveButton.module.scss +0 -7
- package/packages/scrabble-solver/src/components/Solver/components/FloatingSolveButton/FloatingSolveButton.tsx +0 -53
- package/packages/scrabble-solver/src/components/Solver/components/FloatingSolveButton/index.ts +0 -1
- /package/packages/scrabble-solver/.next/static/{uhB6d-q63uRC6RubwepLq → 9oRWxnZ1xFLSs55FJtiYi}/_ssgManifest.js +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Board, Locale } from '@scrabble-solver/types';
|
|
2
2
|
import store2 from 'store2';
|
|
3
3
|
|
|
4
|
-
import { AutoGroupTiles, Rack } from 'types';
|
|
4
|
+
import { AutoGroupTiles, InputMode, Rack } from 'types';
|
|
5
5
|
|
|
6
6
|
const AUTO_GROUP_TILES = 'auto-group-tiles';
|
|
7
7
|
const BOARD = 'board';
|
|
8
8
|
const CONFIG_ID = 'config-id';
|
|
9
|
+
const INPUT_MODE = 'input-mode';
|
|
9
10
|
const LOCALE = 'locale';
|
|
10
11
|
const RACK = 'rack';
|
|
11
12
|
|
|
@@ -38,6 +39,14 @@ const localStorage = {
|
|
|
38
39
|
store.set(CONFIG_ID, configId, true);
|
|
39
40
|
},
|
|
40
41
|
|
|
42
|
+
getInputMode(): InputMode | undefined {
|
|
43
|
+
return store.get(INPUT_MODE);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
setInputMode(inputMode: InputMode | undefined): void {
|
|
47
|
+
store.set(INPUT_MODE, inputMode, true);
|
|
48
|
+
},
|
|
49
|
+
|
|
41
50
|
getLocale(): Locale | undefined {
|
|
42
51
|
return store.get(LOCALE);
|
|
43
52
|
},
|
|
@@ -65,6 +65,8 @@ export const selectLocaleAutoGroupTiles = createSelector([selectLocale, selectSe
|
|
|
65
65
|
|
|
66
66
|
export const selectBoard = selectBoardRoot;
|
|
67
67
|
|
|
68
|
+
export const selectInputMode = createSelector([selectSettingsRoot], (settings) => settings.inputMode);
|
|
69
|
+
|
|
68
70
|
export const selectConfigId = createSelector([selectSettingsRoot], (settings) => settings.configId);
|
|
69
71
|
|
|
70
72
|
export const selectConfig = createSelector([selectConfigId, selectLocale], getLocaleConfig);
|
|
@@ -2,21 +2,24 @@ import { literaki, scrabble } from '@scrabble-solver/configs';
|
|
|
2
2
|
import { Locale } from '@scrabble-solver/types';
|
|
3
3
|
|
|
4
4
|
import { guessLocale } from 'lib';
|
|
5
|
-
import { AutoGroupTiles } from 'types';
|
|
5
|
+
import { AutoGroupTiles, InputMode } from 'types';
|
|
6
6
|
|
|
7
7
|
import localStorage from '../localStorage';
|
|
8
8
|
|
|
9
9
|
export interface SettingsState {
|
|
10
10
|
autoGroupTiles: AutoGroupTiles;
|
|
11
11
|
configId: typeof literaki.id | typeof scrabble.id;
|
|
12
|
+
inputMode: InputMode;
|
|
12
13
|
locale: Locale;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const localStorageAutoGroupTiles = localStorage.getAutoGroupTiles();
|
|
17
|
+
const isTouchScreen = typeof globalThis.matchMedia !== 'undefined' && globalThis.matchMedia('(hover: none)').matches;
|
|
16
18
|
|
|
17
19
|
const settingsInitialState: SettingsState = {
|
|
18
20
|
autoGroupTiles: typeof localStorageAutoGroupTiles === 'undefined' ? 'left' : localStorageAutoGroupTiles,
|
|
19
21
|
configId: localStorage.getConfigId() || scrabble.id,
|
|
22
|
+
inputMode: localStorage.getInputMode() || (isTouchScreen ? 'touchscreen' : 'keyboard'),
|
|
20
23
|
locale: localStorage.getLocale() || guessLocale(),
|
|
21
24
|
};
|
|
22
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { Locale } from '@scrabble-solver/types';
|
|
3
3
|
|
|
4
|
-
import { AutoGroupTiles } from 'types';
|
|
4
|
+
import { AutoGroupTiles, InputMode } from 'types';
|
|
5
5
|
|
|
6
6
|
import settingsInitialState from './settingsInitialState';
|
|
7
7
|
|
|
@@ -19,6 +19,11 @@ const settingsSlice = createSlice({
|
|
|
19
19
|
return { ...state, configId };
|
|
20
20
|
},
|
|
21
21
|
|
|
22
|
+
changeInputMode: (state, action: PayloadAction<InputMode>) => {
|
|
23
|
+
const inputMode = action.payload;
|
|
24
|
+
return { ...state, inputMode };
|
|
25
|
+
},
|
|
26
|
+
|
|
22
27
|
changeLocale: (state, action: PayloadAction<Locale>) => {
|
|
23
28
|
const locale = action.payload;
|
|
24
29
|
return { ...state, locale };
|
|
@@ -107,6 +107,8 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
|
|
|
107
107
|
--button--icon--size: 24px;
|
|
108
108
|
--dictionary--height: 260px;
|
|
109
109
|
--dictionary--height--mobile: 110px;
|
|
110
|
+
--key--height: 36px;
|
|
111
|
+
--key--icon--size: 16px;
|
|
110
112
|
--logo--aspect-ratio: 682 / 166;
|
|
111
113
|
--logo--height: 60px;
|
|
112
114
|
--modal--width: 370px;
|
|
@@ -4,6 +4,8 @@ export type AutoGroupTiles = 'left' | 'right' | null;
|
|
|
4
4
|
|
|
5
5
|
export type Direction = 'horizontal' | 'vertical';
|
|
6
6
|
|
|
7
|
+
export type InputMode = 'keyboard' | 'touchscreen';
|
|
8
|
+
|
|
7
9
|
export interface Point {
|
|
8
10
|
x: number;
|
|
9
11
|
y: number;
|
|
@@ -45,6 +47,7 @@ export enum ResultColumn {
|
|
|
45
47
|
WordsCount = 'words-count',
|
|
46
48
|
}
|
|
47
49
|
export type TranslationKey =
|
|
50
|
+
| 'cell.enter-word'
|
|
48
51
|
| 'cell.filter-cell'
|
|
49
52
|
| 'cell.set-blank'
|
|
50
53
|
| 'cell.set-not-blank'
|
|
@@ -89,6 +92,7 @@ export type TranslationKey =
|
|
|
89
92
|
| 'menu'
|
|
90
93
|
| 'rack.placeholder'
|
|
91
94
|
| 'rack.tile.location'
|
|
95
|
+
| 'rack.touchscreen.placeholder'
|
|
92
96
|
| 'remaining-tiles'
|
|
93
97
|
| 'results'
|
|
94
98
|
| 'results.empty-state.no-results'
|
|
@@ -104,6 +108,9 @@ export type TranslationKey =
|
|
|
104
108
|
| 'settings.autoGroupTiles.right'
|
|
105
109
|
| 'settings.autoGroupTiles.null'
|
|
106
110
|
| 'settings.game'
|
|
111
|
+
| 'settings.inputMode'
|
|
112
|
+
| 'settings.inputMode.keyboard'
|
|
113
|
+
| 'settings.inputMode.touchscreen'
|
|
107
114
|
| 'settings.language'
|
|
108
115
|
| 'words'
|
|
109
116
|
| 'words.invalid'
|
|
@@ -5,10 +5,11 @@ const getCellsScore = (config, cells) => {
|
|
|
5
5
|
const total = cells.reduce(({ multiplier, score }, cell) => {
|
|
6
6
|
const bonus = config.getCellBonus(cell);
|
|
7
7
|
const { characterMultiplier, wordMultiplier } = bonus && bonus.canApply(config, cell) ? bonus.value : constants_1.NO_BONUS;
|
|
8
|
-
const characterScore =
|
|
8
|
+
const characterScore = config.pointsMap[cell.tile.character] || 0;
|
|
9
|
+
const tileScore = cell.tile.isBlank ? config.blankScore : characterScore;
|
|
9
10
|
return {
|
|
10
11
|
multiplier: multiplier * wordMultiplier,
|
|
11
|
-
score: score +
|
|
12
|
+
score: score + tileScore * characterMultiplier,
|
|
12
13
|
};
|
|
13
14
|
}, { multiplier: 1, score: 0 });
|
|
14
15
|
return total.score * total.multiplier;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/solver",
|
|
3
|
-
"version": "2.11.
|
|
4
|
-
"lockfileVersion":
|
|
3
|
+
"version": "2.11.9",
|
|
4
|
+
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@scrabble-solver/solver",
|
|
9
|
-
"version": "2.11.
|
|
9
|
+
"version": "2.11.9",
|
|
10
10
|
"license": "CC-BY-NC-ND-4.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@kamilmielnik/trie": "^2.0.1"
|
|
@@ -20,5 +20,12 @@
|
|
|
20
20
|
"node": ">=16"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@kamilmielnik/trie": {
|
|
26
|
+
"version": "2.0.1",
|
|
27
|
+
"resolved": "https://registry.npmjs.org/@kamilmielnik/trie/-/trie-2.0.1.tgz",
|
|
28
|
+
"integrity": "sha512-6Ulw5/xgFRadHsx0uVnpOxB2E2ZO2osnaakI26yS3RMlww580JiaQEfXUmQjXZcmOjcO+HrZ0CWjRDhoDYKHbg=="
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/solver",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.9",
|
|
4
4
|
"description": "Scrabble Solver 2 - Solver",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@kamilmielnik/trie": "^2.0.1",
|
|
28
|
-
"@scrabble-solver/types": "^2.11.
|
|
28
|
+
"@scrabble-solver/types": "^2.11.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@scrabble-solver/configs": "^2.11.
|
|
32
|
-
"@scrabble-solver/constants": "^2.11.
|
|
33
|
-
"@scrabble-solver/dictionaries": "^2.11.
|
|
31
|
+
"@scrabble-solver/configs": "^2.11.9",
|
|
32
|
+
"@scrabble-solver/constants": "^2.11.9",
|
|
33
|
+
"@scrabble-solver/dictionaries": "^2.11.9"
|
|
34
34
|
},
|
|
35
35
|
"gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
|
|
36
36
|
}
|
|
@@ -6,11 +6,12 @@ const getCellsScore = (config: Config, cells: Cell[]): number => {
|
|
|
6
6
|
({ multiplier, score }, cell: Cell): { multiplier: number; score: number } => {
|
|
7
7
|
const bonus = config.getCellBonus(cell);
|
|
8
8
|
const { characterMultiplier, wordMultiplier } = bonus && bonus.canApply(config, cell) ? bonus.value : NO_BONUS;
|
|
9
|
-
const characterScore =
|
|
9
|
+
const characterScore = config.pointsMap[cell.tile.character] || 0;
|
|
10
|
+
const tileScore = cell.tile.isBlank ? config.blankScore : characterScore;
|
|
10
11
|
|
|
11
12
|
return {
|
|
12
13
|
multiplier: multiplier * wordMultiplier,
|
|
13
|
-
score: score +
|
|
14
|
+
score: score + tileScore * characterMultiplier,
|
|
14
15
|
};
|
|
15
16
|
},
|
|
16
17
|
{ multiplier: 1, score: 0 },
|
|
@@ -2,6 +2,7 @@ import Bonus from './Bonus';
|
|
|
2
2
|
import BonusValue from './BonusValue';
|
|
3
3
|
import Cell from './Cell';
|
|
4
4
|
import ConfigJson from './ConfigJson';
|
|
5
|
+
import Locale from './Locale';
|
|
5
6
|
import Tile from './Tile';
|
|
6
7
|
import TileConfig from './TileConfig';
|
|
7
8
|
declare class Config {
|
|
@@ -16,6 +17,7 @@ declare class Config {
|
|
|
16
17
|
get blanksCount(): number;
|
|
17
18
|
get boardHeight(): number;
|
|
18
19
|
get boardWidth(): number;
|
|
20
|
+
get locale(): Locale;
|
|
19
21
|
get twoCharacterTiles(): string[];
|
|
20
22
|
getCellBonus(cell: Cell): Bonus | undefined;
|
|
21
23
|
getCellBonusValue(cell: Cell): BonusValue;
|
|
@@ -33,6 +33,9 @@ class Config {
|
|
|
33
33
|
get boardWidth() {
|
|
34
34
|
return this.config.boardWidth;
|
|
35
35
|
}
|
|
36
|
+
get locale() {
|
|
37
|
+
return this.config.locale;
|
|
38
|
+
}
|
|
36
39
|
get twoCharacterTiles() {
|
|
37
40
|
return this.config.tiles.filter((tile) => tile.character.length === 2).map((tile) => tile.character);
|
|
38
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import BonusJson from './BonusJson';
|
|
2
|
+
import Locale from './Locale';
|
|
2
3
|
import TileConfig from './TileConfig';
|
|
3
4
|
interface ConfigJson {
|
|
4
5
|
allTilesBonusScore: number;
|
|
@@ -8,6 +9,7 @@ interface ConfigJson {
|
|
|
8
9
|
boardWidth: number;
|
|
9
10
|
bonuses: BonusJson[];
|
|
10
11
|
id: string;
|
|
12
|
+
locale: Locale;
|
|
11
13
|
maximumCharactersCount: number;
|
|
12
14
|
name: string;
|
|
13
15
|
tiles: TileConfig[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/types",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.9",
|
|
4
4
|
"description": "Scrabble Solver 2 - Types",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"clean:force": "npm run clean && rimraf package-lock.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@scrabble-solver/constants": "^2.11.
|
|
27
|
+
"@scrabble-solver/constants": "^2.11.9"
|
|
28
28
|
},
|
|
29
29
|
"gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
|
|
30
30
|
}
|
|
@@ -5,6 +5,7 @@ import BonusValue from './BonusValue';
|
|
|
5
5
|
import Cell from './Cell';
|
|
6
6
|
import CharacterBonus from './CharacterBonus';
|
|
7
7
|
import ConfigJson from './ConfigJson';
|
|
8
|
+
import Locale from './Locale';
|
|
8
9
|
import Tile from './Tile';
|
|
9
10
|
import TileConfig from './TileConfig';
|
|
10
11
|
import WordBonus from './WordBonus';
|
|
@@ -50,6 +51,10 @@ class Config {
|
|
|
50
51
|
return this.config.boardWidth;
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
public get locale(): Locale {
|
|
55
|
+
return this.config.locale;
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
public get twoCharacterTiles(): string[] {
|
|
54
59
|
return this.config.tiles.filter((tile) => tile.character.length === 2).map((tile) => tile.character);
|
|
55
60
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import BonusJson from './BonusJson';
|
|
2
|
+
import Locale from './Locale';
|
|
2
3
|
import TileConfig from './TileConfig';
|
|
3
4
|
|
|
4
5
|
interface ConfigJson {
|
|
@@ -9,6 +10,7 @@ interface ConfigJson {
|
|
|
9
10
|
boardWidth: number;
|
|
10
11
|
bonuses: BonusJson[];
|
|
11
12
|
id: string;
|
|
13
|
+
locale: Locale;
|
|
12
14
|
maximumCharactersCount: number;
|
|
13
15
|
name: string;
|
|
14
16
|
tiles: TileConfig[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-definitions",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.9",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@scrabble-solver/word-definitions",
|
|
9
|
-
"version": "2.11.
|
|
9
|
+
"version": "2.11.9",
|
|
10
10
|
"license": "CC-BY-NC-ND-4.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cheerio": "^1.0.0-rc.12",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"node_modules/@types/node": {
|
|
30
|
-
"version": "18.15.
|
|
31
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.
|
|
32
|
-
"integrity": "sha512-
|
|
30
|
+
"version": "18.15.11",
|
|
31
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
|
|
32
|
+
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
|
|
33
33
|
"dev": true
|
|
34
34
|
},
|
|
35
35
|
"node_modules/boolbase": {
|
|
@@ -181,9 +181,9 @@
|
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
183
|
"node_modules/htmlparser2": {
|
|
184
|
-
"version": "8.0.
|
|
185
|
-
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.
|
|
186
|
-
"integrity": "sha512-
|
|
184
|
+
"version": "8.0.2",
|
|
185
|
+
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
|
186
|
+
"integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==",
|
|
187
187
|
"funding": [
|
|
188
188
|
"https://github.com/fb55/htmlparser2?sponsor=1",
|
|
189
189
|
{
|
|
@@ -193,9 +193,9 @@
|
|
|
193
193
|
],
|
|
194
194
|
"dependencies": {
|
|
195
195
|
"domelementtype": "^2.3.0",
|
|
196
|
-
"domhandler": "^5.0.
|
|
196
|
+
"domhandler": "^5.0.3",
|
|
197
197
|
"domutils": "^3.0.1",
|
|
198
|
-
"entities": "^4.
|
|
198
|
+
"entities": "^4.4.0"
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
201
|
"node_modules/nth-check": {
|
|
@@ -249,9 +249,9 @@
|
|
|
249
249
|
}
|
|
250
250
|
},
|
|
251
251
|
"@types/node": {
|
|
252
|
-
"version": "18.15.
|
|
253
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.
|
|
254
|
-
"integrity": "sha512-
|
|
252
|
+
"version": "18.15.11",
|
|
253
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
|
|
254
|
+
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
|
|
255
255
|
"dev": true
|
|
256
256
|
},
|
|
257
257
|
"boolbase": {
|
|
@@ -347,14 +347,14 @@
|
|
|
347
347
|
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
|
|
348
348
|
},
|
|
349
349
|
"htmlparser2": {
|
|
350
|
-
"version": "8.0.
|
|
351
|
-
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.
|
|
352
|
-
"integrity": "sha512-
|
|
350
|
+
"version": "8.0.2",
|
|
351
|
+
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
|
352
|
+
"integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==",
|
|
353
353
|
"requires": {
|
|
354
354
|
"domelementtype": "^2.3.0",
|
|
355
|
-
"domhandler": "^5.0.
|
|
355
|
+
"domhandler": "^5.0.3",
|
|
356
356
|
"domutils": "^3.0.1",
|
|
357
|
-
"entities": "^4.
|
|
357
|
+
"entities": "^4.4.0"
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
360
|
"nth-check": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-definitions",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.9",
|
|
4
4
|
"description": "Scrabble Solver 2 - Word definitions",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rimraf build/ node_modules/ package-lock.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scrabble-solver/types": "^2.11.
|
|
26
|
+
"@scrabble-solver/types": "^2.11.9",
|
|
27
27
|
"cheerio": "^1.0.0-rc.12",
|
|
28
28
|
"follow-redirects": "^1.15.2",
|
|
29
29
|
"striptags": "^3.2.0"
|