scrabble-solver 2.15.10 → 2.15.11
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/file-map.json +390 -378
- package/.nx/workspace-data/lockfile.hash +1 -1
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/parsed-lock-file.json +265 -218
- package/.nx/workspace-data/project-graph.json +281 -221
- package/.nx/workspace-data/source-maps.json +32 -0
- package/README.md +1 -1
- package/lerna.json +1 -1
- package/package.json +7 -6
- package/packages/configs/build/games/index.d.ts +1 -0
- package/packages/configs/build/games/index.js +1 -0
- package/packages/configs/build/games/kelimelik.d.ts +3 -1
- package/packages/configs/build/games/kelimelik.js +1 -1
- package/packages/configs/build/games/letterLeague.d.ts +19 -0
- package/packages/configs/build/games/letterLeague.js +161 -0
- package/packages/configs/build/games/literaki.d.ts +3 -1
- package/packages/configs/build/games/literaki.js +1 -1
- package/packages/configs/build/games/scrabble.d.ts +3 -1
- package/packages/configs/build/games/scrabble.js +1 -1
- package/packages/configs/build/games/scrabbleDuel.d.ts +3 -1
- package/packages/configs/build/games/scrabbleDuel.js +1 -1
- package/packages/configs/build/games/superScrabble.d.ts +3 -1
- package/packages/configs/build/games/superScrabble.js +1 -1
- package/packages/configs/build/languages/english.d.ts +4 -2
- package/packages/configs/build/languages/english.js +100 -36
- package/packages/configs/package.json +3 -3
- package/packages/configs/src/games/index.ts +1 -0
- package/packages/configs/src/games/kelimelik.ts +1 -1
- package/packages/configs/src/games/letterLeague.ts +177 -0
- package/packages/configs/src/games/literaki.ts +1 -1
- package/packages/configs/src/games/scrabble.ts +1 -1
- package/packages/configs/src/games/scrabbleDuel.ts +1 -1
- package/packages/configs/src/games/superScrabble.ts +1 -1
- package/packages/configs/src/languages/english.ts +103 -37
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +4 -4
- 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/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/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/next-minimal-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/60.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/812.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/974.js +1 -1
- 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.nft.json +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.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.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +1 -1
- 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-manifest.json +1 -1
- package/packages/scrabble-solver/.next/static/{ylO_ttKeJTuoqDYywao5A → 47JHul8F9NSWCNSEuahuL}/_buildManifest.js +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-0e951de0aebb6505.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-c1d5a66d0f4794a6.js +1 -0
- package/packages/scrabble-solver/.next/trace +23 -23
- package/packages/scrabble-solver/package.json +10 -9
- package/packages/scrabble-solver/public/service-worker.js +2 -2
- package/packages/scrabble-solver/public/service-worker.js.map +1 -1
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +1 -1
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +13 -10
- package/packages/scrabble-solver/src/components/SeoMessage/SeoMessage.tsx +4 -3
- package/packages/scrabble-solver/src/lib/getCoordinate.test.ts +22 -0
- package/packages/scrabble-solver/src/lib/getCoordinate.ts +9 -1
- package/packages/scrabble-solver/src/lib/getRemainingTilesCount.ts +7 -1
- package/packages/scrabble-solver/src/lib/getTotalRemainingTilesCount.ts +7 -1
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.tsx +5 -0
- package/packages/scrabble-solver/src/pages/_app.tsx +2 -1
- package/packages/scrabble-solver/src/pages/index.tsx +5 -2
- package/packages/scrabble-solver/src/state/selectors.ts +1 -1
- package/packages/scrabble-solver/src/types/index.ts +1 -1
- package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -0
- package/packages/solver/build/getPatternScore.js +13 -4
- package/packages/solver/package.json +5 -5
- package/packages/solver/src/getPatternScore.test.ts +139 -53
- package/packages/solver/src/getPatternScore.ts +15 -5
- package/packages/types/build/Bingo.d.ts +10 -0
- package/packages/types/build/Bingo.js +16 -0
- package/packages/types/build/Config.d.ts +3 -1
- package/packages/types/build/Config.js +5 -2
- package/packages/types/build/ConfigJson.d.ts +2 -1
- package/packages/types/build/Game.d.ts +1 -0
- package/packages/types/build/Game.js +1 -0
- package/packages/types/build/TileConfig.d.ts +1 -1
- package/packages/types/build/index.d.ts +1 -0
- package/packages/types/build/index.js +5 -1
- package/packages/types/package.json +2 -2
- package/packages/types/src/Bingo.ts +19 -0
- package/packages/types/src/Config.ts +7 -2
- package/packages/types/src/ConfigJson.ts +2 -1
- package/packages/types/src/Game.ts +1 -0
- package/packages/types/src/TileConfig.ts +1 -1
- package/packages/types/src/index.ts +1 -0
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package.json +2 -2
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-ac93a74c390f2ab8.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/index-e5f1caa581e6d3b8.js +0 -1
- /package/packages/scrabble-solver/.next/static/{ylO_ttKeJTuoqDYywao5A → 47JHul8F9NSWCNSEuahuL}/_ssgManifest.js +0 -0
|
@@ -3,68 +3,154 @@ import { Board, Cell, Game, HorizontalPattern, Locale, Pattern, Tile, VerticalPa
|
|
|
3
3
|
|
|
4
4
|
import { getPatternScore } from './getPatternScore';
|
|
5
5
|
|
|
6
|
-
const locale = Locale.PL_PL;
|
|
7
|
-
const config = getConfig(Game.Literaki, locale);
|
|
8
|
-
const board = Board.fromStringArray([
|
|
9
|
-
' kasom ',
|
|
10
|
-
' i ',
|
|
11
|
-
' napiją ',
|
|
12
|
-
' w i ',
|
|
13
|
-
' krabim ',
|
|
14
|
-
' z ',
|
|
15
|
-
' ę eh ',
|
|
16
|
-
'f s srać ',
|
|
17
|
-
'i z t s ',
|
|
18
|
-
'knebel e ',
|
|
19
|
-
'a ew warcz',
|
|
20
|
-
'ł żyło wody ',
|
|
21
|
-
'o pecyj chu',
|
|
22
|
-
' y ',
|
|
23
|
-
' t ',
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
6
|
describe('getPatternScore', () => {
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
describe('Literaki - PL_PL', () => {
|
|
8
|
+
const config = getConfig(Game.Literaki, Locale.PL_PL);
|
|
9
|
+
const board = Board.fromStringArray([
|
|
10
|
+
' kasom ',
|
|
11
|
+
' i ',
|
|
12
|
+
' napiją ',
|
|
13
|
+
' w i ',
|
|
14
|
+
' krabim ',
|
|
15
|
+
' z ',
|
|
16
|
+
' ę eh ',
|
|
17
|
+
'f s srać ',
|
|
18
|
+
'i z t s ',
|
|
19
|
+
'knebel e ',
|
|
20
|
+
'a ew warcz',
|
|
21
|
+
'ł żyło wody ',
|
|
22
|
+
'o pecyj chu',
|
|
23
|
+
' y ',
|
|
24
|
+
' t ',
|
|
37
25
|
]);
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
it('gives proper score without collisions (źaaaaaaź)', () => {
|
|
28
|
+
const pattern = new Pattern(board, [
|
|
29
|
+
new Cell({ x: 0, y: 0, tile: new Tile({ character: 'ź' }), isEmpty: true }),
|
|
30
|
+
new Cell({ x: 1, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
31
|
+
new Cell({ x: 2, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
32
|
+
new Cell({ x: 3, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
33
|
+
new Cell({ x: 4, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
34
|
+
new Cell({ x: 5, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
35
|
+
new Cell({ x: 6, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
36
|
+
new Cell({ x: 7, y: 0, tile: new Tile({ character: 'ź' }), isEmpty: false }),
|
|
37
|
+
]);
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
new Cell({ x: 2, y: 11, tile: new Tile({ character: 'l' }), isEmpty: true }),
|
|
45
|
-
new Cell({ x: 2, y: 12, tile: new Tile({ character: 'i' }), isEmpty: true }),
|
|
46
|
-
new Cell({ x: 2, y: 13, tile: new Tile({ character: 'n' }), isEmpty: true }),
|
|
47
|
-
new Cell({ x: 2, y: 14, tile: new Tile({ character: 'o' }), isEmpty: true }),
|
|
48
|
-
]);
|
|
39
|
+
expect(getPatternScore(config, pattern)).toBe(128);
|
|
40
|
+
});
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
it('gives proper score with collisions (źaaaaaaź)', () => {
|
|
43
|
+
const pattern = new HorizontalPattern(board, [
|
|
44
|
+
new Cell({ x: 0, y: 0, tile: new Tile({ character: 'ź' }), isEmpty: true }),
|
|
45
|
+
new Cell({ x: 1, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
46
|
+
new Cell({ x: 2, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
47
|
+
new Cell({ x: 3, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
48
|
+
new Cell({ x: 4, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
49
|
+
new Cell({ x: 5, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
50
|
+
new Cell({ x: 6, y: 0, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
51
|
+
new Cell({ x: 7, y: 0, tile: new Tile({ character: 'ź' }), isEmpty: false }),
|
|
52
|
+
]);
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
expect(getPatternScore(config, pattern)).toBe(133);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('gives proper score with collisions (lino)', () => {
|
|
58
|
+
const pattern = new VerticalPattern(board, [
|
|
59
|
+
new Cell({ x: 2, y: 11, tile: new Tile({ character: 'l' }), isEmpty: true }),
|
|
60
|
+
new Cell({ x: 2, y: 12, tile: new Tile({ character: 'i' }), isEmpty: true }),
|
|
61
|
+
new Cell({ x: 2, y: 13, tile: new Tile({ character: 'n' }), isEmpty: true }),
|
|
62
|
+
new Cell({ x: 2, y: 14, tile: new Tile({ character: 'o' }), isEmpty: true }),
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
expect(getPatternScore(config, pattern)).toBe(44);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('gives proper score for blank', () => {
|
|
69
|
+
const pattern = new HorizontalPattern(board, [
|
|
70
|
+
new Cell({ x: 13, y: 14, tile: new Tile({ character: 'o', isBlank: true }), isEmpty: true }),
|
|
71
|
+
new Cell({ x: 12, y: 14, tile: new Tile({ character: 't' }), isEmpty: false }),
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
expect(getPatternScore(config, pattern)).toBe(2);
|
|
75
|
+
});
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
it('gives 0 score for unknown characters', () => {
|
|
78
|
+
const pattern = new HorizontalPattern(board, [
|
|
79
|
+
new Cell({ x: 13, y: 14, tile: new Tile({ character: '?', isBlank: false }), isEmpty: true }),
|
|
80
|
+
new Cell({ x: 12, y: 14, tile: new Tile({ character: 't' }), isEmpty: false }),
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
expect(getPatternScore(config, pattern)).toBe(2);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('gives 50 points bonus for bingo', () => {
|
|
87
|
+
const pattern = new HorizontalPattern(board, [
|
|
88
|
+
new Cell({ x: 6, y: 14, tile: new Tile({ character: 'p' }), isEmpty: true }),
|
|
89
|
+
new Cell({ x: 7, y: 14, tile: new Tile({ character: 'o' }), isEmpty: true }),
|
|
90
|
+
new Cell({ x: 8, y: 14, tile: new Tile({ character: 'r' }), isEmpty: true }),
|
|
91
|
+
new Cell({ x: 9, y: 14, tile: new Tile({ character: 'o' }), isEmpty: true }),
|
|
92
|
+
new Cell({ x: 10, y: 14, tile: new Tile({ character: 'w' }), isEmpty: true }),
|
|
93
|
+
new Cell({ x: 11, y: 14, tile: new Tile({ character: 'a', isBlank: true }), isEmpty: true }),
|
|
94
|
+
new Cell({ x: 11, y: 14, tile: new Tile({ character: 't' }), isEmpty: false }),
|
|
95
|
+
new Cell({ x: 13, y: 14, tile: new Tile({ character: 'e' }), isEmpty: true }),
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
expect(getPatternScore(config, pattern)).toBe(59);
|
|
99
|
+
});
|
|
60
100
|
});
|
|
61
101
|
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
102
|
+
describe('Letter League - EN_US', () => {
|
|
103
|
+
const config = getConfig(Game.LetterLeague, Locale.EN_US);
|
|
104
|
+
|
|
105
|
+
it('gives double multiplier bonus for bingo without collisions', () => {
|
|
106
|
+
const board = Board.create(config.boardWidth, config.boardHeight);
|
|
107
|
+
const pattern = new HorizontalPattern(board, [
|
|
108
|
+
new Cell({ x: 13, y: 6, tile: new Tile({ character: 'r' }), isEmpty: true }),
|
|
109
|
+
new Cell({ x: 13, y: 7, tile: new Tile({ character: 'o' }), isEmpty: true }),
|
|
110
|
+
new Cell({ x: 13, y: 8, tile: new Tile({ character: 'm' }), isEmpty: true }),
|
|
111
|
+
new Cell({ x: 13, y: 9, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
112
|
+
new Cell({ x: 13, y: 10, tile: new Tile({ character: 'i' }), isEmpty: true }),
|
|
113
|
+
new Cell({ x: 13, y: 11, tile: new Tile({ character: 'n' }), isEmpty: true }),
|
|
114
|
+
new Cell({ x: 13, y: 12, tile: new Tile({ character: 'e' }), isEmpty: true }),
|
|
115
|
+
]);
|
|
116
|
+
|
|
117
|
+
expect(getPatternScore(config, pattern)).toBe(18);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('gives double multiplier bonus for bingo with collisions', () => {
|
|
121
|
+
const board = Board.fromStringArray([
|
|
122
|
+
' ',
|
|
123
|
+
' ',
|
|
124
|
+
' ',
|
|
125
|
+
' ',
|
|
126
|
+
' ',
|
|
127
|
+
' ',
|
|
128
|
+
' ',
|
|
129
|
+
' ',
|
|
130
|
+
' ',
|
|
131
|
+
' ',
|
|
132
|
+
' ',
|
|
133
|
+
' ',
|
|
134
|
+
' on ',
|
|
135
|
+
' ',
|
|
136
|
+
' ',
|
|
137
|
+
' ',
|
|
138
|
+
' ',
|
|
139
|
+
' ',
|
|
140
|
+
' ',
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
const pattern = new VerticalPattern(board, [
|
|
144
|
+
new Cell({ x: 13, y: 6, tile: new Tile({ character: 'r' }), isEmpty: true }),
|
|
145
|
+
new Cell({ x: 13, y: 7, tile: new Tile({ character: 'o' }), isEmpty: true }),
|
|
146
|
+
new Cell({ x: 13, y: 8, tile: new Tile({ character: 'm' }), isEmpty: true }),
|
|
147
|
+
new Cell({ x: 13, y: 9, tile: new Tile({ character: 'a' }), isEmpty: true }),
|
|
148
|
+
new Cell({ x: 13, y: 10, tile: new Tile({ character: 'i' }), isEmpty: true }),
|
|
149
|
+
new Cell({ x: 13, y: 11, tile: new Tile({ character: 'n' }), isEmpty: true }),
|
|
150
|
+
new Cell({ x: 13, y: 12, tile: new Tile({ character: 'e' }), isEmpty: true }),
|
|
151
|
+
]);
|
|
67
152
|
|
|
68
|
-
|
|
153
|
+
expect(getPatternScore(config, pattern)).toBe(21);
|
|
154
|
+
});
|
|
69
155
|
});
|
|
70
156
|
});
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import { Config, Pattern } from '@scrabble-solver/types';
|
|
1
|
+
import { Config, isMultiplierBingo, isScoreBingo, Pattern } from '@scrabble-solver/types';
|
|
2
2
|
|
|
3
3
|
import { getCellsScore } from './getCellsScore';
|
|
4
4
|
|
|
5
5
|
export const getPatternScore = (config: Config, pattern: Pattern) => {
|
|
6
6
|
const areAllTilesUsed = pattern.getEmptyCellsCount() === config.rackSize;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const baseScore = getCellsScore(config, pattern.cells);
|
|
8
|
+
const collisionsScore = pattern
|
|
9
9
|
.getCollisions()
|
|
10
|
-
.reduce((sum, collision) => sum + getCellsScore(config, collision.cells),
|
|
10
|
+
.reduce((sum, collision) => sum + getCellsScore(config, collision.cells), 0);
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
if (areAllTilesUsed) {
|
|
13
|
+
if (isScoreBingo(config.bingo)) {
|
|
14
|
+
return baseScore + collisionsScore + config.bingo.score;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (isMultiplierBingo(config.bingo)) {
|
|
18
|
+
return baseScore * config.bingo.multiplier + collisionsScore;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return baseScore + collisionsScore;
|
|
13
23
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type MultiplierBingo = {
|
|
2
|
+
multiplier: number;
|
|
3
|
+
};
|
|
4
|
+
export type ScoreBingo = {
|
|
5
|
+
score: number;
|
|
6
|
+
};
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import { Bingo } from './Bingo';
|
|
1
2
|
import { Bonus } from './Bonus';
|
|
2
3
|
import { BonusValue } from './BonusValue';
|
|
3
4
|
import { Cell } from './Cell';
|
|
@@ -13,7 +14,7 @@ export declare class Config {
|
|
|
13
14
|
readonly pointsMap: Record<string, number>;
|
|
14
15
|
constructor(config: ConfigJson);
|
|
15
16
|
get alphabet(): string[];
|
|
16
|
-
get
|
|
17
|
+
get bingo(): Bingo;
|
|
17
18
|
get blankScore(): number;
|
|
18
19
|
get blanksCount(): number;
|
|
19
20
|
get boardHeight(): number;
|
|
@@ -29,6 +30,7 @@ export declare class Config {
|
|
|
29
30
|
hasCharacter(character: string): boolean;
|
|
30
31
|
isTwoCharacterTilePrefix(character: string): boolean;
|
|
31
32
|
get rackSize(): number;
|
|
33
|
+
get supportsRemainingTiles(): boolean;
|
|
32
34
|
get tiles(): TileConfig[];
|
|
33
35
|
toJson(): ConfigJson;
|
|
34
36
|
}
|
|
@@ -13,8 +13,8 @@ class Config {
|
|
|
13
13
|
get alphabet() {
|
|
14
14
|
return getAlphabet(this.config);
|
|
15
15
|
}
|
|
16
|
-
get
|
|
17
|
-
return this.config.
|
|
16
|
+
get bingo() {
|
|
17
|
+
return this.config.bingo;
|
|
18
18
|
}
|
|
19
19
|
get blankScore() {
|
|
20
20
|
return this.config.blankScore;
|
|
@@ -73,6 +73,9 @@ class Config {
|
|
|
73
73
|
get rackSize() {
|
|
74
74
|
return this.config.rackSize;
|
|
75
75
|
}
|
|
76
|
+
get supportsRemainingTiles() {
|
|
77
|
+
return this.tiles.every((tile) => typeof tile.count === 'number');
|
|
78
|
+
}
|
|
76
79
|
get tiles() {
|
|
77
80
|
return this.config.tiles;
|
|
78
81
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Bingo } from './Bingo';
|
|
1
2
|
import { BonusJson } from './BonusJson';
|
|
2
3
|
import { Game } from './Game';
|
|
3
4
|
import { Locale } from './Locale';
|
|
4
5
|
import { TileConfig } from './TileConfig';
|
|
5
6
|
export interface ConfigJson {
|
|
6
|
-
|
|
7
|
+
bingo: Bingo;
|
|
7
8
|
blankScore: number;
|
|
8
9
|
blanksCount: number;
|
|
9
10
|
boardHeight: number;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WordDefinition = exports.WordBonus = exports.VerticalPattern = exports.isTileJson = exports.Tile = exports.Result = exports.Pattern = exports.Locale = exports.isLocale = exports.isObject = exports.isError = exports.HorizontalPattern = exports.isGame = exports.Game = exports.FinalPattern = exports.Config = exports.CharacterBonus = exports.isCellJson = exports.Cell = exports.Bonus = exports.isBoardJson = exports.Board = void 0;
|
|
3
|
+
exports.WordDefinition = exports.WordBonus = exports.VerticalPattern = exports.isTileJson = exports.Tile = exports.Result = exports.Pattern = exports.Locale = exports.isLocale = exports.isObject = exports.isError = exports.HorizontalPattern = exports.isGame = exports.Game = exports.FinalPattern = exports.Config = exports.CharacterBonus = exports.isCellJson = exports.Cell = exports.Bonus = exports.isBoardJson = exports.Board = exports.isScoreBingo = exports.isMultiplierBingo = exports.isBingo = void 0;
|
|
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; } });
|
|
4
8
|
var Board_1 = require("./Board");
|
|
5
9
|
Object.defineProperty(exports, "Board", { enumerable: true, get: function () { return Board_1.Board; } });
|
|
6
10
|
var BoardJson_1 = require("./BoardJson");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/types",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.11",
|
|
4
4
|
"description": "Scrabble Solver 2 - Types",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rimraf build/"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scrabble-solver/constants": "^2.15.
|
|
26
|
+
"@scrabble-solver/constants": "^2.15.11"
|
|
27
27
|
},
|
|
28
28
|
"gitHead": "1e2d1ad49a288d4a44196d8e3336740da132c637"
|
|
29
29
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isObject } from './isObject';
|
|
2
|
+
|
|
3
|
+
export type MultiplierBingo = { multiplier: number };
|
|
4
|
+
|
|
5
|
+
export type ScoreBingo = { score: number };
|
|
6
|
+
|
|
7
|
+
export type Bingo = MultiplierBingo | ScoreBingo;
|
|
8
|
+
|
|
9
|
+
export const isBingo = (value: unknown): value is Bingo => {
|
|
10
|
+
return isScoreBingo(value) || isMultiplierBingo(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const isScoreBingo = (value: unknown): value is ScoreBingo => {
|
|
14
|
+
return isObject(value) && 'score' in value && typeof value.score === 'number';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const isMultiplierBingo = (value: unknown): value is MultiplierBingo => {
|
|
18
|
+
return isObject(value) && 'multiplier' in value && typeof value.multiplier === 'number';
|
|
19
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BLANK, BONUS_CHARACTER, BONUS_WORD, NO_BONUS } from '@scrabble-solver/constants';
|
|
2
2
|
|
|
3
|
+
import { Bingo } from './Bingo';
|
|
3
4
|
import { Bonus } from './Bonus';
|
|
4
5
|
import { BonusValue } from './BonusValue';
|
|
5
6
|
import { Cell } from './Cell';
|
|
@@ -32,8 +33,8 @@ export class Config {
|
|
|
32
33
|
return getAlphabet(this.config);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
public get
|
|
36
|
-
return this.config.
|
|
36
|
+
public get bingo(): Bingo {
|
|
37
|
+
return this.config.bingo;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
public get blankScore(): number {
|
|
@@ -112,6 +113,10 @@ export class Config {
|
|
|
112
113
|
return this.config.rackSize;
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
public get supportsRemainingTiles(): boolean {
|
|
117
|
+
return this.tiles.every((tile) => typeof tile.count === 'number');
|
|
118
|
+
}
|
|
119
|
+
|
|
115
120
|
public get tiles(): TileConfig[] {
|
|
116
121
|
return this.config.tiles;
|
|
117
122
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Bingo } from './Bingo';
|
|
1
2
|
import { BonusJson } from './BonusJson';
|
|
2
3
|
import { Game } from './Game';
|
|
3
4
|
import { Locale } from './Locale';
|
|
4
5
|
import { TileConfig } from './TileConfig';
|
|
5
6
|
|
|
6
7
|
export interface ConfigJson {
|
|
7
|
-
|
|
8
|
+
bingo: Bingo;
|
|
8
9
|
blankScore: number;
|
|
9
10
|
blanksCount: number;
|
|
10
11
|
boardHeight: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-definitions",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.11",
|
|
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/"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scrabble-solver/types": "^2.15.
|
|
26
|
+
"@scrabble-solver/types": "^2.15.11",
|
|
27
27
|
"cheerio": "^1.0.0",
|
|
28
28
|
"follow-redirects": "^1.15.9",
|
|
29
29
|
"striptags": "^3.2.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/word-lists",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.11",
|
|
4
4
|
"description": "Scrabble Solver 2 - Word lists",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rimraf build/"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scrabble-solver/types": "^2.15.
|
|
26
|
+
"@scrabble-solver/types": "^2.15.11",
|
|
27
27
|
"cheerio": "^1.0.0",
|
|
28
28
|
"follow-redirects": "^1.15.9",
|
|
29
29
|
"transliteration": "^2.3.5",
|