@scrabble-solver/scrabble-solver 2.8.2 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +5 -5
- 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/413.js +391 -673
- package/.next/server/chunks/515.js +414 -500
- package/.next/server/chunks/907.js +397 -679
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -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 +428 -1164
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js +2 -2
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/static/OhUvTNKwyrrzmNwKBnpUU/_buildManifest.js +1 -0
- package/.next/static/{nXSSCVI5pGlS_NxEidxkS → OhUvTNKwyrrzmNwKBnpUU}/_ssgManifest.js +0 -0
- package/.next/static/chunks/{195-fcadef5c6eed8338.js → 195-4b75c9c697b7b455.js} +1 -1
- package/.next/static/chunks/pages/_app-72522bfb306a8aef.js +1 -0
- package/.next/trace +42 -42
- package/package.json +9 -9
- 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/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 +1 -1
- package/src/components/KeyMap/components/Mapping/Mapping.tsx +1 -1
- 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 +1 -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/Tile/Tile.tsx +1 -1
- package/src/components/Tile/TilePure.tsx +1 -1
- package/src/components/Tooltip/useTooltip.tsx +1 -1
- package/src/components/Well/Well.tsx +1 -1
- package/src/hooks/usePortal.tsx +19 -9
- 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 +1 -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__(15465));
|
|
15
|
+
const scrabble_1 = __importDefault(__webpack_require__(40136));
|
|
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__(64873));
|
|
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__(15465));
|
|
78
|
+
const scrabble_1 = __importDefault(__webpack_require__(40136));
|
|
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__(38436);
|
|
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__(46452);
|
|
218
|
+
const bonuses_1 = __importDefault(__webpack_require__(8269));
|
|
219
|
+
const tiles_1 = __webpack_require__(48060);
|
|
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__(38436);
|
|
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__(46452);
|
|
568
|
+
const bonuses_1 = __importDefault(__webpack_require__(16841));
|
|
569
|
+
const tiles_1 = __webpack_require__(75797);
|
|
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 },
|
|
@@ -905,8 +870,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
905
870
|
};
|
|
906
871
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
907
872
|
exports.OUTPUT_DIRECTORY = void 0;
|
|
908
|
-
|
|
909
|
-
|
|
873
|
+
const os_1 = __importDefault(__webpack_require__(22037));
|
|
874
|
+
const path_1 = __importDefault(__webpack_require__(71017));
|
|
910
875
|
exports.OUTPUT_DIRECTORY = path_1.default.resolve(os_1.default.homedir(), '.scrabble-solver', 'logs');
|
|
911
876
|
|
|
912
877
|
|
|
@@ -935,10 +900,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
935
900
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
936
901
|
};
|
|
937
902
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
903
|
+
const path_1 = __importDefault(__webpack_require__(71017));
|
|
904
|
+
const winston_1 = __webpack_require__(46050);
|
|
905
|
+
const constants_1 = __webpack_require__(98793);
|
|
906
|
+
const logger = (0, winston_1.createLogger)({
|
|
942
907
|
level: 'info',
|
|
943
908
|
format: winston_1.format.combine(winston_1.format.timestamp({
|
|
944
909
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
@@ -1178,115 +1143,98 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1178
1143
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1179
1144
|
};
|
|
1180
1145
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
var rows = _a.rows;
|
|
1146
|
+
const constants_1 = __webpack_require__(38436);
|
|
1147
|
+
const Cell_1 = __importDefault(__webpack_require__(70902));
|
|
1148
|
+
const Tile_1 = __importDefault(__webpack_require__(580));
|
|
1149
|
+
class Board {
|
|
1150
|
+
constructor({ rows }) {
|
|
1187
1151
|
this.rows = rows;
|
|
1188
1152
|
this.numberOfColumns = rows[0].length;
|
|
1189
1153
|
this.numberOfRows = rows.length;
|
|
1190
1154
|
}
|
|
1191
|
-
|
|
1155
|
+
static create(width, height) {
|
|
1192
1156
|
return Board.fromStringArray(Array(height).fill(Array(width).fill(' ').join('')));
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1157
|
+
}
|
|
1158
|
+
static fromJson(json) {
|
|
1195
1159
|
return new Board({
|
|
1196
|
-
rows: json.map(
|
|
1160
|
+
rows: json.map((row) => row.map(Cell_1.default.fromJson)),
|
|
1197
1161
|
});
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1162
|
+
}
|
|
1163
|
+
static fromStringArray(stringArray) {
|
|
1200
1164
|
return new Board({
|
|
1201
|
-
rows: stringArray.map(
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
y: y,
|
|
1208
|
-
});
|
|
1209
|
-
});
|
|
1210
|
-
}),
|
|
1165
|
+
rows: stringArray.map((row, y) => row.split('').map((character, x) => new Cell_1.default({
|
|
1166
|
+
isEmpty: !character || character === constants_1.EMPTY_CELL,
|
|
1167
|
+
tile: character === constants_1.EMPTY_CELL ? Tile_1.default.Null : new Tile_1.default({ character }),
|
|
1168
|
+
x,
|
|
1169
|
+
y,
|
|
1170
|
+
}))),
|
|
1211
1171
|
});
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
var rows = this.rows.map(function (row) { return row.map(function (cell) { return cell.clone(); }); });
|
|
1224
|
-
return new Board({ rows: rows });
|
|
1225
|
-
};
|
|
1226
|
-
Board.prototype.collides = function (cell) {
|
|
1172
|
+
}
|
|
1173
|
+
get center() {
|
|
1174
|
+
const x = Math.floor(this.numberOfColumns / 2);
|
|
1175
|
+
const y = Math.floor(this.numberOfRows / 2);
|
|
1176
|
+
return this.rows[y][x];
|
|
1177
|
+
}
|
|
1178
|
+
clone() {
|
|
1179
|
+
const rows = this.rows.map((row) => row.map((cell) => cell.clone()));
|
|
1180
|
+
return new Board({ rows });
|
|
1181
|
+
}
|
|
1182
|
+
collides(cell) {
|
|
1227
1183
|
return this.collidesUp(cell) || this.collidesDown(cell) || this.collidesLeft(cell) || this.collidesRight(cell);
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
var x = _a.x, y = _a.y;
|
|
1184
|
+
}
|
|
1185
|
+
collidesDown({ x, y }) {
|
|
1231
1186
|
return y < this.numberOfRows - 1 && !this.rows[y + 1][x].isEmpty;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
var x = _a.x, y = _a.y;
|
|
1187
|
+
}
|
|
1188
|
+
collidesLeft({ x, y }) {
|
|
1235
1189
|
return x > 0 && !this.rows[y][x - 1].isEmpty;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
var x = _a.x, y = _a.y;
|
|
1190
|
+
}
|
|
1191
|
+
collidesRight({ x, y }) {
|
|
1239
1192
|
return x < this.numberOfColumns - 1 && !this.rows[y][x + 1].isEmpty;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
var x = _a.x, y = _a.y;
|
|
1193
|
+
}
|
|
1194
|
+
collidesUp({ x, y }) {
|
|
1243
1195
|
return y > 0 && !this.rows[y - 1][x].isEmpty;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1196
|
+
}
|
|
1197
|
+
equals(other) {
|
|
1246
1198
|
return (this.numberOfColumns === other.numberOfColumns &&
|
|
1247
1199
|
this.numberOfRows === other.numberOfRows &&
|
|
1248
|
-
this.rows.every(
|
|
1249
|
-
return row.every(
|
|
1200
|
+
this.rows.every((row, rowIndex) => {
|
|
1201
|
+
return row.every((cell, cellIndex) => {
|
|
1250
1202
|
return cell.equals(other.rows[rowIndex][cellIndex]);
|
|
1251
1203
|
});
|
|
1252
1204
|
}));
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
return this.rows.reduce(
|
|
1256
|
-
return count + row.reduce(
|
|
1205
|
+
}
|
|
1206
|
+
getBlanksCount() {
|
|
1207
|
+
return this.rows.reduce((count, row) => {
|
|
1208
|
+
return count + row.reduce((rowCount, cell) => (cell.tile.isBlank ? rowCount + 1 : rowCount), 0);
|
|
1257
1209
|
}, 0);
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
return this.rows.map(
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1210
|
+
}
|
|
1211
|
+
getColumn(index) {
|
|
1212
|
+
return this.rows.map((row) => row[index]);
|
|
1213
|
+
}
|
|
1214
|
+
getRow(index) {
|
|
1263
1215
|
return this.rows[index];
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
return this.rows.reduce(
|
|
1267
|
-
return count + row.reduce(
|
|
1216
|
+
}
|
|
1217
|
+
getTilesCount() {
|
|
1218
|
+
return this.rows.reduce((count, row) => {
|
|
1219
|
+
return count + row.reduce((rowCount, cell) => (cell.hasTile() ? rowCount + 1 : rowCount), 0);
|
|
1268
1220
|
}, 0);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
return this.rows.every(
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
return this.rows.map(
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
return this.rows.map(function (row) { return row.map(String); }).join('\n');
|
|
1281
|
-
};
|
|
1282
|
-
Board.prototype.updateCell = function (x, y, updateCell) {
|
|
1221
|
+
}
|
|
1222
|
+
isEmpty() {
|
|
1223
|
+
return this.rows.every((row) => row.every(({ isEmpty }) => isEmpty));
|
|
1224
|
+
}
|
|
1225
|
+
toJson() {
|
|
1226
|
+
return this.rows.map((row) => row.map((cell) => cell.toJson()));
|
|
1227
|
+
}
|
|
1228
|
+
toString() {
|
|
1229
|
+
return this.rows.map((row) => row.map(String)).join('\n');
|
|
1230
|
+
}
|
|
1231
|
+
updateCell(x, y, updateCell) {
|
|
1283
1232
|
this.rows[y][x] = updateCell(this.rows[y][x]);
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1233
|
+
}
|
|
1234
|
+
updateRow(y, updateRow) {
|
|
1286
1235
|
this.rows[y] = updateRow(this.rows[y]);
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
}());
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1290
1238
|
exports["default"] = Board;
|
|
1291
1239
|
|
|
1292
1240
|
|
|
@@ -1297,21 +1245,20 @@ exports["default"] = Board;
|
|
|
1297
1245
|
|
|
1298
1246
|
|
|
1299
1247
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
var multiplier = _a.multiplier, score = _a.score, x = _a.x, y = _a.y;
|
|
1248
|
+
class Bonus {
|
|
1249
|
+
constructor({ multiplier, score, x, y }) {
|
|
1303
1250
|
this.multiplier = multiplier;
|
|
1304
1251
|
this.score = score;
|
|
1305
1252
|
this.x = x;
|
|
1306
1253
|
this.y = y;
|
|
1307
1254
|
}
|
|
1308
|
-
|
|
1255
|
+
canApply(_config, cell) {
|
|
1309
1256
|
return cell.isEmpty && this.matchesCellCoordinates(cell);
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1257
|
+
}
|
|
1258
|
+
matchesCellCoordinates(cell) {
|
|
1312
1259
|
return this.x === cell.x && this.y === cell.y;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1260
|
+
}
|
|
1261
|
+
toJson() {
|
|
1315
1262
|
return {
|
|
1316
1263
|
multiplier: this.multiplier,
|
|
1317
1264
|
score: this.score,
|
|
@@ -1319,19 +1266,14 @@ var Bonus = /** @class */ (function () {
|
|
|
1319
1266
|
x: this.x,
|
|
1320
1267
|
y: this.y,
|
|
1321
1268
|
};
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
enumerable: false,
|
|
1331
|
-
configurable: true
|
|
1332
|
-
});
|
|
1333
|
-
return Bonus;
|
|
1334
|
-
}());
|
|
1269
|
+
}
|
|
1270
|
+
get value() {
|
|
1271
|
+
return {
|
|
1272
|
+
characterMultiplier: 1,
|
|
1273
|
+
wordMultiplier: 1,
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1335
1277
|
exports["default"] = Bonus;
|
|
1336
1278
|
|
|
1337
1279
|
|
|
@@ -1345,17 +1287,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1345
1287
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1346
1288
|
};
|
|
1347
1289
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1348
|
-
|
|
1349
|
-
|
|
1290
|
+
const Tile_1 = __importDefault(__webpack_require__(580));
|
|
1291
|
+
class Cell {
|
|
1350
1292
|
// eslint-disable-next-line no-undef
|
|
1351
|
-
|
|
1352
|
-
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;
|
|
1293
|
+
constructor({ isEmpty = true, tile = Tile_1.default.Null, x, y }) {
|
|
1353
1294
|
this.isEmpty = isEmpty;
|
|
1354
1295
|
this.tile = tile;
|
|
1355
1296
|
this.x = x;
|
|
1356
1297
|
this.y = y;
|
|
1357
1298
|
}
|
|
1358
|
-
|
|
1299
|
+
static fromJson(json) {
|
|
1359
1300
|
if (!json) {
|
|
1360
1301
|
return Cell.Null;
|
|
1361
1302
|
}
|
|
@@ -1365,49 +1306,48 @@ var Cell = /** @class */ (function () {
|
|
|
1365
1306
|
x: json.x,
|
|
1366
1307
|
y: json.y,
|
|
1367
1308
|
});
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1309
|
+
}
|
|
1310
|
+
clone() {
|
|
1370
1311
|
return new Cell({
|
|
1371
1312
|
isEmpty: this.isEmpty,
|
|
1372
1313
|
tile: this.tile.clone(),
|
|
1373
1314
|
x: this.x,
|
|
1374
1315
|
y: this.y,
|
|
1375
1316
|
});
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1317
|
+
}
|
|
1318
|
+
equals(other) {
|
|
1378
1319
|
return this.x === other.x && this.y === other.y && this.isEmpty === other.isEmpty && this.tile.equals(other.tile);
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1320
|
+
}
|
|
1321
|
+
hasTile() {
|
|
1381
1322
|
return this.tile !== Tile_1.default.Null;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1323
|
+
}
|
|
1324
|
+
isCandidate() {
|
|
1384
1325
|
return this.isEmpty && this.hasTile();
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1326
|
+
}
|
|
1327
|
+
toJson() {
|
|
1387
1328
|
return {
|
|
1388
1329
|
isEmpty: this.isEmpty,
|
|
1389
1330
|
tile: this.tile.toJson(),
|
|
1390
1331
|
x: this.x,
|
|
1391
1332
|
y: this.y,
|
|
1392
1333
|
};
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1334
|
+
}
|
|
1335
|
+
toString() {
|
|
1395
1336
|
return String(this.tile);
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
}());
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
Cell.Null = Object.freeze({
|
|
1340
|
+
isEmpty: true,
|
|
1341
|
+
tile: Tile_1.default.Null,
|
|
1342
|
+
x: 0,
|
|
1343
|
+
y: 0,
|
|
1344
|
+
clone: () => Cell.Null,
|
|
1345
|
+
equals: (other) => other === Cell.Null,
|
|
1346
|
+
hasTile: () => false,
|
|
1347
|
+
isCandidate: () => false,
|
|
1348
|
+
toString: () => '',
|
|
1349
|
+
toJson: () => null,
|
|
1350
|
+
});
|
|
1411
1351
|
exports["default"] = Cell;
|
|
1412
1352
|
|
|
1413
1353
|
|
|
@@ -1417,55 +1357,33 @@ exports["default"] = Cell;
|
|
|
1417
1357
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1418
1358
|
|
|
1419
1359
|
|
|
1420
|
-
var __extends = (this && this.__extends) || (function () {
|
|
1421
|
-
var extendStatics = function (d, b) {
|
|
1422
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1423
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1424
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1425
|
-
return extendStatics(d, b);
|
|
1426
|
-
};
|
|
1427
|
-
return function (d, b) {
|
|
1428
|
-
if (typeof b !== "function" && b !== null)
|
|
1429
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1430
|
-
extendStatics(d, b);
|
|
1431
|
-
function __() { this.constructor = d; }
|
|
1432
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1433
|
-
};
|
|
1434
|
-
})();
|
|
1435
1360
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1436
1361
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1437
1362
|
};
|
|
1438
1363
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
};
|
|
1451
|
-
CharacterBonus.prototype.matchesCellTileScore = function (config, cell) {
|
|
1364
|
+
const constants_1 = __webpack_require__(38436);
|
|
1365
|
+
const Bonus_1 = __importDefault(__webpack_require__(80769));
|
|
1366
|
+
class CharacterBonus extends Bonus_1.default {
|
|
1367
|
+
constructor() {
|
|
1368
|
+
super(...arguments);
|
|
1369
|
+
this.type = constants_1.BONUS_CHARACTER;
|
|
1370
|
+
}
|
|
1371
|
+
canApply(config, cell) {
|
|
1372
|
+
return super.canApply(config, cell) && this.matchesCellTileScore(config, cell);
|
|
1373
|
+
}
|
|
1374
|
+
matchesCellTileScore(config, cell) {
|
|
1452
1375
|
if (typeof this.score === 'undefined') {
|
|
1453
1376
|
return true;
|
|
1454
1377
|
}
|
|
1455
1378
|
return this.score === config.pointsMap[cell.tile.character];
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
enumerable: false,
|
|
1465
|
-
configurable: true
|
|
1466
|
-
});
|
|
1467
|
-
return CharacterBonus;
|
|
1468
|
-
}(Bonus_1.default));
|
|
1379
|
+
}
|
|
1380
|
+
get value() {
|
|
1381
|
+
return {
|
|
1382
|
+
characterMultiplier: this.multiplier,
|
|
1383
|
+
wordMultiplier: 1,
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1469
1387
|
exports["default"] = CharacterBonus;
|
|
1470
1388
|
|
|
1471
1389
|
|
|
@@ -1475,83 +1393,47 @@ exports["default"] = CharacterBonus;
|
|
|
1475
1393
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1476
1394
|
|
|
1477
1395
|
|
|
1478
|
-
var __assign = (this && this.__assign) || function () {
|
|
1479
|
-
__assign = Object.assign || function(t) {
|
|
1480
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1481
|
-
s = arguments[i];
|
|
1482
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1483
|
-
t[p] = s[p];
|
|
1484
|
-
}
|
|
1485
|
-
return t;
|
|
1486
|
-
};
|
|
1487
|
-
return __assign.apply(this, arguments);
|
|
1488
|
-
};
|
|
1489
1396
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1490
1397
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1491
1398
|
};
|
|
1492
1399
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1400
|
+
const constants_1 = __webpack_require__(38436);
|
|
1401
|
+
const CharacterBonus_1 = __importDefault(__webpack_require__(95699));
|
|
1402
|
+
const WordBonus_1 = __importDefault(__webpack_require__(39667));
|
|
1403
|
+
class Config {
|
|
1404
|
+
constructor(config) {
|
|
1498
1405
|
this.bonuses = getBonuses(config);
|
|
1499
1406
|
this.config = config;
|
|
1500
1407
|
this.pointsMap = getPointsMap(this.config);
|
|
1501
1408
|
}
|
|
1502
|
-
|
|
1409
|
+
static fromJson(json) {
|
|
1503
1410
|
return new Config(json);
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
enumerable: false,
|
|
1531
|
-
configurable: true
|
|
1532
|
-
});
|
|
1533
|
-
Object.defineProperty(Config.prototype, "boardWidth", {
|
|
1534
|
-
get: function () {
|
|
1535
|
-
return this.config.boardWidth;
|
|
1536
|
-
},
|
|
1537
|
-
enumerable: false,
|
|
1538
|
-
configurable: true
|
|
1539
|
-
});
|
|
1540
|
-
Object.defineProperty(Config.prototype, "twoCharacterTiles", {
|
|
1541
|
-
get: function () {
|
|
1542
|
-
return this.config.tiles.filter(function (tile) { return tile.character.length === 2; }).map(function (tile) { return tile.character; });
|
|
1543
|
-
},
|
|
1544
|
-
enumerable: false,
|
|
1545
|
-
configurable: true
|
|
1546
|
-
});
|
|
1547
|
-
Config.prototype.getCellBonus = function (cell) {
|
|
1548
|
-
return this.bonuses.find(function (bonus) { return bonus.matchesCellCoordinates(cell); });
|
|
1549
|
-
};
|
|
1550
|
-
Config.prototype.getCellBonusValue = function (cell) {
|
|
1551
|
-
var _a;
|
|
1552
|
-
return ((_a = this.getCellBonus(cell)) === null || _a === void 0 ? void 0 : _a.value) || constants_1.NO_BONUS;
|
|
1553
|
-
};
|
|
1554
|
-
Config.prototype.getCharacterPoints = function (character) {
|
|
1411
|
+
}
|
|
1412
|
+
get allTilesBonusScore() {
|
|
1413
|
+
return this.config.allTilesBonusScore;
|
|
1414
|
+
}
|
|
1415
|
+
get alphabet() {
|
|
1416
|
+
return getAlphabet(this.config);
|
|
1417
|
+
}
|
|
1418
|
+
get blankScore() {
|
|
1419
|
+
return this.config.blankScore;
|
|
1420
|
+
}
|
|
1421
|
+
get boardHeight() {
|
|
1422
|
+
return this.config.boardHeight;
|
|
1423
|
+
}
|
|
1424
|
+
get boardWidth() {
|
|
1425
|
+
return this.config.boardWidth;
|
|
1426
|
+
}
|
|
1427
|
+
get twoCharacterTiles() {
|
|
1428
|
+
return this.config.tiles.filter((tile) => tile.character.length === 2).map((tile) => tile.character);
|
|
1429
|
+
}
|
|
1430
|
+
getCellBonus(cell) {
|
|
1431
|
+
return this.bonuses.find((bonus) => bonus.matchesCellCoordinates(cell));
|
|
1432
|
+
}
|
|
1433
|
+
getCellBonusValue(cell) {
|
|
1434
|
+
return this.getCellBonus(cell)?.value || constants_1.NO_BONUS;
|
|
1435
|
+
}
|
|
1436
|
+
getCharacterPoints(character) {
|
|
1555
1437
|
if (character === null) {
|
|
1556
1438
|
return undefined;
|
|
1557
1439
|
}
|
|
@@ -1559,73 +1441,54 @@ var Config = /** @class */ (function () {
|
|
|
1559
1441
|
return this.blankScore;
|
|
1560
1442
|
}
|
|
1561
1443
|
return this.pointsMap[character];
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1444
|
+
}
|
|
1445
|
+
getTwoCharacterTileByPrefix(character) {
|
|
1564
1446
|
if (character.length !== 1) {
|
|
1565
1447
|
return undefined;
|
|
1566
1448
|
}
|
|
1567
|
-
return this.twoCharacterTiles.find(
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1449
|
+
return this.twoCharacterTiles.find((characters) => characters.startsWith(character));
|
|
1450
|
+
}
|
|
1451
|
+
getTilePoints(tile) {
|
|
1570
1452
|
if (tile === null) {
|
|
1571
1453
|
return undefined;
|
|
1572
1454
|
}
|
|
1573
1455
|
return tile.isBlank ? this.blankScore : this.getCharacterPoints(tile.character);
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1456
|
+
}
|
|
1457
|
+
hasCharacter(character) {
|
|
1576
1458
|
return this.alphabet.includes(character);
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1459
|
+
}
|
|
1460
|
+
isTwoCharacterTilePrefix(character) {
|
|
1579
1461
|
return typeof this.getTwoCharacterTileByPrefix(character) !== 'undefined';
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
},
|
|
1592
|
-
enumerable: false,
|
|
1593
|
-
configurable: true
|
|
1594
|
-
});
|
|
1595
|
-
Object.defineProperty(Config.prototype, "tiles", {
|
|
1596
|
-
get: function () {
|
|
1597
|
-
return this.config.tiles;
|
|
1598
|
-
},
|
|
1599
|
-
enumerable: false,
|
|
1600
|
-
configurable: true
|
|
1601
|
-
});
|
|
1602
|
-
Config.prototype.toJson = function () {
|
|
1462
|
+
}
|
|
1463
|
+
get maximumNumberOfCharacters() {
|
|
1464
|
+
return this.config.maximumNumberOfCharacters;
|
|
1465
|
+
}
|
|
1466
|
+
get numberOfBlanks() {
|
|
1467
|
+
return this.config.numberOfBlanks;
|
|
1468
|
+
}
|
|
1469
|
+
get tiles() {
|
|
1470
|
+
return this.config.tiles;
|
|
1471
|
+
}
|
|
1472
|
+
toJson() {
|
|
1603
1473
|
return this.config;
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
return config.bonuses.map(function (bonus) {
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
const getBonuses = (config) => {
|
|
1477
|
+
return config.bonuses.map((bonus) => {
|
|
1609
1478
|
if (bonus.type === constants_1.BONUS_CHARACTER) {
|
|
1610
1479
|
return new CharacterBonus_1.default(bonus);
|
|
1611
1480
|
}
|
|
1612
1481
|
if (bonus.type === constants_1.BONUS_WORD) {
|
|
1613
1482
|
return new WordBonus_1.default(bonus);
|
|
1614
1483
|
}
|
|
1615
|
-
throw new Error(
|
|
1484
|
+
throw new Error(`Unsupported Bonus type: "${bonus.type}"`);
|
|
1616
1485
|
});
|
|
1617
1486
|
};
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
return config.tiles.reduce(function (pointsMap, _a) {
|
|
1624
|
-
var _b;
|
|
1625
|
-
var character = _a.character, score = _a.score;
|
|
1626
|
-
return (__assign(__assign({}, pointsMap), (_b = {}, _b[character] = score, _b)));
|
|
1627
|
-
}, {});
|
|
1628
|
-
};
|
|
1487
|
+
const getAlphabet = (config) => config.tiles.map(({ character }) => character);
|
|
1488
|
+
const getPointsMap = (config) => config.tiles.reduce((pointsMap, { character, score }) => ({
|
|
1489
|
+
...pointsMap,
|
|
1490
|
+
[character]: score,
|
|
1491
|
+
}), {});
|
|
1629
1492
|
exports["default"] = Config;
|
|
1630
1493
|
|
|
1631
1494
|
|
|
@@ -1635,89 +1498,43 @@ exports["default"] = Config;
|
|
|
1635
1498
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1636
1499
|
|
|
1637
1500
|
|
|
1638
|
-
var __extends = (this && this.__extends) || (function () {
|
|
1639
|
-
var extendStatics = function (d, b) {
|
|
1640
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1641
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1642
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1643
|
-
return extendStatics(d, b);
|
|
1644
|
-
};
|
|
1645
|
-
return function (d, b) {
|
|
1646
|
-
if (typeof b !== "function" && b !== null)
|
|
1647
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1648
|
-
extendStatics(d, b);
|
|
1649
|
-
function __() { this.constructor = d; }
|
|
1650
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1651
|
-
};
|
|
1652
|
-
})();
|
|
1653
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
1654
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1655
|
-
if (!m) return o;
|
|
1656
|
-
var i = m.call(o), r, ar = [], e;
|
|
1657
|
-
try {
|
|
1658
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
1659
|
-
}
|
|
1660
|
-
catch (error) { e = { error: error }; }
|
|
1661
|
-
finally {
|
|
1662
|
-
try {
|
|
1663
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
1664
|
-
}
|
|
1665
|
-
finally { if (e) throw e.error; }
|
|
1666
|
-
}
|
|
1667
|
-
return ar;
|
|
1668
|
-
};
|
|
1669
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
1670
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1671
|
-
if (ar || !(i in from)) {
|
|
1672
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1673
|
-
ar[i] = from[i];
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1677
|
-
};
|
|
1678
1501
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1679
1502
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1680
1503
|
};
|
|
1681
1504
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
function HorizontalPattern() {
|
|
1686
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1687
|
-
}
|
|
1688
|
-
HorizontalPattern.prototype.clone = function () {
|
|
1505
|
+
const Pattern_1 = __importDefault(__webpack_require__(43600));
|
|
1506
|
+
class HorizontalPattern extends Pattern_1.default {
|
|
1507
|
+
clone() {
|
|
1689
1508
|
return new HorizontalPattern({
|
|
1690
1509
|
board: this.board,
|
|
1691
|
-
cells: this.cells.map(
|
|
1510
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
1692
1511
|
});
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
var collisions = [];
|
|
1512
|
+
}
|
|
1513
|
+
getCollisions() {
|
|
1514
|
+
const collisions = [];
|
|
1697
1515
|
this.cells
|
|
1698
|
-
.filter(
|
|
1699
|
-
.forEach(
|
|
1700
|
-
|
|
1701
|
-
|
|
1516
|
+
.filter((cell) => cell.isEmpty && (this.board.collidesUp(cell) || this.board.collidesDown(cell)))
|
|
1517
|
+
.forEach((cell) => {
|
|
1518
|
+
const column = this.board.getColumn(cell.x);
|
|
1519
|
+
let y = cell.y - 1;
|
|
1702
1520
|
while (y >= 0 && column[y].hasTile()) {
|
|
1703
1521
|
--y;
|
|
1704
1522
|
}
|
|
1705
|
-
|
|
1523
|
+
const previousCells = column.slice(y + 1, cell.y);
|
|
1706
1524
|
y = cell.y + 1;
|
|
1707
1525
|
while (y < column.length && column[y].hasTile()) {
|
|
1708
1526
|
++y;
|
|
1709
1527
|
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1528
|
+
const nextCells = column.slice(cell.y + 1, y);
|
|
1529
|
+
const cells = [...previousCells, cell, ...nextCells];
|
|
1712
1530
|
if (cells.length > 1) {
|
|
1713
|
-
|
|
1531
|
+
const pattern = new Pattern_1.default({ board: this.board, cells });
|
|
1714
1532
|
collisions.push(pattern);
|
|
1715
1533
|
}
|
|
1716
1534
|
});
|
|
1717
1535
|
return collisions;
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
}(Pattern_1.default));
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1721
1538
|
exports["default"] = HorizontalPattern;
|
|
1722
1539
|
|
|
1723
1540
|
|
|
@@ -1748,59 +1565,55 @@ exports["default"] = Locale;
|
|
|
1748
1565
|
|
|
1749
1566
|
|
|
1750
1567
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
var board = _a.board, cells = _a.cells;
|
|
1568
|
+
class Pattern {
|
|
1569
|
+
constructor({ board, cells }) {
|
|
1754
1570
|
this.board = board;
|
|
1755
1571
|
this.cells = cells;
|
|
1756
1572
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1573
|
+
canBePlaced(config) {
|
|
1574
|
+
const numberOfEmptyCells = this.getNumberOfEmptyCells();
|
|
1575
|
+
const isNumberOfUsedCellsInRange = numberOfEmptyCells >= 1 && numberOfEmptyCells <= config.maximumNumberOfCharacters;
|
|
1760
1576
|
return (isNumberOfUsedCellsInRange &&
|
|
1761
1577
|
(this.hasAtLeast1NonEmptyCell() || this.collides() || (this.goesThroughBoardCenter() && this.board.isEmpty())));
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1578
|
+
}
|
|
1579
|
+
clone() {
|
|
1764
1580
|
return new Pattern({
|
|
1765
1581
|
board: this.board,
|
|
1766
|
-
cells: this.cells.map(
|
|
1582
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
1767
1583
|
});
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
};
|
|
1789
|
-
Pattern.prototype.getCollisions = function () {
|
|
1584
|
+
}
|
|
1585
|
+
collides() {
|
|
1586
|
+
return this.cells.some((cell) => cell.isEmpty && this.board.collides(cell));
|
|
1587
|
+
}
|
|
1588
|
+
getIndexOfFirstCellWithoutTile() {
|
|
1589
|
+
return this.cells.findIndex((cell) => !cell.hasTile());
|
|
1590
|
+
}
|
|
1591
|
+
getNumberOfEmptyCells() {
|
|
1592
|
+
return this.cells.filter((cell) => cell.isEmpty).length;
|
|
1593
|
+
}
|
|
1594
|
+
goesThroughBoardCenter() {
|
|
1595
|
+
return this.cells.some((cell) => cell.x === this.board.center.x && cell.y === this.board.center.y && cell.isEmpty);
|
|
1596
|
+
}
|
|
1597
|
+
hasAtLeast1EmptyCell() {
|
|
1598
|
+
return this.cells.some((cell) => cell.isEmpty);
|
|
1599
|
+
}
|
|
1600
|
+
hasAtLeast1NonEmptyCell() {
|
|
1601
|
+
return this.cells.some((cell) => !cell.isEmpty);
|
|
1602
|
+
}
|
|
1603
|
+
getCollisions() {
|
|
1790
1604
|
return [];
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1605
|
+
}
|
|
1606
|
+
toJson() {
|
|
1793
1607
|
return {
|
|
1794
|
-
cells: this.cells.map(
|
|
1795
|
-
collisions: this.getCollisions().map(
|
|
1608
|
+
cells: this.cells.map((cell) => cell.toJson()),
|
|
1609
|
+
collisions: this.getCollisions().map((collision) => collision.toJson()),
|
|
1796
1610
|
word: this.toString(),
|
|
1797
1611
|
};
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1612
|
+
}
|
|
1613
|
+
toString() {
|
|
1800
1614
|
return this.cells.map(String).join('');
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
}());
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1804
1617
|
exports["default"] = Pattern;
|
|
1805
1618
|
|
|
1806
1619
|
|
|
@@ -1814,12 +1627,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1814
1627
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1815
1628
|
};
|
|
1816
1629
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
var tiles = getTiles(cells);
|
|
1630
|
+
const constants_1 = __webpack_require__(38436);
|
|
1631
|
+
const Cell_1 = __importDefault(__webpack_require__(70902));
|
|
1632
|
+
class Result {
|
|
1633
|
+
constructor({ cells, id, numberOfCollisions, points, }) {
|
|
1634
|
+
const tiles = getTiles(cells);
|
|
1823
1635
|
this.cells = cells;
|
|
1824
1636
|
this.id = id;
|
|
1825
1637
|
this.length = cells.length;
|
|
@@ -1835,57 +1647,35 @@ var Result = /** @class */ (function () {
|
|
|
1835
1647
|
this.tilesCharacters = getTilesCharacters(tiles);
|
|
1836
1648
|
this.word = getWord(cells);
|
|
1837
1649
|
}
|
|
1838
|
-
|
|
1650
|
+
static fromJson(json) {
|
|
1839
1651
|
return new Result({
|
|
1840
1652
|
cells: json.cells.map(Cell_1.default.fromJson),
|
|
1841
1653
|
id: json.id,
|
|
1842
1654
|
numberOfCollisions: json.numberOfCollisions,
|
|
1843
1655
|
points: json.points,
|
|
1844
1656
|
});
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1657
|
+
}
|
|
1658
|
+
toJson() {
|
|
1847
1659
|
return {
|
|
1848
|
-
cells: this.cells.map(
|
|
1660
|
+
cells: this.cells.map((cell) => cell.toJson()),
|
|
1849
1661
|
id: this.id,
|
|
1850
1662
|
numberOfCollisions: this.numberOfCollisions,
|
|
1851
1663
|
points: this.points,
|
|
1852
1664
|
};
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
})
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
})
|
|
1867
|
-
var getNonBlanks = function (tiles) { return tiles.filter(function (_a) {
|
|
1868
|
-
var isBlank = _a.isBlank;
|
|
1869
|
-
return !isBlank;
|
|
1870
|
-
}); };
|
|
1871
|
-
var getPointsRatio = function (tiles, points) { return points / tiles.length; };
|
|
1872
|
-
var getTiles = function (cells) { return cells.filter(function (_a) {
|
|
1873
|
-
var isEmpty = _a.isEmpty;
|
|
1874
|
-
return isEmpty;
|
|
1875
|
-
}).map(function (_a) {
|
|
1876
|
-
var tile = _a.tile;
|
|
1877
|
-
return tile;
|
|
1878
|
-
}); };
|
|
1879
|
-
var getTilesCharacters = function (tiles) { return getNonBlankCharacters(tiles).sort(charactersComparator).join(''); };
|
|
1880
|
-
var getWord = function (cells) { return cells.map(String).join(''); };
|
|
1881
|
-
var isConsonant = function (_a) {
|
|
1882
|
-
var character = _a.character, isBlank = _a.isBlank;
|
|
1883
|
-
return constants_1.CONSONANTS.includes(character) && !isBlank;
|
|
1884
|
-
};
|
|
1885
|
-
var isVowel = function (_a) {
|
|
1886
|
-
var character = _a.character, isBlank = _a.isBlank;
|
|
1887
|
-
return constants_1.VOWELS.includes(character) && !isBlank;
|
|
1888
|
-
};
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
const charactersComparator = (a, b) => a.localeCompare(b);
|
|
1668
|
+
const getBlanks = (tiles) => tiles.filter(({ isBlank }) => isBlank);
|
|
1669
|
+
const getConsonants = (tiles) => tiles.filter(isConsonant);
|
|
1670
|
+
const getVowels = (tiles) => tiles.filter(isVowel);
|
|
1671
|
+
const getNonBlankCharacters = (tiles) => getNonBlanks(tiles).map(({ character }) => character);
|
|
1672
|
+
const getNonBlanks = (tiles) => tiles.filter(({ isBlank }) => !isBlank);
|
|
1673
|
+
const getPointsRatio = (tiles, points) => points / tiles.length;
|
|
1674
|
+
const getTiles = (cells) => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
|
|
1675
|
+
const getTilesCharacters = (tiles) => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
|
|
1676
|
+
const getWord = (cells) => cells.map(String).join('');
|
|
1677
|
+
const isConsonant = ({ character, isBlank }) => constants_1.CONSONANTS.includes(character) && !isBlank;
|
|
1678
|
+
const isVowel = ({ character, isBlank }) => constants_1.VOWELS.includes(character) && !isBlank;
|
|
1889
1679
|
exports["default"] = Result;
|
|
1890
1680
|
|
|
1891
1681
|
|
|
@@ -1896,14 +1686,13 @@ exports["default"] = Result;
|
|
|
1896
1686
|
|
|
1897
1687
|
|
|
1898
1688
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
var character = _a.character, _b = _a.isBlank, isBlank = _b === void 0 ? false : _b;
|
|
1689
|
+
const constants_1 = __webpack_require__(38436);
|
|
1690
|
+
class Tile {
|
|
1691
|
+
constructor({ character, isBlank = false }) {
|
|
1903
1692
|
this.character = character;
|
|
1904
1693
|
this.isBlank = isBlank;
|
|
1905
1694
|
}
|
|
1906
|
-
|
|
1695
|
+
static fromJson(json) {
|
|
1907
1696
|
if (!json) {
|
|
1908
1697
|
return Tile.Null;
|
|
1909
1698
|
}
|
|
@@ -1911,35 +1700,34 @@ var Tile = /** @class */ (function () {
|
|
|
1911
1700
|
character: json.character,
|
|
1912
1701
|
isBlank: json.isBlank,
|
|
1913
1702
|
});
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1703
|
+
}
|
|
1704
|
+
clone() {
|
|
1916
1705
|
return new Tile({
|
|
1917
1706
|
character: this.character,
|
|
1918
1707
|
isBlank: this.isBlank,
|
|
1919
1708
|
});
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1709
|
+
}
|
|
1710
|
+
equals(other) {
|
|
1922
1711
|
return this.character === other.character && this.isBlank === other.isBlank;
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1712
|
+
}
|
|
1713
|
+
toJson() {
|
|
1925
1714
|
return {
|
|
1926
1715
|
character: this.character,
|
|
1927
1716
|
isBlank: this.isBlank,
|
|
1928
1717
|
};
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1718
|
+
}
|
|
1719
|
+
toString() {
|
|
1931
1720
|
return this.character;
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
}());
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
Tile.Null = Object.freeze({
|
|
1724
|
+
character: constants_1.EMPTY_CELL,
|
|
1725
|
+
isBlank: false,
|
|
1726
|
+
clone: () => Tile.Null,
|
|
1727
|
+
equals: (other) => other === Tile.Null,
|
|
1728
|
+
toJson: () => null,
|
|
1729
|
+
toString: () => constants_1.EMPTY_CELL,
|
|
1730
|
+
});
|
|
1943
1731
|
exports["default"] = Tile;
|
|
1944
1732
|
|
|
1945
1733
|
|
|
@@ -1949,89 +1737,43 @@ exports["default"] = Tile;
|
|
|
1949
1737
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1950
1738
|
|
|
1951
1739
|
|
|
1952
|
-
var __extends = (this && this.__extends) || (function () {
|
|
1953
|
-
var extendStatics = function (d, b) {
|
|
1954
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1955
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1956
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1957
|
-
return extendStatics(d, b);
|
|
1958
|
-
};
|
|
1959
|
-
return function (d, b) {
|
|
1960
|
-
if (typeof b !== "function" && b !== null)
|
|
1961
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1962
|
-
extendStatics(d, b);
|
|
1963
|
-
function __() { this.constructor = d; }
|
|
1964
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1965
|
-
};
|
|
1966
|
-
})();
|
|
1967
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
1968
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1969
|
-
if (!m) return o;
|
|
1970
|
-
var i = m.call(o), r, ar = [], e;
|
|
1971
|
-
try {
|
|
1972
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
1973
|
-
}
|
|
1974
|
-
catch (error) { e = { error: error }; }
|
|
1975
|
-
finally {
|
|
1976
|
-
try {
|
|
1977
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
1978
|
-
}
|
|
1979
|
-
finally { if (e) throw e.error; }
|
|
1980
|
-
}
|
|
1981
|
-
return ar;
|
|
1982
|
-
};
|
|
1983
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
1984
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1985
|
-
if (ar || !(i in from)) {
|
|
1986
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1987
|
-
ar[i] = from[i];
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1991
|
-
};
|
|
1992
1740
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1993
1741
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1994
1742
|
};
|
|
1995
1743
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
function VerticalPattern() {
|
|
2000
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2001
|
-
}
|
|
2002
|
-
VerticalPattern.prototype.clone = function () {
|
|
1744
|
+
const Pattern_1 = __importDefault(__webpack_require__(43600));
|
|
1745
|
+
class VerticalPattern extends Pattern_1.default {
|
|
1746
|
+
clone() {
|
|
2003
1747
|
return new VerticalPattern({
|
|
2004
1748
|
board: this.board,
|
|
2005
|
-
cells: this.cells.map(
|
|
1749
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
2006
1750
|
});
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
var collisions = [];
|
|
1751
|
+
}
|
|
1752
|
+
getCollisions() {
|
|
1753
|
+
const collisions = [];
|
|
2011
1754
|
this.cells
|
|
2012
|
-
.filter(
|
|
2013
|
-
.forEach(
|
|
2014
|
-
|
|
2015
|
-
|
|
1755
|
+
.filter((cell) => cell.isEmpty && (this.board.collidesLeft(cell) || this.board.collidesRight(cell)))
|
|
1756
|
+
.forEach((cell) => {
|
|
1757
|
+
const row = this.board.getRow(cell.y);
|
|
1758
|
+
let x = cell.x - 1;
|
|
2016
1759
|
while (x >= 0 && row[x].hasTile()) {
|
|
2017
1760
|
--x;
|
|
2018
1761
|
}
|
|
2019
|
-
|
|
1762
|
+
const previousCells = row.slice(x + 1, cell.x);
|
|
2020
1763
|
x = cell.x + 1;
|
|
2021
1764
|
while (x < row.length && row[x].hasTile()) {
|
|
2022
1765
|
++x;
|
|
2023
1766
|
}
|
|
2024
|
-
|
|
2025
|
-
|
|
1767
|
+
const nextCells = row.slice(cell.x + 1, x);
|
|
1768
|
+
const cells = [...previousCells, cell, ...nextCells];
|
|
2026
1769
|
if (cells.length > 1) {
|
|
2027
|
-
|
|
1770
|
+
const pattern = new Pattern_1.default({ board: this.board, cells });
|
|
2028
1771
|
collisions.push(pattern);
|
|
2029
1772
|
}
|
|
2030
1773
|
});
|
|
2031
1774
|
return collisions;
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
}(Pattern_1.default));
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
2035
1777
|
exports["default"] = VerticalPattern;
|
|
2036
1778
|
|
|
2037
1779
|
|
|
@@ -2041,46 +1783,24 @@ exports["default"] = VerticalPattern;
|
|
|
2041
1783
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2042
1784
|
|
|
2043
1785
|
|
|
2044
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2045
|
-
var extendStatics = function (d, b) {
|
|
2046
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2047
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2048
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2049
|
-
return extendStatics(d, b);
|
|
2050
|
-
};
|
|
2051
|
-
return function (d, b) {
|
|
2052
|
-
if (typeof b !== "function" && b !== null)
|
|
2053
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2054
|
-
extendStatics(d, b);
|
|
2055
|
-
function __() { this.constructor = d; }
|
|
2056
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2057
|
-
};
|
|
2058
|
-
})();
|
|
2059
1786
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2060
1787
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2061
1788
|
};
|
|
2062
1789
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
};
|
|
2078
|
-
},
|
|
2079
|
-
enumerable: false,
|
|
2080
|
-
configurable: true
|
|
2081
|
-
});
|
|
2082
|
-
return WordBonus;
|
|
2083
|
-
}(Bonus_1.default));
|
|
1790
|
+
const constants_1 = __webpack_require__(38436);
|
|
1791
|
+
const Bonus_1 = __importDefault(__webpack_require__(80769));
|
|
1792
|
+
class WordBonus extends Bonus_1.default {
|
|
1793
|
+
constructor() {
|
|
1794
|
+
super(...arguments);
|
|
1795
|
+
this.type = constants_1.BONUS_WORD;
|
|
1796
|
+
}
|
|
1797
|
+
get value() {
|
|
1798
|
+
return {
|
|
1799
|
+
characterMultiplier: 1,
|
|
1800
|
+
wordMultiplier: this.multiplier,
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
2084
1804
|
exports["default"] = WordBonus;
|
|
2085
1805
|
|
|
2086
1806
|
|
|
@@ -2091,14 +1811,13 @@ exports["default"] = WordBonus;
|
|
|
2091
1811
|
|
|
2092
1812
|
|
|
2093
1813
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
var definitions = _a.definitions, isAllowed = _a.isAllowed, word = _a.word;
|
|
1814
|
+
class WordDefinition {
|
|
1815
|
+
constructor({ definitions, isAllowed, word }) {
|
|
2097
1816
|
this.definitions = definitions;
|
|
2098
1817
|
this.isAllowed = isAllowed;
|
|
2099
1818
|
this.word = word;
|
|
2100
1819
|
}
|
|
2101
|
-
|
|
1820
|
+
static fromJson(json) {
|
|
2102
1821
|
if (!json) {
|
|
2103
1822
|
return WordDefinition.Null;
|
|
2104
1823
|
}
|
|
@@ -2107,22 +1826,21 @@ var WordDefinition = /** @class */ (function () {
|
|
|
2107
1826
|
isAllowed: json.isAllowed,
|
|
2108
1827
|
word: json.word,
|
|
2109
1828
|
});
|
|
2110
|
-
}
|
|
2111
|
-
|
|
1829
|
+
}
|
|
1830
|
+
toJson() {
|
|
2112
1831
|
return {
|
|
2113
1832
|
definitions: this.definitions,
|
|
2114
1833
|
isAllowed: this.isAllowed,
|
|
2115
1834
|
word: this.word,
|
|
2116
1835
|
};
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
}());
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
WordDefinition.Null = Object.freeze({
|
|
1839
|
+
definitions: [],
|
|
1840
|
+
isAllowed: false,
|
|
1841
|
+
word: '',
|
|
1842
|
+
toJson: () => null,
|
|
1843
|
+
});
|
|
2126
1844
|
exports["default"] = WordDefinition;
|
|
2127
1845
|
|
|
2128
1846
|
|