@scrabble-solver/scrabble-solver 2.8.2 → 2.8.4
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +10 -10
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/206.js +98 -97
- package/.next/server/chunks/413.js +396 -677
- package/.next/server/chunks/515.js +546 -550
- package/.next/server/chunks/907.js +399 -681
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +5 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/pages/_app.js +7 -10
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +0 -3
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +114 -171
- package/.next/server/pages/api/solve.js +426 -1206
- package/.next/server/pages/index.html +17 -1
- package/.next/server/pages/index.js +7 -14
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/static/-UOLkxdxU0PlKbXa09-xO/_buildManifest.js +1 -0
- package/.next/static/{nXSSCVI5pGlS_NxEidxkS → -UOLkxdxU0PlKbXa09-xO}/_ssgManifest.js +0 -0
- package/.next/static/chunks/56-2d34867599a0ac66.js +1 -0
- package/.next/static/chunks/pages/{404-02d949d2fe59e960.js → 404-30c06e61d256c5b2.js} +1 -1
- package/.next/static/chunks/pages/_app-6ffa2ab900772b67.js +1 -0
- package/.next/static/chunks/pages/{index-75517525489ab316.js → index-13ea7770a65c69ee.js} +1 -1
- package/.next/static/css/{d676d43c6b9c9a57.css → 551d09cac435debb.css} +1 -1
- package/.next/static/css/{6a9e5ba3f77c27f2.css → cdbc9e0afcff5473.css} +1 -1
- package/.next/trace +42 -42
- package/package.json +14 -14
- package/src/components/Board/Board.tsx +1 -1
- package/src/components/Board/BoardPure.tsx +1 -1
- package/src/components/Board/components/Cell/Button.tsx +1 -1
- package/src/components/Board/components/Cell/Cell.tsx +1 -1
- package/src/components/Board/components/Cell/CellPure.tsx +1 -1
- package/src/components/Board/hooks/useGrid.ts +9 -0
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/Dictionary/Dictionary.tsx +1 -1
- package/src/components/DictionaryInput/DictionaryInput.tsx +1 -1
- package/src/components/EmptyState/EmptyState.tsx +1 -1
- package/src/components/Key/Key.tsx +1 -1
- package/src/components/KeyMap/KeyMap.tsx +2 -2
- package/src/components/KeyMap/components/Mapping/Mapping.module.scss +4 -0
- package/src/components/KeyMap/components/Mapping/Mapping.tsx +16 -12
- package/src/components/Loading/Loading.tsx +1 -1
- package/src/components/Logo/Logo.tsx +1 -1
- package/src/components/NavButtons/NavButtons.tsx +1 -1
- package/src/components/NotFound/NotFound.tsx +1 -1
- package/src/components/PlainTiles/PlainTiles.tsx +5 -1
- package/src/components/PlainTiles/Tile.tsx +1 -1
- package/src/components/Rack/Rack.tsx +1 -1
- package/src/components/Rack/RackTile.tsx +1 -1
- package/src/components/Radio/Radio.tsx +1 -1
- package/src/components/RemainingTiles/Character.tsx +1 -1
- package/src/components/RemainingTiles/RemainingTiles.tsx +1 -1
- package/src/components/Results/Cell.tsx +1 -1
- package/src/components/Results/HeaderButton.tsx +1 -1
- package/src/components/Results/Result.tsx +1 -1
- package/src/components/Results/Results.tsx +1 -1
- package/src/components/Results/SolveButton.tsx +1 -1
- package/src/components/ResultsInput/ResultsInput.tsx +1 -1
- package/src/components/Screen/Screen.tsx +1 -1
- package/src/components/Settings/Settings.tsx +1 -1
- package/src/components/Settings/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -1
- package/src/components/Settings/components/ConfigSetting/ConfigSetting.tsx +1 -1
- package/src/components/Settings/components/LocaleSetting/LocaleSetting.tsx +1 -1
- package/src/components/Sidebar/Sidebar.tsx +1 -1
- package/src/components/Sidebar/components/Section/Section.tsx +1 -1
- package/src/components/Splash/Splash.tsx +1 -1
- package/src/components/SquareButton/Link.tsx +1 -1
- package/src/components/SquareButton/SquareButton.tsx +1 -1
- package/src/components/SvgFontCss/SvgFontCss.tsx +12 -0
- package/src/components/SvgFontCss/index.ts +1 -0
- package/src/components/Tile/Tile.tsx +1 -1
- package/src/components/Tile/TilePure.tsx +2 -2
- package/src/components/Tooltip/useTooltip.tsx +1 -1
- package/src/components/Well/Well.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/hooks/usePortal.tsx +19 -9
- package/src/lib/createKeyboardNavigation.ts +3 -0
- package/src/lib/memoize.ts +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/pages/_document.tsx +1 -1
- package/src/pages/index.tsx +6 -15
- package/src/styles/global.scss +3 -0
- package/.next/static/chunks/195-fcadef5c6eed8338.js +0 -1
- package/.next/static/chunks/pages/_app-f4030148d742bcd2.js +0 -1
- package/.next/static/nXSSCVI5pGlS_NxEidxkS/_buildManifest.js +0 -1
|
@@ -11,19 +11,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var id = _a.id;
|
|
20
|
-
return id === configId;
|
|
21
|
-
});
|
|
14
|
+
const literaki_1 = __importDefault(__webpack_require__(63432));
|
|
15
|
+
const scrabble_1 = __importDefault(__webpack_require__(8964));
|
|
16
|
+
const configs = [literaki_1.default, scrabble_1.default];
|
|
17
|
+
const getConfig = (configId) => {
|
|
18
|
+
const config = configs.find(({ id }) => id === configId);
|
|
22
19
|
if (!config) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
var id = _a.id;
|
|
25
|
-
return id;
|
|
26
|
-
}).join('/')));
|
|
20
|
+
throw new Error(`Invalid "configId" parameter: not one of ${configs.map(({ id }) => id).join('/')}`);
|
|
27
21
|
}
|
|
28
22
|
return config;
|
|
29
23
|
};
|
|
@@ -40,8 +34,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
34
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
35
|
};
|
|
42
36
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const getConfig_1 = __importDefault(__webpack_require__(57079));
|
|
38
|
+
const getLocaleConfig = (configId, locale) => {
|
|
45
39
|
return (0, getConfig_1.default)(configId)[locale];
|
|
46
40
|
};
|
|
47
41
|
exports["default"] = getLocaleConfig;
|
|
@@ -80,14 +74,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
80
74
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
81
75
|
};
|
|
82
76
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return configs.some(
|
|
88
|
-
var id = _a.id;
|
|
89
|
-
return id === configId;
|
|
90
|
-
});
|
|
77
|
+
const literaki_1 = __importDefault(__webpack_require__(63432));
|
|
78
|
+
const scrabble_1 = __importDefault(__webpack_require__(8964));
|
|
79
|
+
const configs = [literaki_1.default, scrabble_1.default];
|
|
80
|
+
const isConfigId = (configId) => {
|
|
81
|
+
return configs.some(({ id }) => id === configId);
|
|
91
82
|
};
|
|
92
83
|
exports["default"] = isConfigId;
|
|
93
84
|
|
|
@@ -99,8 +90,8 @@ exports["default"] = isConfigId;
|
|
|
99
90
|
|
|
100
91
|
|
|
101
92
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
const constants_1 = __webpack_require__(7618);
|
|
94
|
+
const bonuses = [
|
|
104
95
|
{ multiplier: 3, score: 5, type: constants_1.BONUS_CHARACTER, x: 0, y: 0 },
|
|
105
96
|
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 2, y: 0 },
|
|
106
97
|
{ multiplier: 3, score: 2, type: constants_1.BONUS_CHARACTER, x: 5, y: 0 },
|
|
@@ -219,26 +210,14 @@ Object.defineProperty(exports, "default", ({ enumerable: true, get: function ()
|
|
|
219
210
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
220
211
|
|
|
221
212
|
|
|
222
|
-
var __assign = (this && this.__assign) || function () {
|
|
223
|
-
__assign = Object.assign || function(t) {
|
|
224
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
225
|
-
s = arguments[i];
|
|
226
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
227
|
-
t[p] = s[p];
|
|
228
|
-
}
|
|
229
|
-
return t;
|
|
230
|
-
};
|
|
231
|
-
return __assign.apply(this, arguments);
|
|
232
|
-
};
|
|
233
213
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
234
214
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
235
215
|
};
|
|
236
|
-
var _a;
|
|
237
216
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
217
|
+
const types_1 = __webpack_require__(34046);
|
|
218
|
+
const bonuses_1 = __importDefault(__webpack_require__(72376));
|
|
219
|
+
const tiles_1 = __webpack_require__(87529);
|
|
220
|
+
const base = {
|
|
242
221
|
allTilesBonusScore: 50,
|
|
243
222
|
blankScore: 0,
|
|
244
223
|
boardHeight: 15,
|
|
@@ -249,17 +228,16 @@ var base = {
|
|
|
249
228
|
name: 'Literaki',
|
|
250
229
|
numberOfBlanks: 2,
|
|
251
230
|
};
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
_a);
|
|
231
|
+
const literaki = {
|
|
232
|
+
id: base.id,
|
|
233
|
+
name: base.name,
|
|
234
|
+
[types_1.Locale.DE_DE]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesDe }),
|
|
235
|
+
[types_1.Locale.EN_GB]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesEn }),
|
|
236
|
+
[types_1.Locale.EN_US]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesEn }),
|
|
237
|
+
[types_1.Locale.ES_ES]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesEs }),
|
|
238
|
+
[types_1.Locale.FR_FR]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesFr }),
|
|
239
|
+
[types_1.Locale.PL_PL]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesPl }),
|
|
240
|
+
};
|
|
263
241
|
exports["default"] = literaki;
|
|
264
242
|
|
|
265
243
|
|
|
@@ -293,7 +271,7 @@ Object.defineProperty(exports, "tilesDe", ({ enumerable: true, get: function ()
|
|
|
293
271
|
|
|
294
272
|
|
|
295
273
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
296
|
-
|
|
274
|
+
const tilesDe = [
|
|
297
275
|
{ character: 'a', count: 5, score: 1 },
|
|
298
276
|
{ character: 'ä', count: 1, score: 6 },
|
|
299
277
|
{ character: 'b', count: 2, score: 3 },
|
|
@@ -334,7 +312,7 @@ exports["default"] = tilesDe;
|
|
|
334
312
|
|
|
335
313
|
|
|
336
314
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
337
|
-
|
|
315
|
+
const tilesEn = [
|
|
338
316
|
{ character: 'a', count: 9, score: 1 },
|
|
339
317
|
{ character: 'b', count: 2, score: 3 },
|
|
340
318
|
{ character: 'c', count: 2, score: 3 },
|
|
@@ -372,7 +350,7 @@ exports["default"] = tilesEn;
|
|
|
372
350
|
|
|
373
351
|
|
|
374
352
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
375
|
-
|
|
353
|
+
const tilesEs = [
|
|
376
354
|
{ character: 'a', count: 12, score: 1 },
|
|
377
355
|
{ character: 'b', count: 2, score: 3 },
|
|
378
356
|
{ character: 'c', count: 4, score: 3 },
|
|
@@ -412,7 +390,7 @@ exports["default"] = tilesEs;
|
|
|
412
390
|
|
|
413
391
|
|
|
414
392
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
415
|
-
|
|
393
|
+
const tilesFr = [
|
|
416
394
|
{ character: 'a', count: 9, score: 1 },
|
|
417
395
|
{ character: 'b', count: 2, score: 3 },
|
|
418
396
|
{ character: 'c', count: 2, score: 3 },
|
|
@@ -450,7 +428,7 @@ exports["default"] = tilesFr;
|
|
|
450
428
|
|
|
451
429
|
|
|
452
430
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
453
|
-
|
|
431
|
+
const tilesPl = [
|
|
454
432
|
{ character: 'a', count: 9, score: 1 },
|
|
455
433
|
{ character: 'ą', count: 1, score: 5 },
|
|
456
434
|
{ character: 'b', count: 2, score: 3 },
|
|
@@ -494,8 +472,8 @@ exports["default"] = tilesPl;
|
|
|
494
472
|
|
|
495
473
|
|
|
496
474
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
497
|
-
|
|
498
|
-
|
|
475
|
+
const constants_1 = __webpack_require__(7618);
|
|
476
|
+
const bonuses = [
|
|
499
477
|
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 0, y: 0 },
|
|
500
478
|
{ multiplier: 2, type: constants_1.BONUS_CHARACTER, x: 3, y: 0 },
|
|
501
479
|
{ multiplier: 3, type: constants_1.BONUS_WORD, x: 7, y: 0 },
|
|
@@ -582,26 +560,14 @@ Object.defineProperty(exports, "default", ({ enumerable: true, get: function ()
|
|
|
582
560
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
583
561
|
|
|
584
562
|
|
|
585
|
-
var __assign = (this && this.__assign) || function () {
|
|
586
|
-
__assign = Object.assign || function(t) {
|
|
587
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
588
|
-
s = arguments[i];
|
|
589
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
590
|
-
t[p] = s[p];
|
|
591
|
-
}
|
|
592
|
-
return t;
|
|
593
|
-
};
|
|
594
|
-
return __assign.apply(this, arguments);
|
|
595
|
-
};
|
|
596
563
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
597
564
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
598
565
|
};
|
|
599
|
-
var _a;
|
|
600
566
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
567
|
+
const types_1 = __webpack_require__(34046);
|
|
568
|
+
const bonuses_1 = __importDefault(__webpack_require__(51551));
|
|
569
|
+
const tiles_1 = __webpack_require__(29213);
|
|
570
|
+
const base = {
|
|
605
571
|
allTilesBonusScore: 50,
|
|
606
572
|
blankScore: 0,
|
|
607
573
|
boardHeight: 15,
|
|
@@ -612,17 +578,16 @@ var base = {
|
|
|
612
578
|
name: 'Scrabble',
|
|
613
579
|
numberOfBlanks: 2,
|
|
614
580
|
};
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
},
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
_a);
|
|
581
|
+
const scrabble = {
|
|
582
|
+
id: base.id,
|
|
583
|
+
name: base.name,
|
|
584
|
+
[types_1.Locale.EN_GB]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesEn }),
|
|
585
|
+
[types_1.Locale.DE_DE]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesDe }),
|
|
586
|
+
[types_1.Locale.EN_US]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesEn }),
|
|
587
|
+
[types_1.Locale.ES_ES]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesEs }),
|
|
588
|
+
[types_1.Locale.FR_FR]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesFr }),
|
|
589
|
+
[types_1.Locale.PL_PL]: types_1.Config.fromJson({ ...base, tiles: tiles_1.tilesPl }),
|
|
590
|
+
};
|
|
626
591
|
exports["default"] = scrabble;
|
|
627
592
|
|
|
628
593
|
|
|
@@ -656,7 +621,7 @@ Object.defineProperty(exports, "tilesDe", ({ enumerable: true, get: function ()
|
|
|
656
621
|
|
|
657
622
|
|
|
658
623
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
659
|
-
|
|
624
|
+
const tilesDe = [
|
|
660
625
|
{ character: 'a', count: 5, score: 1 },
|
|
661
626
|
{ character: 'ä', count: 1, score: 6 },
|
|
662
627
|
{ character: 'b', count: 2, score: 3 },
|
|
@@ -697,7 +662,7 @@ exports["default"] = tilesDe;
|
|
|
697
662
|
|
|
698
663
|
|
|
699
664
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
700
|
-
|
|
665
|
+
const tilesEn = [
|
|
701
666
|
{ character: 'a', count: 9, score: 1 },
|
|
702
667
|
{ character: 'b', count: 2, score: 3 },
|
|
703
668
|
{ character: 'c', count: 2, score: 3 },
|
|
@@ -735,7 +700,7 @@ exports["default"] = tilesEn;
|
|
|
735
700
|
|
|
736
701
|
|
|
737
702
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
738
|
-
|
|
703
|
+
const tilesEs = [
|
|
739
704
|
{ character: 'a', count: 12, score: 1 },
|
|
740
705
|
{ character: 'b', count: 2, score: 3 },
|
|
741
706
|
{ character: 'c', count: 4, score: 3 },
|
|
@@ -775,7 +740,7 @@ exports["default"] = tilesEs;
|
|
|
775
740
|
|
|
776
741
|
|
|
777
742
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
778
|
-
|
|
743
|
+
const tilesFr = [
|
|
779
744
|
{ character: 'a', count: 9, score: 1 },
|
|
780
745
|
{ character: 'b', count: 2, score: 3 },
|
|
781
746
|
{ character: 'c', count: 2, score: 3 },
|
|
@@ -813,7 +778,7 @@ exports["default"] = tilesFr;
|
|
|
813
778
|
|
|
814
779
|
|
|
815
780
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
816
|
-
|
|
781
|
+
const tilesPl = [
|
|
817
782
|
{ character: 'a', count: 9, score: 1 },
|
|
818
783
|
{ character: 'ą', count: 1, score: 5 },
|
|
819
784
|
{ character: 'b', count: 2, score: 3 },
|
|
@@ -952,7 +917,7 @@ const noop = ()=>undefined;
|
|
|
952
917
|
|
|
953
918
|
;// CONCATENATED MODULE: ./src/lib/createKeyboardNavigation.ts
|
|
954
919
|
|
|
955
|
-
const createKeyboardNavigation = ({ onArrowDown =lib_noop , onArrowLeft =lib_noop , onArrowRight =lib_noop , onArrowUp =lib_noop , onBackspace =lib_noop , onDelete =lib_noop , onEnter =lib_noop , onKeyDown =lib_noop })=>{
|
|
920
|
+
const createKeyboardNavigation = ({ onArrowDown =lib_noop , onArrowLeft =lib_noop , onArrowRight =lib_noop , onArrowUp =lib_noop , onBackspace =lib_noop , onDelete =lib_noop , onEnter =lib_noop , onKeyDown =lib_noop , onSpace =lib_noop })=>{
|
|
956
921
|
const handlers = {
|
|
957
922
|
ArrowUp: onArrowUp,
|
|
958
923
|
ArrowDown: onArrowDown,
|
|
@@ -960,7 +925,8 @@ const createKeyboardNavigation = ({ onArrowDown =lib_noop , onArrowLeft =lib_noo
|
|
|
960
925
|
ArrowRight: onArrowRight,
|
|
961
926
|
Backspace: onBackspace,
|
|
962
927
|
Delete: onDelete,
|
|
963
|
-
Enter: onEnter
|
|
928
|
+
Enter: onEnter,
|
|
929
|
+
" ": onSpace
|
|
964
930
|
};
|
|
965
931
|
const handleKeyDown = (event)=>{
|
|
966
932
|
const handler = handlers[event.key] || lib_noop;
|
|
@@ -2468,115 +2434,98 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2468
2434
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2469
2435
|
};
|
|
2470
2436
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
var rows = _a.rows;
|
|
2437
|
+
const constants_1 = __webpack_require__(7618);
|
|
2438
|
+
const Cell_1 = __importDefault(__webpack_require__(52251));
|
|
2439
|
+
const Tile_1 = __importDefault(__webpack_require__(25275));
|
|
2440
|
+
class Board {
|
|
2441
|
+
constructor({ rows }) {
|
|
2477
2442
|
this.rows = rows;
|
|
2478
2443
|
this.numberOfColumns = rows[0].length;
|
|
2479
2444
|
this.numberOfRows = rows.length;
|
|
2480
2445
|
}
|
|
2481
|
-
|
|
2446
|
+
static create(width, height) {
|
|
2482
2447
|
return Board.fromStringArray(Array(height).fill(Array(width).fill(' ').join('')));
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2448
|
+
}
|
|
2449
|
+
static fromJson(json) {
|
|
2485
2450
|
return new Board({
|
|
2486
|
-
rows: json.map(
|
|
2451
|
+
rows: json.map((row) => row.map(Cell_1.default.fromJson)),
|
|
2487
2452
|
});
|
|
2488
|
-
}
|
|
2489
|
-
|
|
2453
|
+
}
|
|
2454
|
+
static fromStringArray(stringArray) {
|
|
2490
2455
|
return new Board({
|
|
2491
|
-
rows: stringArray.map(
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
y: y,
|
|
2498
|
-
});
|
|
2499
|
-
});
|
|
2500
|
-
}),
|
|
2456
|
+
rows: stringArray.map((row, y) => row.split('').map((character, x) => new Cell_1.default({
|
|
2457
|
+
isEmpty: !character || character === constants_1.EMPTY_CELL,
|
|
2458
|
+
tile: character === constants_1.EMPTY_CELL ? Tile_1.default.Null : new Tile_1.default({ character }),
|
|
2459
|
+
x,
|
|
2460
|
+
y,
|
|
2461
|
+
}))),
|
|
2501
2462
|
});
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
}
|
|
2512
|
-
|
|
2513
|
-
var rows = this.rows.map(function (row) { return row.map(function (cell) { return cell.clone(); }); });
|
|
2514
|
-
return new Board({ rows: rows });
|
|
2515
|
-
};
|
|
2516
|
-
Board.prototype.collides = function (cell) {
|
|
2463
|
+
}
|
|
2464
|
+
get center() {
|
|
2465
|
+
const x = Math.floor(this.numberOfColumns / 2);
|
|
2466
|
+
const y = Math.floor(this.numberOfRows / 2);
|
|
2467
|
+
return this.rows[y][x];
|
|
2468
|
+
}
|
|
2469
|
+
clone() {
|
|
2470
|
+
const rows = this.rows.map((row) => row.map((cell) => cell.clone()));
|
|
2471
|
+
return new Board({ rows });
|
|
2472
|
+
}
|
|
2473
|
+
collides(cell) {
|
|
2517
2474
|
return this.collidesUp(cell) || this.collidesDown(cell) || this.collidesLeft(cell) || this.collidesRight(cell);
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2520
|
-
var x = _a.x, y = _a.y;
|
|
2475
|
+
}
|
|
2476
|
+
collidesDown({ x, y }) {
|
|
2521
2477
|
return y < this.numberOfRows - 1 && !this.rows[y + 1][x].isEmpty;
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
var x = _a.x, y = _a.y;
|
|
2478
|
+
}
|
|
2479
|
+
collidesLeft({ x, y }) {
|
|
2525
2480
|
return x > 0 && !this.rows[y][x - 1].isEmpty;
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2528
|
-
var x = _a.x, y = _a.y;
|
|
2481
|
+
}
|
|
2482
|
+
collidesRight({ x, y }) {
|
|
2529
2483
|
return x < this.numberOfColumns - 1 && !this.rows[y][x + 1].isEmpty;
|
|
2530
|
-
}
|
|
2531
|
-
|
|
2532
|
-
var x = _a.x, y = _a.y;
|
|
2484
|
+
}
|
|
2485
|
+
collidesUp({ x, y }) {
|
|
2533
2486
|
return y > 0 && !this.rows[y - 1][x].isEmpty;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2487
|
+
}
|
|
2488
|
+
equals(other) {
|
|
2536
2489
|
return (this.numberOfColumns === other.numberOfColumns &&
|
|
2537
2490
|
this.numberOfRows === other.numberOfRows &&
|
|
2538
|
-
this.rows.every(
|
|
2539
|
-
return row.every(
|
|
2491
|
+
this.rows.every((row, rowIndex) => {
|
|
2492
|
+
return row.every((cell, cellIndex) => {
|
|
2540
2493
|
return cell.equals(other.rows[rowIndex][cellIndex]);
|
|
2541
2494
|
});
|
|
2542
2495
|
}));
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
return this.rows.reduce(
|
|
2546
|
-
return count + row.reduce(
|
|
2496
|
+
}
|
|
2497
|
+
getBlanksCount() {
|
|
2498
|
+
return this.rows.reduce((count, row) => {
|
|
2499
|
+
return count + row.reduce((rowCount, cell) => (cell.tile.isBlank ? rowCount + 1 : rowCount), 0);
|
|
2547
2500
|
}, 0);
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
return this.rows.map(
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2501
|
+
}
|
|
2502
|
+
getColumn(index) {
|
|
2503
|
+
return this.rows.map((row) => row[index]);
|
|
2504
|
+
}
|
|
2505
|
+
getRow(index) {
|
|
2553
2506
|
return this.rows[index];
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
return this.rows.reduce(
|
|
2557
|
-
return count + row.reduce(
|
|
2507
|
+
}
|
|
2508
|
+
getTilesCount() {
|
|
2509
|
+
return this.rows.reduce((count, row) => {
|
|
2510
|
+
return count + row.reduce((rowCount, cell) => (cell.hasTile() ? rowCount + 1 : rowCount), 0);
|
|
2558
2511
|
}, 0);
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
|
-
return this.rows.every(
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
return this.rows.map(
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
return this.rows.map(function (row) { return row.map(String); }).join('\n');
|
|
2571
|
-
};
|
|
2572
|
-
Board.prototype.updateCell = function (x, y, updateCell) {
|
|
2512
|
+
}
|
|
2513
|
+
isEmpty() {
|
|
2514
|
+
return this.rows.every((row) => row.every(({ isEmpty }) => isEmpty));
|
|
2515
|
+
}
|
|
2516
|
+
toJson() {
|
|
2517
|
+
return this.rows.map((row) => row.map((cell) => cell.toJson()));
|
|
2518
|
+
}
|
|
2519
|
+
toString() {
|
|
2520
|
+
return this.rows.map((row) => row.map(String)).join('\n');
|
|
2521
|
+
}
|
|
2522
|
+
updateCell(x, y, updateCell) {
|
|
2573
2523
|
this.rows[y][x] = updateCell(this.rows[y][x]);
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2524
|
+
}
|
|
2525
|
+
updateRow(y, updateRow) {
|
|
2576
2526
|
this.rows[y] = updateRow(this.rows[y]);
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
}());
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2580
2529
|
exports["default"] = Board;
|
|
2581
2530
|
|
|
2582
2531
|
|
|
@@ -2587,21 +2536,20 @@ exports["default"] = Board;
|
|
|
2587
2536
|
|
|
2588
2537
|
|
|
2589
2538
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
var multiplier = _a.multiplier, score = _a.score, x = _a.x, y = _a.y;
|
|
2539
|
+
class Bonus {
|
|
2540
|
+
constructor({ multiplier, score, x, y }) {
|
|
2593
2541
|
this.multiplier = multiplier;
|
|
2594
2542
|
this.score = score;
|
|
2595
2543
|
this.x = x;
|
|
2596
2544
|
this.y = y;
|
|
2597
2545
|
}
|
|
2598
|
-
|
|
2546
|
+
canApply(_config, cell) {
|
|
2599
2547
|
return cell.isEmpty && this.matchesCellCoordinates(cell);
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2548
|
+
}
|
|
2549
|
+
matchesCellCoordinates(cell) {
|
|
2602
2550
|
return this.x === cell.x && this.y === cell.y;
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2551
|
+
}
|
|
2552
|
+
toJson() {
|
|
2605
2553
|
return {
|
|
2606
2554
|
multiplier: this.multiplier,
|
|
2607
2555
|
score: this.score,
|
|
@@ -2609,19 +2557,14 @@ var Bonus = /** @class */ (function () {
|
|
|
2609
2557
|
x: this.x,
|
|
2610
2558
|
y: this.y,
|
|
2611
2559
|
};
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
enumerable: false,
|
|
2621
|
-
configurable: true
|
|
2622
|
-
});
|
|
2623
|
-
return Bonus;
|
|
2624
|
-
}());
|
|
2560
|
+
}
|
|
2561
|
+
get value() {
|
|
2562
|
+
return {
|
|
2563
|
+
characterMultiplier: 1,
|
|
2564
|
+
wordMultiplier: 1,
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2625
2568
|
exports["default"] = Bonus;
|
|
2626
2569
|
|
|
2627
2570
|
|
|
@@ -2635,17 +2578,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2635
2578
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2636
2579
|
};
|
|
2637
2580
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2638
|
-
|
|
2639
|
-
|
|
2581
|
+
const Tile_1 = __importDefault(__webpack_require__(25275));
|
|
2582
|
+
class Cell {
|
|
2640
2583
|
// eslint-disable-next-line no-undef
|
|
2641
|
-
|
|
2642
|
-
var _b = _a.isEmpty, isEmpty = _b === void 0 ? true : _b, _c = _a.tile, tile = _c === void 0 ? Tile_1.default.Null : _c, x = _a.x, y = _a.y;
|
|
2584
|
+
constructor({ isEmpty = true, tile = Tile_1.default.Null, x, y }) {
|
|
2643
2585
|
this.isEmpty = isEmpty;
|
|
2644
2586
|
this.tile = tile;
|
|
2645
2587
|
this.x = x;
|
|
2646
2588
|
this.y = y;
|
|
2647
2589
|
}
|
|
2648
|
-
|
|
2590
|
+
static fromJson(json) {
|
|
2649
2591
|
if (!json) {
|
|
2650
2592
|
return Cell.Null;
|
|
2651
2593
|
}
|
|
@@ -2655,49 +2597,48 @@ var Cell = /** @class */ (function () {
|
|
|
2655
2597
|
x: json.x,
|
|
2656
2598
|
y: json.y,
|
|
2657
2599
|
});
|
|
2658
|
-
}
|
|
2659
|
-
|
|
2600
|
+
}
|
|
2601
|
+
clone() {
|
|
2660
2602
|
return new Cell({
|
|
2661
2603
|
isEmpty: this.isEmpty,
|
|
2662
2604
|
tile: this.tile.clone(),
|
|
2663
2605
|
x: this.x,
|
|
2664
2606
|
y: this.y,
|
|
2665
2607
|
});
|
|
2666
|
-
}
|
|
2667
|
-
|
|
2608
|
+
}
|
|
2609
|
+
equals(other) {
|
|
2668
2610
|
return this.x === other.x && this.y === other.y && this.isEmpty === other.isEmpty && this.tile.equals(other.tile);
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2611
|
+
}
|
|
2612
|
+
hasTile() {
|
|
2671
2613
|
return this.tile !== Tile_1.default.Null;
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2614
|
+
}
|
|
2615
|
+
isCandidate() {
|
|
2674
2616
|
return this.isEmpty && this.hasTile();
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2617
|
+
}
|
|
2618
|
+
toJson() {
|
|
2677
2619
|
return {
|
|
2678
2620
|
isEmpty: this.isEmpty,
|
|
2679
2621
|
tile: this.tile.toJson(),
|
|
2680
2622
|
x: this.x,
|
|
2681
2623
|
y: this.y,
|
|
2682
2624
|
};
|
|
2683
|
-
}
|
|
2684
|
-
|
|
2685
|
-
return
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
}());
|
|
2625
|
+
}
|
|
2626
|
+
toString() {
|
|
2627
|
+
return this.tile.toString();
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
Cell.Null = Object.freeze({
|
|
2631
|
+
isEmpty: true,
|
|
2632
|
+
tile: Tile_1.default.Null,
|
|
2633
|
+
x: 0,
|
|
2634
|
+
y: 0,
|
|
2635
|
+
clone: () => Cell.Null,
|
|
2636
|
+
equals: (other) => other === Cell.Null,
|
|
2637
|
+
hasTile: () => false,
|
|
2638
|
+
isCandidate: () => false,
|
|
2639
|
+
toString: () => '',
|
|
2640
|
+
toJson: () => null,
|
|
2641
|
+
});
|
|
2701
2642
|
exports["default"] = Cell;
|
|
2702
2643
|
|
|
2703
2644
|
|
|
@@ -2707,55 +2648,33 @@ exports["default"] = Cell;
|
|
|
2707
2648
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2708
2649
|
|
|
2709
2650
|
|
|
2710
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2711
|
-
var extendStatics = function (d, b) {
|
|
2712
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2713
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2714
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2715
|
-
return extendStatics(d, b);
|
|
2716
|
-
};
|
|
2717
|
-
return function (d, b) {
|
|
2718
|
-
if (typeof b !== "function" && b !== null)
|
|
2719
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2720
|
-
extendStatics(d, b);
|
|
2721
|
-
function __() { this.constructor = d; }
|
|
2722
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2723
|
-
};
|
|
2724
|
-
})();
|
|
2725
2651
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2726
2652
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2727
2653
|
};
|
|
2728
2654
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
};
|
|
2741
|
-
CharacterBonus.prototype.matchesCellTileScore = function (config, cell) {
|
|
2655
|
+
const constants_1 = __webpack_require__(7618);
|
|
2656
|
+
const Bonus_1 = __importDefault(__webpack_require__(37706));
|
|
2657
|
+
class CharacterBonus extends Bonus_1.default {
|
|
2658
|
+
constructor() {
|
|
2659
|
+
super(...arguments);
|
|
2660
|
+
this.type = constants_1.BONUS_CHARACTER;
|
|
2661
|
+
}
|
|
2662
|
+
canApply(config, cell) {
|
|
2663
|
+
return super.canApply(config, cell) && this.matchesCellTileScore(config, cell);
|
|
2664
|
+
}
|
|
2665
|
+
matchesCellTileScore(config, cell) {
|
|
2742
2666
|
if (typeof this.score === 'undefined') {
|
|
2743
2667
|
return true;
|
|
2744
2668
|
}
|
|
2745
2669
|
return this.score === config.pointsMap[cell.tile.character];
|
|
2746
|
-
}
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
enumerable: false,
|
|
2755
|
-
configurable: true
|
|
2756
|
-
});
|
|
2757
|
-
return CharacterBonus;
|
|
2758
|
-
}(Bonus_1.default));
|
|
2670
|
+
}
|
|
2671
|
+
get value() {
|
|
2672
|
+
return {
|
|
2673
|
+
characterMultiplier: this.multiplier,
|
|
2674
|
+
wordMultiplier: 1,
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2759
2678
|
exports["default"] = CharacterBonus;
|
|
2760
2679
|
|
|
2761
2680
|
|
|
@@ -2765,83 +2684,47 @@ exports["default"] = CharacterBonus;
|
|
|
2765
2684
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2766
2685
|
|
|
2767
2686
|
|
|
2768
|
-
var __assign = (this && this.__assign) || function () {
|
|
2769
|
-
__assign = Object.assign || function(t) {
|
|
2770
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2771
|
-
s = arguments[i];
|
|
2772
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2773
|
-
t[p] = s[p];
|
|
2774
|
-
}
|
|
2775
|
-
return t;
|
|
2776
|
-
};
|
|
2777
|
-
return __assign.apply(this, arguments);
|
|
2778
|
-
};
|
|
2779
2687
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2780
2688
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2781
2689
|
};
|
|
2782
2690
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2691
|
+
const constants_1 = __webpack_require__(7618);
|
|
2692
|
+
const CharacterBonus_1 = __importDefault(__webpack_require__(19582));
|
|
2693
|
+
const WordBonus_1 = __importDefault(__webpack_require__(58627));
|
|
2694
|
+
class Config {
|
|
2695
|
+
constructor(config) {
|
|
2788
2696
|
this.bonuses = getBonuses(config);
|
|
2789
2697
|
this.config = config;
|
|
2790
2698
|
this.pointsMap = getPointsMap(this.config);
|
|
2791
2699
|
}
|
|
2792
|
-
|
|
2700
|
+
static fromJson(json) {
|
|
2793
2701
|
return new Config(json);
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
enumerable: false,
|
|
2821
|
-
configurable: true
|
|
2822
|
-
});
|
|
2823
|
-
Object.defineProperty(Config.prototype, "boardWidth", {
|
|
2824
|
-
get: function () {
|
|
2825
|
-
return this.config.boardWidth;
|
|
2826
|
-
},
|
|
2827
|
-
enumerable: false,
|
|
2828
|
-
configurable: true
|
|
2829
|
-
});
|
|
2830
|
-
Object.defineProperty(Config.prototype, "twoCharacterTiles", {
|
|
2831
|
-
get: function () {
|
|
2832
|
-
return this.config.tiles.filter(function (tile) { return tile.character.length === 2; }).map(function (tile) { return tile.character; });
|
|
2833
|
-
},
|
|
2834
|
-
enumerable: false,
|
|
2835
|
-
configurable: true
|
|
2836
|
-
});
|
|
2837
|
-
Config.prototype.getCellBonus = function (cell) {
|
|
2838
|
-
return this.bonuses.find(function (bonus) { return bonus.matchesCellCoordinates(cell); });
|
|
2839
|
-
};
|
|
2840
|
-
Config.prototype.getCellBonusValue = function (cell) {
|
|
2841
|
-
var _a;
|
|
2842
|
-
return ((_a = this.getCellBonus(cell)) === null || _a === void 0 ? void 0 : _a.value) || constants_1.NO_BONUS;
|
|
2843
|
-
};
|
|
2844
|
-
Config.prototype.getCharacterPoints = function (character) {
|
|
2702
|
+
}
|
|
2703
|
+
get allTilesBonusScore() {
|
|
2704
|
+
return this.config.allTilesBonusScore;
|
|
2705
|
+
}
|
|
2706
|
+
get alphabet() {
|
|
2707
|
+
return getAlphabet(this.config);
|
|
2708
|
+
}
|
|
2709
|
+
get blankScore() {
|
|
2710
|
+
return this.config.blankScore;
|
|
2711
|
+
}
|
|
2712
|
+
get boardHeight() {
|
|
2713
|
+
return this.config.boardHeight;
|
|
2714
|
+
}
|
|
2715
|
+
get boardWidth() {
|
|
2716
|
+
return this.config.boardWidth;
|
|
2717
|
+
}
|
|
2718
|
+
get twoCharacterTiles() {
|
|
2719
|
+
return this.config.tiles.filter((tile) => tile.character.length === 2).map((tile) => tile.character);
|
|
2720
|
+
}
|
|
2721
|
+
getCellBonus(cell) {
|
|
2722
|
+
return this.bonuses.find((bonus) => bonus.matchesCellCoordinates(cell));
|
|
2723
|
+
}
|
|
2724
|
+
getCellBonusValue(cell) {
|
|
2725
|
+
return this.getCellBonus(cell)?.value || constants_1.NO_BONUS;
|
|
2726
|
+
}
|
|
2727
|
+
getCharacterPoints(character) {
|
|
2845
2728
|
if (character === null) {
|
|
2846
2729
|
return undefined;
|
|
2847
2730
|
}
|
|
@@ -2849,73 +2732,54 @@ var Config = /** @class */ (function () {
|
|
|
2849
2732
|
return this.blankScore;
|
|
2850
2733
|
}
|
|
2851
2734
|
return this.pointsMap[character];
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2735
|
+
}
|
|
2736
|
+
getTwoCharacterTileByPrefix(character) {
|
|
2854
2737
|
if (character.length !== 1) {
|
|
2855
2738
|
return undefined;
|
|
2856
2739
|
}
|
|
2857
|
-
return this.twoCharacterTiles.find(
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2740
|
+
return this.twoCharacterTiles.find((characters) => characters.startsWith(character));
|
|
2741
|
+
}
|
|
2742
|
+
getTilePoints(tile) {
|
|
2860
2743
|
if (tile === null) {
|
|
2861
2744
|
return undefined;
|
|
2862
2745
|
}
|
|
2863
2746
|
return tile.isBlank ? this.blankScore : this.getCharacterPoints(tile.character);
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2747
|
+
}
|
|
2748
|
+
hasCharacter(character) {
|
|
2866
2749
|
return this.alphabet.includes(character);
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2750
|
+
}
|
|
2751
|
+
isTwoCharacterTilePrefix(character) {
|
|
2869
2752
|
return typeof this.getTwoCharacterTileByPrefix(character) !== 'undefined';
|
|
2870
|
-
}
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
},
|
|
2882
|
-
enumerable: false,
|
|
2883
|
-
configurable: true
|
|
2884
|
-
});
|
|
2885
|
-
Object.defineProperty(Config.prototype, "tiles", {
|
|
2886
|
-
get: function () {
|
|
2887
|
-
return this.config.tiles;
|
|
2888
|
-
},
|
|
2889
|
-
enumerable: false,
|
|
2890
|
-
configurable: true
|
|
2891
|
-
});
|
|
2892
|
-
Config.prototype.toJson = function () {
|
|
2753
|
+
}
|
|
2754
|
+
get maximumNumberOfCharacters() {
|
|
2755
|
+
return this.config.maximumNumberOfCharacters;
|
|
2756
|
+
}
|
|
2757
|
+
get numberOfBlanks() {
|
|
2758
|
+
return this.config.numberOfBlanks;
|
|
2759
|
+
}
|
|
2760
|
+
get tiles() {
|
|
2761
|
+
return this.config.tiles;
|
|
2762
|
+
}
|
|
2763
|
+
toJson() {
|
|
2893
2764
|
return this.config;
|
|
2894
|
-
}
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
return config.bonuses.map(function (bonus) {
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
const getBonuses = (config) => {
|
|
2768
|
+
return config.bonuses.map((bonus) => {
|
|
2899
2769
|
if (bonus.type === constants_1.BONUS_CHARACTER) {
|
|
2900
2770
|
return new CharacterBonus_1.default(bonus);
|
|
2901
2771
|
}
|
|
2902
2772
|
if (bonus.type === constants_1.BONUS_WORD) {
|
|
2903
2773
|
return new WordBonus_1.default(bonus);
|
|
2904
2774
|
}
|
|
2905
|
-
throw new Error(
|
|
2775
|
+
throw new Error(`Unsupported Bonus type: "${bonus.type}"`);
|
|
2906
2776
|
});
|
|
2907
2777
|
};
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
return config.tiles.reduce(function (pointsMap, _a) {
|
|
2914
|
-
var _b;
|
|
2915
|
-
var character = _a.character, score = _a.score;
|
|
2916
|
-
return (__assign(__assign({}, pointsMap), (_b = {}, _b[character] = score, _b)));
|
|
2917
|
-
}, {});
|
|
2918
|
-
};
|
|
2778
|
+
const getAlphabet = (config) => config.tiles.map(({ character }) => character);
|
|
2779
|
+
const getPointsMap = (config) => config.tiles.reduce((pointsMap, { character, score }) => ({
|
|
2780
|
+
...pointsMap,
|
|
2781
|
+
[character]: score,
|
|
2782
|
+
}), {});
|
|
2919
2783
|
exports["default"] = Config;
|
|
2920
2784
|
|
|
2921
2785
|
|
|
@@ -2925,89 +2789,43 @@ exports["default"] = Config;
|
|
|
2925
2789
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2926
2790
|
|
|
2927
2791
|
|
|
2928
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2929
|
-
var extendStatics = function (d, b) {
|
|
2930
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2931
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2932
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2933
|
-
return extendStatics(d, b);
|
|
2934
|
-
};
|
|
2935
|
-
return function (d, b) {
|
|
2936
|
-
if (typeof b !== "function" && b !== null)
|
|
2937
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2938
|
-
extendStatics(d, b);
|
|
2939
|
-
function __() { this.constructor = d; }
|
|
2940
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2941
|
-
};
|
|
2942
|
-
})();
|
|
2943
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2944
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
2945
|
-
if (!m) return o;
|
|
2946
|
-
var i = m.call(o), r, ar = [], e;
|
|
2947
|
-
try {
|
|
2948
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
2949
|
-
}
|
|
2950
|
-
catch (error) { e = { error: error }; }
|
|
2951
|
-
finally {
|
|
2952
|
-
try {
|
|
2953
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
2954
|
-
}
|
|
2955
|
-
finally { if (e) throw e.error; }
|
|
2956
|
-
}
|
|
2957
|
-
return ar;
|
|
2958
|
-
};
|
|
2959
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2960
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2961
|
-
if (ar || !(i in from)) {
|
|
2962
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2963
|
-
ar[i] = from[i];
|
|
2964
|
-
}
|
|
2965
|
-
}
|
|
2966
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2967
|
-
};
|
|
2968
2792
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2969
2793
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2970
2794
|
};
|
|
2971
2795
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
function HorizontalPattern() {
|
|
2976
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2977
|
-
}
|
|
2978
|
-
HorizontalPattern.prototype.clone = function () {
|
|
2796
|
+
const Pattern_1 = __importDefault(__webpack_require__(63207));
|
|
2797
|
+
class HorizontalPattern extends Pattern_1.default {
|
|
2798
|
+
clone() {
|
|
2979
2799
|
return new HorizontalPattern({
|
|
2980
2800
|
board: this.board,
|
|
2981
|
-
cells: this.cells.map(
|
|
2801
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
2982
2802
|
});
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
var collisions = [];
|
|
2803
|
+
}
|
|
2804
|
+
getCollisions() {
|
|
2805
|
+
const collisions = [];
|
|
2987
2806
|
this.cells
|
|
2988
|
-
.filter(
|
|
2989
|
-
.forEach(
|
|
2990
|
-
|
|
2991
|
-
|
|
2807
|
+
.filter((cell) => cell.isEmpty && (this.board.collidesUp(cell) || this.board.collidesDown(cell)))
|
|
2808
|
+
.forEach((cell) => {
|
|
2809
|
+
const column = this.board.getColumn(cell.x);
|
|
2810
|
+
let y = cell.y - 1;
|
|
2992
2811
|
while (y >= 0 && column[y].hasTile()) {
|
|
2993
2812
|
--y;
|
|
2994
2813
|
}
|
|
2995
|
-
|
|
2814
|
+
const previousCells = column.slice(y + 1, cell.y);
|
|
2996
2815
|
y = cell.y + 1;
|
|
2997
2816
|
while (y < column.length && column[y].hasTile()) {
|
|
2998
2817
|
++y;
|
|
2999
2818
|
}
|
|
3000
|
-
|
|
3001
|
-
|
|
2819
|
+
const nextCells = column.slice(cell.y + 1, y);
|
|
2820
|
+
const cells = [...previousCells, cell, ...nextCells];
|
|
3002
2821
|
if (cells.length > 1) {
|
|
3003
|
-
|
|
2822
|
+
const pattern = new Pattern_1.default({ board: this.board, cells });
|
|
3004
2823
|
collisions.push(pattern);
|
|
3005
2824
|
}
|
|
3006
2825
|
});
|
|
3007
2826
|
return collisions;
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
}(Pattern_1.default));
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
3011
2829
|
exports["default"] = HorizontalPattern;
|
|
3012
2830
|
|
|
3013
2831
|
|
|
@@ -3038,59 +2856,55 @@ exports["default"] = Locale;
|
|
|
3038
2856
|
|
|
3039
2857
|
|
|
3040
2858
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
var board = _a.board, cells = _a.cells;
|
|
2859
|
+
class Pattern {
|
|
2860
|
+
constructor({ board, cells }) {
|
|
3044
2861
|
this.board = board;
|
|
3045
2862
|
this.cells = cells;
|
|
3046
2863
|
}
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
2864
|
+
canBePlaced(config) {
|
|
2865
|
+
const numberOfEmptyCells = this.getNumberOfEmptyCells();
|
|
2866
|
+
const isNumberOfUsedCellsInRange = numberOfEmptyCells >= 1 && numberOfEmptyCells <= config.maximumNumberOfCharacters;
|
|
3050
2867
|
return (isNumberOfUsedCellsInRange &&
|
|
3051
2868
|
(this.hasAtLeast1NonEmptyCell() || this.collides() || (this.goesThroughBoardCenter() && this.board.isEmpty())));
|
|
3052
|
-
}
|
|
3053
|
-
|
|
2869
|
+
}
|
|
2870
|
+
clone() {
|
|
3054
2871
|
return new Pattern({
|
|
3055
2872
|
board: this.board,
|
|
3056
|
-
cells: this.cells.map(
|
|
2873
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
3057
2874
|
});
|
|
3058
|
-
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
};
|
|
3079
|
-
Pattern.prototype.getCollisions = function () {
|
|
2875
|
+
}
|
|
2876
|
+
collides() {
|
|
2877
|
+
return this.cells.some((cell) => cell.isEmpty && this.board.collides(cell));
|
|
2878
|
+
}
|
|
2879
|
+
getIndexOfFirstCellWithoutTile() {
|
|
2880
|
+
return this.cells.findIndex((cell) => !cell.hasTile());
|
|
2881
|
+
}
|
|
2882
|
+
getNumberOfEmptyCells() {
|
|
2883
|
+
return this.cells.filter((cell) => cell.isEmpty).length;
|
|
2884
|
+
}
|
|
2885
|
+
goesThroughBoardCenter() {
|
|
2886
|
+
return this.cells.some((cell) => cell.x === this.board.center.x && cell.y === this.board.center.y && cell.isEmpty);
|
|
2887
|
+
}
|
|
2888
|
+
hasAtLeast1EmptyCell() {
|
|
2889
|
+
return this.cells.some((cell) => cell.isEmpty);
|
|
2890
|
+
}
|
|
2891
|
+
hasAtLeast1NonEmptyCell() {
|
|
2892
|
+
return this.cells.some((cell) => !cell.isEmpty);
|
|
2893
|
+
}
|
|
2894
|
+
getCollisions() {
|
|
3080
2895
|
return [];
|
|
3081
|
-
}
|
|
3082
|
-
|
|
2896
|
+
}
|
|
2897
|
+
toJson() {
|
|
3083
2898
|
return {
|
|
3084
|
-
cells: this.cells.map(
|
|
3085
|
-
collisions: this.getCollisions().map(
|
|
2899
|
+
cells: this.cells.map((cell) => cell.toJson()),
|
|
2900
|
+
collisions: this.getCollisions().map((collision) => collision.toJson()),
|
|
3086
2901
|
word: this.toString(),
|
|
3087
2902
|
};
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
return this.cells.
|
|
3091
|
-
}
|
|
3092
|
-
|
|
3093
|
-
}());
|
|
2903
|
+
}
|
|
2904
|
+
toString() {
|
|
2905
|
+
return this.cells.reduce((result, cell) => result + cell.toString(), '');
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
3094
2908
|
exports["default"] = Pattern;
|
|
3095
2909
|
|
|
3096
2910
|
|
|
@@ -3104,12 +2918,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3104
2918
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3105
2919
|
};
|
|
3106
2920
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
var tiles = getTiles(cells);
|
|
2921
|
+
const constants_1 = __webpack_require__(7618);
|
|
2922
|
+
const Cell_1 = __importDefault(__webpack_require__(52251));
|
|
2923
|
+
class Result {
|
|
2924
|
+
constructor({ cells, id, numberOfCollisions, points, }) {
|
|
2925
|
+
const tiles = getTiles(cells);
|
|
3113
2926
|
this.cells = cells;
|
|
3114
2927
|
this.id = id;
|
|
3115
2928
|
this.length = cells.length;
|
|
@@ -3125,57 +2938,35 @@ var Result = /** @class */ (function () {
|
|
|
3125
2938
|
this.tilesCharacters = getTilesCharacters(tiles);
|
|
3126
2939
|
this.word = getWord(cells);
|
|
3127
2940
|
}
|
|
3128
|
-
|
|
2941
|
+
static fromJson(json) {
|
|
3129
2942
|
return new Result({
|
|
3130
2943
|
cells: json.cells.map(Cell_1.default.fromJson),
|
|
3131
2944
|
id: json.id,
|
|
3132
2945
|
numberOfCollisions: json.numberOfCollisions,
|
|
3133
2946
|
points: json.points,
|
|
3134
2947
|
});
|
|
3135
|
-
}
|
|
3136
|
-
|
|
2948
|
+
}
|
|
2949
|
+
toJson() {
|
|
3137
2950
|
return {
|
|
3138
|
-
cells: this.cells.map(
|
|
2951
|
+
cells: this.cells.map((cell) => cell.toJson()),
|
|
3139
2952
|
id: this.id,
|
|
3140
2953
|
numberOfCollisions: this.numberOfCollisions,
|
|
3141
2954
|
points: this.points,
|
|
3142
2955
|
};
|
|
3143
|
-
}
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
})
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
})
|
|
3157
|
-
var getNonBlanks = function (tiles) { return tiles.filter(function (_a) {
|
|
3158
|
-
var isBlank = _a.isBlank;
|
|
3159
|
-
return !isBlank;
|
|
3160
|
-
}); };
|
|
3161
|
-
var getPointsRatio = function (tiles, points) { return points / tiles.length; };
|
|
3162
|
-
var getTiles = function (cells) { return cells.filter(function (_a) {
|
|
3163
|
-
var isEmpty = _a.isEmpty;
|
|
3164
|
-
return isEmpty;
|
|
3165
|
-
}).map(function (_a) {
|
|
3166
|
-
var tile = _a.tile;
|
|
3167
|
-
return tile;
|
|
3168
|
-
}); };
|
|
3169
|
-
var getTilesCharacters = function (tiles) { return getNonBlankCharacters(tiles).sort(charactersComparator).join(''); };
|
|
3170
|
-
var getWord = function (cells) { return cells.map(String).join(''); };
|
|
3171
|
-
var isConsonant = function (_a) {
|
|
3172
|
-
var character = _a.character, isBlank = _a.isBlank;
|
|
3173
|
-
return constants_1.CONSONANTS.includes(character) && !isBlank;
|
|
3174
|
-
};
|
|
3175
|
-
var isVowel = function (_a) {
|
|
3176
|
-
var character = _a.character, isBlank = _a.isBlank;
|
|
3177
|
-
return constants_1.VOWELS.includes(character) && !isBlank;
|
|
3178
|
-
};
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
const charactersComparator = (a, b) => a.localeCompare(b);
|
|
2959
|
+
const getBlanks = (tiles) => tiles.filter(({ isBlank }) => isBlank);
|
|
2960
|
+
const getConsonants = (tiles) => tiles.filter(isConsonant);
|
|
2961
|
+
const getVowels = (tiles) => tiles.filter(isVowel);
|
|
2962
|
+
const getNonBlankCharacters = (tiles) => getNonBlanks(tiles).map(({ character }) => character);
|
|
2963
|
+
const getNonBlanks = (tiles) => tiles.filter(({ isBlank }) => !isBlank);
|
|
2964
|
+
const getPointsRatio = (tiles, points) => points / tiles.length;
|
|
2965
|
+
const getTiles = (cells) => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
|
|
2966
|
+
const getTilesCharacters = (tiles) => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
|
|
2967
|
+
const getWord = (cells) => cells.map(String).join('');
|
|
2968
|
+
const isConsonant = ({ character, isBlank }) => constants_1.CONSONANTS.includes(character) && !isBlank;
|
|
2969
|
+
const isVowel = ({ character, isBlank }) => constants_1.VOWELS.includes(character) && !isBlank;
|
|
3179
2970
|
exports["default"] = Result;
|
|
3180
2971
|
|
|
3181
2972
|
|
|
@@ -3186,14 +2977,13 @@ exports["default"] = Result;
|
|
|
3186
2977
|
|
|
3187
2978
|
|
|
3188
2979
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
var character = _a.character, _b = _a.isBlank, isBlank = _b === void 0 ? false : _b;
|
|
2980
|
+
const constants_1 = __webpack_require__(7618);
|
|
2981
|
+
class Tile {
|
|
2982
|
+
constructor({ character, isBlank = false }) {
|
|
3193
2983
|
this.character = character;
|
|
3194
2984
|
this.isBlank = isBlank;
|
|
3195
2985
|
}
|
|
3196
|
-
|
|
2986
|
+
static fromJson(json) {
|
|
3197
2987
|
if (!json) {
|
|
3198
2988
|
return Tile.Null;
|
|
3199
2989
|
}
|
|
@@ -3201,35 +2991,34 @@ var Tile = /** @class */ (function () {
|
|
|
3201
2991
|
character: json.character,
|
|
3202
2992
|
isBlank: json.isBlank,
|
|
3203
2993
|
});
|
|
3204
|
-
}
|
|
3205
|
-
|
|
2994
|
+
}
|
|
2995
|
+
clone() {
|
|
3206
2996
|
return new Tile({
|
|
3207
2997
|
character: this.character,
|
|
3208
2998
|
isBlank: this.isBlank,
|
|
3209
2999
|
});
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3000
|
+
}
|
|
3001
|
+
equals(other) {
|
|
3212
3002
|
return this.character === other.character && this.isBlank === other.isBlank;
|
|
3213
|
-
}
|
|
3214
|
-
|
|
3003
|
+
}
|
|
3004
|
+
toJson() {
|
|
3215
3005
|
return {
|
|
3216
3006
|
character: this.character,
|
|
3217
3007
|
isBlank: this.isBlank,
|
|
3218
3008
|
};
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3009
|
+
}
|
|
3010
|
+
toString() {
|
|
3221
3011
|
return this.character;
|
|
3222
|
-
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
}());
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
Tile.Null = Object.freeze({
|
|
3015
|
+
character: constants_1.EMPTY_CELL,
|
|
3016
|
+
isBlank: false,
|
|
3017
|
+
clone: () => Tile.Null,
|
|
3018
|
+
equals: (other) => other === Tile.Null,
|
|
3019
|
+
toJson: () => null,
|
|
3020
|
+
toString: () => constants_1.EMPTY_CELL,
|
|
3021
|
+
});
|
|
3233
3022
|
exports["default"] = Tile;
|
|
3234
3023
|
|
|
3235
3024
|
|
|
@@ -3239,89 +3028,43 @@ exports["default"] = Tile;
|
|
|
3239
3028
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3240
3029
|
|
|
3241
3030
|
|
|
3242
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3243
|
-
var extendStatics = function (d, b) {
|
|
3244
|
-
extendStatics = Object.setPrototypeOf ||
|
|
3245
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3246
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3247
|
-
return extendStatics(d, b);
|
|
3248
|
-
};
|
|
3249
|
-
return function (d, b) {
|
|
3250
|
-
if (typeof b !== "function" && b !== null)
|
|
3251
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3252
|
-
extendStatics(d, b);
|
|
3253
|
-
function __() { this.constructor = d; }
|
|
3254
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3255
|
-
};
|
|
3256
|
-
})();
|
|
3257
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3258
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3259
|
-
if (!m) return o;
|
|
3260
|
-
var i = m.call(o), r, ar = [], e;
|
|
3261
|
-
try {
|
|
3262
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
3263
|
-
}
|
|
3264
|
-
catch (error) { e = { error: error }; }
|
|
3265
|
-
finally {
|
|
3266
|
-
try {
|
|
3267
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
3268
|
-
}
|
|
3269
|
-
finally { if (e) throw e.error; }
|
|
3270
|
-
}
|
|
3271
|
-
return ar;
|
|
3272
|
-
};
|
|
3273
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3274
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3275
|
-
if (ar || !(i in from)) {
|
|
3276
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3277
|
-
ar[i] = from[i];
|
|
3278
|
-
}
|
|
3279
|
-
}
|
|
3280
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3281
|
-
};
|
|
3282
3031
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3283
3032
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3284
3033
|
};
|
|
3285
3034
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
function VerticalPattern() {
|
|
3290
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3291
|
-
}
|
|
3292
|
-
VerticalPattern.prototype.clone = function () {
|
|
3035
|
+
const Pattern_1 = __importDefault(__webpack_require__(63207));
|
|
3036
|
+
class VerticalPattern extends Pattern_1.default {
|
|
3037
|
+
clone() {
|
|
3293
3038
|
return new VerticalPattern({
|
|
3294
3039
|
board: this.board,
|
|
3295
|
-
cells: this.cells.map(
|
|
3040
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
3296
3041
|
});
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
var collisions = [];
|
|
3042
|
+
}
|
|
3043
|
+
getCollisions() {
|
|
3044
|
+
const collisions = [];
|
|
3301
3045
|
this.cells
|
|
3302
|
-
.filter(
|
|
3303
|
-
.forEach(
|
|
3304
|
-
|
|
3305
|
-
|
|
3046
|
+
.filter((cell) => cell.isEmpty && (this.board.collidesLeft(cell) || this.board.collidesRight(cell)))
|
|
3047
|
+
.forEach((cell) => {
|
|
3048
|
+
const row = this.board.getRow(cell.y);
|
|
3049
|
+
let x = cell.x - 1;
|
|
3306
3050
|
while (x >= 0 && row[x].hasTile()) {
|
|
3307
3051
|
--x;
|
|
3308
3052
|
}
|
|
3309
|
-
|
|
3053
|
+
const previousCells = row.slice(x + 1, cell.x);
|
|
3310
3054
|
x = cell.x + 1;
|
|
3311
3055
|
while (x < row.length && row[x].hasTile()) {
|
|
3312
3056
|
++x;
|
|
3313
3057
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
3058
|
+
const nextCells = row.slice(cell.x + 1, x);
|
|
3059
|
+
const cells = [...previousCells, cell, ...nextCells];
|
|
3316
3060
|
if (cells.length > 1) {
|
|
3317
|
-
|
|
3061
|
+
const pattern = new Pattern_1.default({ board: this.board, cells });
|
|
3318
3062
|
collisions.push(pattern);
|
|
3319
3063
|
}
|
|
3320
3064
|
});
|
|
3321
3065
|
return collisions;
|
|
3322
|
-
}
|
|
3323
|
-
|
|
3324
|
-
}(Pattern_1.default));
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3325
3068
|
exports["default"] = VerticalPattern;
|
|
3326
3069
|
|
|
3327
3070
|
|
|
@@ -3331,46 +3074,24 @@ exports["default"] = VerticalPattern;
|
|
|
3331
3074
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3332
3075
|
|
|
3333
3076
|
|
|
3334
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3335
|
-
var extendStatics = function (d, b) {
|
|
3336
|
-
extendStatics = Object.setPrototypeOf ||
|
|
3337
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3338
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3339
|
-
return extendStatics(d, b);
|
|
3340
|
-
};
|
|
3341
|
-
return function (d, b) {
|
|
3342
|
-
if (typeof b !== "function" && b !== null)
|
|
3343
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3344
|
-
extendStatics(d, b);
|
|
3345
|
-
function __() { this.constructor = d; }
|
|
3346
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3347
|
-
};
|
|
3348
|
-
})();
|
|
3349
3077
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3350
3078
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3351
3079
|
};
|
|
3352
3080
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
};
|
|
3368
|
-
},
|
|
3369
|
-
enumerable: false,
|
|
3370
|
-
configurable: true
|
|
3371
|
-
});
|
|
3372
|
-
return WordBonus;
|
|
3373
|
-
}(Bonus_1.default));
|
|
3081
|
+
const constants_1 = __webpack_require__(7618);
|
|
3082
|
+
const Bonus_1 = __importDefault(__webpack_require__(37706));
|
|
3083
|
+
class WordBonus extends Bonus_1.default {
|
|
3084
|
+
constructor() {
|
|
3085
|
+
super(...arguments);
|
|
3086
|
+
this.type = constants_1.BONUS_WORD;
|
|
3087
|
+
}
|
|
3088
|
+
get value() {
|
|
3089
|
+
return {
|
|
3090
|
+
characterMultiplier: 1,
|
|
3091
|
+
wordMultiplier: this.multiplier,
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3374
3095
|
exports["default"] = WordBonus;
|
|
3375
3096
|
|
|
3376
3097
|
|
|
@@ -3381,14 +3102,13 @@ exports["default"] = WordBonus;
|
|
|
3381
3102
|
|
|
3382
3103
|
|
|
3383
3104
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
var definitions = _a.definitions, isAllowed = _a.isAllowed, word = _a.word;
|
|
3105
|
+
class WordDefinition {
|
|
3106
|
+
constructor({ definitions, isAllowed, word }) {
|
|
3387
3107
|
this.definitions = definitions;
|
|
3388
3108
|
this.isAllowed = isAllowed;
|
|
3389
3109
|
this.word = word;
|
|
3390
3110
|
}
|
|
3391
|
-
|
|
3111
|
+
static fromJson(json) {
|
|
3392
3112
|
if (!json) {
|
|
3393
3113
|
return WordDefinition.Null;
|
|
3394
3114
|
}
|
|
@@ -3397,22 +3117,21 @@ var WordDefinition = /** @class */ (function () {
|
|
|
3397
3117
|
isAllowed: json.isAllowed,
|
|
3398
3118
|
word: json.word,
|
|
3399
3119
|
});
|
|
3400
|
-
}
|
|
3401
|
-
|
|
3120
|
+
}
|
|
3121
|
+
toJson() {
|
|
3402
3122
|
return {
|
|
3403
3123
|
definitions: this.definitions,
|
|
3404
3124
|
isAllowed: this.isAllowed,
|
|
3405
3125
|
word: this.word,
|
|
3406
3126
|
};
|
|
3407
|
-
}
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
}());
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
WordDefinition.Null = Object.freeze({
|
|
3130
|
+
definitions: [],
|
|
3131
|
+
isAllowed: false,
|
|
3132
|
+
word: '',
|
|
3133
|
+
toJson: () => null,
|
|
3134
|
+
});
|
|
3416
3135
|
exports["default"] = WordDefinition;
|
|
3417
3136
|
|
|
3418
3137
|
|