@scrabble-solver/scrabble-solver 2.8.1 → 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/{CQTUJjnUaobzo-T6zRWj1 → 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/CQTUJjnUaobzo-T6zRWj1/_buildManifest.js +0 -1
- package/.next/static/chunks/pages/_app-f4030148d742bcd2.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 },
|
|
@@ -2468,115 +2433,98 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2468
2433
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2469
2434
|
};
|
|
2470
2435
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
var rows = _a.rows;
|
|
2436
|
+
const constants_1 = __webpack_require__(7618);
|
|
2437
|
+
const Cell_1 = __importDefault(__webpack_require__(52251));
|
|
2438
|
+
const Tile_1 = __importDefault(__webpack_require__(25275));
|
|
2439
|
+
class Board {
|
|
2440
|
+
constructor({ rows }) {
|
|
2477
2441
|
this.rows = rows;
|
|
2478
2442
|
this.numberOfColumns = rows[0].length;
|
|
2479
2443
|
this.numberOfRows = rows.length;
|
|
2480
2444
|
}
|
|
2481
|
-
|
|
2445
|
+
static create(width, height) {
|
|
2482
2446
|
return Board.fromStringArray(Array(height).fill(Array(width).fill(' ').join('')));
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2447
|
+
}
|
|
2448
|
+
static fromJson(json) {
|
|
2485
2449
|
return new Board({
|
|
2486
|
-
rows: json.map(
|
|
2450
|
+
rows: json.map((row) => row.map(Cell_1.default.fromJson)),
|
|
2487
2451
|
});
|
|
2488
|
-
}
|
|
2489
|
-
|
|
2452
|
+
}
|
|
2453
|
+
static fromStringArray(stringArray) {
|
|
2490
2454
|
return new Board({
|
|
2491
|
-
rows: stringArray.map(
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
y: y,
|
|
2498
|
-
});
|
|
2499
|
-
});
|
|
2500
|
-
}),
|
|
2455
|
+
rows: stringArray.map((row, y) => row.split('').map((character, x) => new Cell_1.default({
|
|
2456
|
+
isEmpty: !character || character === constants_1.EMPTY_CELL,
|
|
2457
|
+
tile: character === constants_1.EMPTY_CELL ? Tile_1.default.Null : new Tile_1.default({ character }),
|
|
2458
|
+
x,
|
|
2459
|
+
y,
|
|
2460
|
+
}))),
|
|
2501
2461
|
});
|
|
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) {
|
|
2462
|
+
}
|
|
2463
|
+
get center() {
|
|
2464
|
+
const x = Math.floor(this.numberOfColumns / 2);
|
|
2465
|
+
const y = Math.floor(this.numberOfRows / 2);
|
|
2466
|
+
return this.rows[y][x];
|
|
2467
|
+
}
|
|
2468
|
+
clone() {
|
|
2469
|
+
const rows = this.rows.map((row) => row.map((cell) => cell.clone()));
|
|
2470
|
+
return new Board({ rows });
|
|
2471
|
+
}
|
|
2472
|
+
collides(cell) {
|
|
2517
2473
|
return this.collidesUp(cell) || this.collidesDown(cell) || this.collidesLeft(cell) || this.collidesRight(cell);
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2520
|
-
var x = _a.x, y = _a.y;
|
|
2474
|
+
}
|
|
2475
|
+
collidesDown({ x, y }) {
|
|
2521
2476
|
return y < this.numberOfRows - 1 && !this.rows[y + 1][x].isEmpty;
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
var x = _a.x, y = _a.y;
|
|
2477
|
+
}
|
|
2478
|
+
collidesLeft({ x, y }) {
|
|
2525
2479
|
return x > 0 && !this.rows[y][x - 1].isEmpty;
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2528
|
-
var x = _a.x, y = _a.y;
|
|
2480
|
+
}
|
|
2481
|
+
collidesRight({ x, y }) {
|
|
2529
2482
|
return x < this.numberOfColumns - 1 && !this.rows[y][x + 1].isEmpty;
|
|
2530
|
-
}
|
|
2531
|
-
|
|
2532
|
-
var x = _a.x, y = _a.y;
|
|
2483
|
+
}
|
|
2484
|
+
collidesUp({ x, y }) {
|
|
2533
2485
|
return y > 0 && !this.rows[y - 1][x].isEmpty;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2486
|
+
}
|
|
2487
|
+
equals(other) {
|
|
2536
2488
|
return (this.numberOfColumns === other.numberOfColumns &&
|
|
2537
2489
|
this.numberOfRows === other.numberOfRows &&
|
|
2538
|
-
this.rows.every(
|
|
2539
|
-
return row.every(
|
|
2490
|
+
this.rows.every((row, rowIndex) => {
|
|
2491
|
+
return row.every((cell, cellIndex) => {
|
|
2540
2492
|
return cell.equals(other.rows[rowIndex][cellIndex]);
|
|
2541
2493
|
});
|
|
2542
2494
|
}));
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
return this.rows.reduce(
|
|
2546
|
-
return count + row.reduce(
|
|
2495
|
+
}
|
|
2496
|
+
getBlanksCount() {
|
|
2497
|
+
return this.rows.reduce((count, row) => {
|
|
2498
|
+
return count + row.reduce((rowCount, cell) => (cell.tile.isBlank ? rowCount + 1 : rowCount), 0);
|
|
2547
2499
|
}, 0);
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
return this.rows.map(
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2500
|
+
}
|
|
2501
|
+
getColumn(index) {
|
|
2502
|
+
return this.rows.map((row) => row[index]);
|
|
2503
|
+
}
|
|
2504
|
+
getRow(index) {
|
|
2553
2505
|
return this.rows[index];
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
return this.rows.reduce(
|
|
2557
|
-
return count + row.reduce(
|
|
2506
|
+
}
|
|
2507
|
+
getTilesCount() {
|
|
2508
|
+
return this.rows.reduce((count, row) => {
|
|
2509
|
+
return count + row.reduce((rowCount, cell) => (cell.hasTile() ? rowCount + 1 : rowCount), 0);
|
|
2558
2510
|
}, 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) {
|
|
2511
|
+
}
|
|
2512
|
+
isEmpty() {
|
|
2513
|
+
return this.rows.every((row) => row.every(({ isEmpty }) => isEmpty));
|
|
2514
|
+
}
|
|
2515
|
+
toJson() {
|
|
2516
|
+
return this.rows.map((row) => row.map((cell) => cell.toJson()));
|
|
2517
|
+
}
|
|
2518
|
+
toString() {
|
|
2519
|
+
return this.rows.map((row) => row.map(String)).join('\n');
|
|
2520
|
+
}
|
|
2521
|
+
updateCell(x, y, updateCell) {
|
|
2573
2522
|
this.rows[y][x] = updateCell(this.rows[y][x]);
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2523
|
+
}
|
|
2524
|
+
updateRow(y, updateRow) {
|
|
2576
2525
|
this.rows[y] = updateRow(this.rows[y]);
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
}());
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2580
2528
|
exports["default"] = Board;
|
|
2581
2529
|
|
|
2582
2530
|
|
|
@@ -2587,21 +2535,20 @@ exports["default"] = Board;
|
|
|
2587
2535
|
|
|
2588
2536
|
|
|
2589
2537
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
var multiplier = _a.multiplier, score = _a.score, x = _a.x, y = _a.y;
|
|
2538
|
+
class Bonus {
|
|
2539
|
+
constructor({ multiplier, score, x, y }) {
|
|
2593
2540
|
this.multiplier = multiplier;
|
|
2594
2541
|
this.score = score;
|
|
2595
2542
|
this.x = x;
|
|
2596
2543
|
this.y = y;
|
|
2597
2544
|
}
|
|
2598
|
-
|
|
2545
|
+
canApply(_config, cell) {
|
|
2599
2546
|
return cell.isEmpty && this.matchesCellCoordinates(cell);
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2547
|
+
}
|
|
2548
|
+
matchesCellCoordinates(cell) {
|
|
2602
2549
|
return this.x === cell.x && this.y === cell.y;
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2550
|
+
}
|
|
2551
|
+
toJson() {
|
|
2605
2552
|
return {
|
|
2606
2553
|
multiplier: this.multiplier,
|
|
2607
2554
|
score: this.score,
|
|
@@ -2609,19 +2556,14 @@ var Bonus = /** @class */ (function () {
|
|
|
2609
2556
|
x: this.x,
|
|
2610
2557
|
y: this.y,
|
|
2611
2558
|
};
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
enumerable: false,
|
|
2621
|
-
configurable: true
|
|
2622
|
-
});
|
|
2623
|
-
return Bonus;
|
|
2624
|
-
}());
|
|
2559
|
+
}
|
|
2560
|
+
get value() {
|
|
2561
|
+
return {
|
|
2562
|
+
characterMultiplier: 1,
|
|
2563
|
+
wordMultiplier: 1,
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2625
2567
|
exports["default"] = Bonus;
|
|
2626
2568
|
|
|
2627
2569
|
|
|
@@ -2635,17 +2577,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2635
2577
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2636
2578
|
};
|
|
2637
2579
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2638
|
-
|
|
2639
|
-
|
|
2580
|
+
const Tile_1 = __importDefault(__webpack_require__(25275));
|
|
2581
|
+
class Cell {
|
|
2640
2582
|
// 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;
|
|
2583
|
+
constructor({ isEmpty = true, tile = Tile_1.default.Null, x, y }) {
|
|
2643
2584
|
this.isEmpty = isEmpty;
|
|
2644
2585
|
this.tile = tile;
|
|
2645
2586
|
this.x = x;
|
|
2646
2587
|
this.y = y;
|
|
2647
2588
|
}
|
|
2648
|
-
|
|
2589
|
+
static fromJson(json) {
|
|
2649
2590
|
if (!json) {
|
|
2650
2591
|
return Cell.Null;
|
|
2651
2592
|
}
|
|
@@ -2655,49 +2596,48 @@ var Cell = /** @class */ (function () {
|
|
|
2655
2596
|
x: json.x,
|
|
2656
2597
|
y: json.y,
|
|
2657
2598
|
});
|
|
2658
|
-
}
|
|
2659
|
-
|
|
2599
|
+
}
|
|
2600
|
+
clone() {
|
|
2660
2601
|
return new Cell({
|
|
2661
2602
|
isEmpty: this.isEmpty,
|
|
2662
2603
|
tile: this.tile.clone(),
|
|
2663
2604
|
x: this.x,
|
|
2664
2605
|
y: this.y,
|
|
2665
2606
|
});
|
|
2666
|
-
}
|
|
2667
|
-
|
|
2607
|
+
}
|
|
2608
|
+
equals(other) {
|
|
2668
2609
|
return this.x === other.x && this.y === other.y && this.isEmpty === other.isEmpty && this.tile.equals(other.tile);
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2610
|
+
}
|
|
2611
|
+
hasTile() {
|
|
2671
2612
|
return this.tile !== Tile_1.default.Null;
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2613
|
+
}
|
|
2614
|
+
isCandidate() {
|
|
2674
2615
|
return this.isEmpty && this.hasTile();
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2616
|
+
}
|
|
2617
|
+
toJson() {
|
|
2677
2618
|
return {
|
|
2678
2619
|
isEmpty: this.isEmpty,
|
|
2679
2620
|
tile: this.tile.toJson(),
|
|
2680
2621
|
x: this.x,
|
|
2681
2622
|
y: this.y,
|
|
2682
2623
|
};
|
|
2683
|
-
}
|
|
2684
|
-
|
|
2624
|
+
}
|
|
2625
|
+
toString() {
|
|
2685
2626
|
return String(this.tile);
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
}());
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
Cell.Null = Object.freeze({
|
|
2630
|
+
isEmpty: true,
|
|
2631
|
+
tile: Tile_1.default.Null,
|
|
2632
|
+
x: 0,
|
|
2633
|
+
y: 0,
|
|
2634
|
+
clone: () => Cell.Null,
|
|
2635
|
+
equals: (other) => other === Cell.Null,
|
|
2636
|
+
hasTile: () => false,
|
|
2637
|
+
isCandidate: () => false,
|
|
2638
|
+
toString: () => '',
|
|
2639
|
+
toJson: () => null,
|
|
2640
|
+
});
|
|
2701
2641
|
exports["default"] = Cell;
|
|
2702
2642
|
|
|
2703
2643
|
|
|
@@ -2707,55 +2647,33 @@ exports["default"] = Cell;
|
|
|
2707
2647
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2708
2648
|
|
|
2709
2649
|
|
|
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
2650
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2726
2651
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2727
2652
|
};
|
|
2728
2653
|
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) {
|
|
2654
|
+
const constants_1 = __webpack_require__(7618);
|
|
2655
|
+
const Bonus_1 = __importDefault(__webpack_require__(37706));
|
|
2656
|
+
class CharacterBonus extends Bonus_1.default {
|
|
2657
|
+
constructor() {
|
|
2658
|
+
super(...arguments);
|
|
2659
|
+
this.type = constants_1.BONUS_CHARACTER;
|
|
2660
|
+
}
|
|
2661
|
+
canApply(config, cell) {
|
|
2662
|
+
return super.canApply(config, cell) && this.matchesCellTileScore(config, cell);
|
|
2663
|
+
}
|
|
2664
|
+
matchesCellTileScore(config, cell) {
|
|
2742
2665
|
if (typeof this.score === 'undefined') {
|
|
2743
2666
|
return true;
|
|
2744
2667
|
}
|
|
2745
2668
|
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));
|
|
2669
|
+
}
|
|
2670
|
+
get value() {
|
|
2671
|
+
return {
|
|
2672
|
+
characterMultiplier: this.multiplier,
|
|
2673
|
+
wordMultiplier: 1,
|
|
2674
|
+
};
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2759
2677
|
exports["default"] = CharacterBonus;
|
|
2760
2678
|
|
|
2761
2679
|
|
|
@@ -2765,83 +2683,47 @@ exports["default"] = CharacterBonus;
|
|
|
2765
2683
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2766
2684
|
|
|
2767
2685
|
|
|
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
2686
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2780
2687
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2781
2688
|
};
|
|
2782
2689
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2690
|
+
const constants_1 = __webpack_require__(7618);
|
|
2691
|
+
const CharacterBonus_1 = __importDefault(__webpack_require__(19582));
|
|
2692
|
+
const WordBonus_1 = __importDefault(__webpack_require__(58627));
|
|
2693
|
+
class Config {
|
|
2694
|
+
constructor(config) {
|
|
2788
2695
|
this.bonuses = getBonuses(config);
|
|
2789
2696
|
this.config = config;
|
|
2790
2697
|
this.pointsMap = getPointsMap(this.config);
|
|
2791
2698
|
}
|
|
2792
|
-
|
|
2699
|
+
static fromJson(json) {
|
|
2793
2700
|
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) {
|
|
2701
|
+
}
|
|
2702
|
+
get allTilesBonusScore() {
|
|
2703
|
+
return this.config.allTilesBonusScore;
|
|
2704
|
+
}
|
|
2705
|
+
get alphabet() {
|
|
2706
|
+
return getAlphabet(this.config);
|
|
2707
|
+
}
|
|
2708
|
+
get blankScore() {
|
|
2709
|
+
return this.config.blankScore;
|
|
2710
|
+
}
|
|
2711
|
+
get boardHeight() {
|
|
2712
|
+
return this.config.boardHeight;
|
|
2713
|
+
}
|
|
2714
|
+
get boardWidth() {
|
|
2715
|
+
return this.config.boardWidth;
|
|
2716
|
+
}
|
|
2717
|
+
get twoCharacterTiles() {
|
|
2718
|
+
return this.config.tiles.filter((tile) => tile.character.length === 2).map((tile) => tile.character);
|
|
2719
|
+
}
|
|
2720
|
+
getCellBonus(cell) {
|
|
2721
|
+
return this.bonuses.find((bonus) => bonus.matchesCellCoordinates(cell));
|
|
2722
|
+
}
|
|
2723
|
+
getCellBonusValue(cell) {
|
|
2724
|
+
return this.getCellBonus(cell)?.value || constants_1.NO_BONUS;
|
|
2725
|
+
}
|
|
2726
|
+
getCharacterPoints(character) {
|
|
2845
2727
|
if (character === null) {
|
|
2846
2728
|
return undefined;
|
|
2847
2729
|
}
|
|
@@ -2849,73 +2731,54 @@ var Config = /** @class */ (function () {
|
|
|
2849
2731
|
return this.blankScore;
|
|
2850
2732
|
}
|
|
2851
2733
|
return this.pointsMap[character];
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2734
|
+
}
|
|
2735
|
+
getTwoCharacterTileByPrefix(character) {
|
|
2854
2736
|
if (character.length !== 1) {
|
|
2855
2737
|
return undefined;
|
|
2856
2738
|
}
|
|
2857
|
-
return this.twoCharacterTiles.find(
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2739
|
+
return this.twoCharacterTiles.find((characters) => characters.startsWith(character));
|
|
2740
|
+
}
|
|
2741
|
+
getTilePoints(tile) {
|
|
2860
2742
|
if (tile === null) {
|
|
2861
2743
|
return undefined;
|
|
2862
2744
|
}
|
|
2863
2745
|
return tile.isBlank ? this.blankScore : this.getCharacterPoints(tile.character);
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2746
|
+
}
|
|
2747
|
+
hasCharacter(character) {
|
|
2866
2748
|
return this.alphabet.includes(character);
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2749
|
+
}
|
|
2750
|
+
isTwoCharacterTilePrefix(character) {
|
|
2869
2751
|
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 () {
|
|
2752
|
+
}
|
|
2753
|
+
get maximumNumberOfCharacters() {
|
|
2754
|
+
return this.config.maximumNumberOfCharacters;
|
|
2755
|
+
}
|
|
2756
|
+
get numberOfBlanks() {
|
|
2757
|
+
return this.config.numberOfBlanks;
|
|
2758
|
+
}
|
|
2759
|
+
get tiles() {
|
|
2760
|
+
return this.config.tiles;
|
|
2761
|
+
}
|
|
2762
|
+
toJson() {
|
|
2893
2763
|
return this.config;
|
|
2894
|
-
}
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
return config.bonuses.map(function (bonus) {
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
const getBonuses = (config) => {
|
|
2767
|
+
return config.bonuses.map((bonus) => {
|
|
2899
2768
|
if (bonus.type === constants_1.BONUS_CHARACTER) {
|
|
2900
2769
|
return new CharacterBonus_1.default(bonus);
|
|
2901
2770
|
}
|
|
2902
2771
|
if (bonus.type === constants_1.BONUS_WORD) {
|
|
2903
2772
|
return new WordBonus_1.default(bonus);
|
|
2904
2773
|
}
|
|
2905
|
-
throw new Error(
|
|
2774
|
+
throw new Error(`Unsupported Bonus type: "${bonus.type}"`);
|
|
2906
2775
|
});
|
|
2907
2776
|
};
|
|
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
|
-
};
|
|
2777
|
+
const getAlphabet = (config) => config.tiles.map(({ character }) => character);
|
|
2778
|
+
const getPointsMap = (config) => config.tiles.reduce((pointsMap, { character, score }) => ({
|
|
2779
|
+
...pointsMap,
|
|
2780
|
+
[character]: score,
|
|
2781
|
+
}), {});
|
|
2919
2782
|
exports["default"] = Config;
|
|
2920
2783
|
|
|
2921
2784
|
|
|
@@ -2925,89 +2788,43 @@ exports["default"] = Config;
|
|
|
2925
2788
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2926
2789
|
|
|
2927
2790
|
|
|
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
2791
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2969
2792
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2970
2793
|
};
|
|
2971
2794
|
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 () {
|
|
2795
|
+
const Pattern_1 = __importDefault(__webpack_require__(63207));
|
|
2796
|
+
class HorizontalPattern extends Pattern_1.default {
|
|
2797
|
+
clone() {
|
|
2979
2798
|
return new HorizontalPattern({
|
|
2980
2799
|
board: this.board,
|
|
2981
|
-
cells: this.cells.map(
|
|
2800
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
2982
2801
|
});
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
var collisions = [];
|
|
2802
|
+
}
|
|
2803
|
+
getCollisions() {
|
|
2804
|
+
const collisions = [];
|
|
2987
2805
|
this.cells
|
|
2988
|
-
.filter(
|
|
2989
|
-
.forEach(
|
|
2990
|
-
|
|
2991
|
-
|
|
2806
|
+
.filter((cell) => cell.isEmpty && (this.board.collidesUp(cell) || this.board.collidesDown(cell)))
|
|
2807
|
+
.forEach((cell) => {
|
|
2808
|
+
const column = this.board.getColumn(cell.x);
|
|
2809
|
+
let y = cell.y - 1;
|
|
2992
2810
|
while (y >= 0 && column[y].hasTile()) {
|
|
2993
2811
|
--y;
|
|
2994
2812
|
}
|
|
2995
|
-
|
|
2813
|
+
const previousCells = column.slice(y + 1, cell.y);
|
|
2996
2814
|
y = cell.y + 1;
|
|
2997
2815
|
while (y < column.length && column[y].hasTile()) {
|
|
2998
2816
|
++y;
|
|
2999
2817
|
}
|
|
3000
|
-
|
|
3001
|
-
|
|
2818
|
+
const nextCells = column.slice(cell.y + 1, y);
|
|
2819
|
+
const cells = [...previousCells, cell, ...nextCells];
|
|
3002
2820
|
if (cells.length > 1) {
|
|
3003
|
-
|
|
2821
|
+
const pattern = new Pattern_1.default({ board: this.board, cells });
|
|
3004
2822
|
collisions.push(pattern);
|
|
3005
2823
|
}
|
|
3006
2824
|
});
|
|
3007
2825
|
return collisions;
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
}(Pattern_1.default));
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
3011
2828
|
exports["default"] = HorizontalPattern;
|
|
3012
2829
|
|
|
3013
2830
|
|
|
@@ -3038,59 +2855,55 @@ exports["default"] = Locale;
|
|
|
3038
2855
|
|
|
3039
2856
|
|
|
3040
2857
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
var board = _a.board, cells = _a.cells;
|
|
2858
|
+
class Pattern {
|
|
2859
|
+
constructor({ board, cells }) {
|
|
3044
2860
|
this.board = board;
|
|
3045
2861
|
this.cells = cells;
|
|
3046
2862
|
}
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
2863
|
+
canBePlaced(config) {
|
|
2864
|
+
const numberOfEmptyCells = this.getNumberOfEmptyCells();
|
|
2865
|
+
const isNumberOfUsedCellsInRange = numberOfEmptyCells >= 1 && numberOfEmptyCells <= config.maximumNumberOfCharacters;
|
|
3050
2866
|
return (isNumberOfUsedCellsInRange &&
|
|
3051
2867
|
(this.hasAtLeast1NonEmptyCell() || this.collides() || (this.goesThroughBoardCenter() && this.board.isEmpty())));
|
|
3052
|
-
}
|
|
3053
|
-
|
|
2868
|
+
}
|
|
2869
|
+
clone() {
|
|
3054
2870
|
return new Pattern({
|
|
3055
2871
|
board: this.board,
|
|
3056
|
-
cells: this.cells.map(
|
|
2872
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
3057
2873
|
});
|
|
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 () {
|
|
2874
|
+
}
|
|
2875
|
+
collides() {
|
|
2876
|
+
return this.cells.some((cell) => cell.isEmpty && this.board.collides(cell));
|
|
2877
|
+
}
|
|
2878
|
+
getIndexOfFirstCellWithoutTile() {
|
|
2879
|
+
return this.cells.findIndex((cell) => !cell.hasTile());
|
|
2880
|
+
}
|
|
2881
|
+
getNumberOfEmptyCells() {
|
|
2882
|
+
return this.cells.filter((cell) => cell.isEmpty).length;
|
|
2883
|
+
}
|
|
2884
|
+
goesThroughBoardCenter() {
|
|
2885
|
+
return this.cells.some((cell) => cell.x === this.board.center.x && cell.y === this.board.center.y && cell.isEmpty);
|
|
2886
|
+
}
|
|
2887
|
+
hasAtLeast1EmptyCell() {
|
|
2888
|
+
return this.cells.some((cell) => cell.isEmpty);
|
|
2889
|
+
}
|
|
2890
|
+
hasAtLeast1NonEmptyCell() {
|
|
2891
|
+
return this.cells.some((cell) => !cell.isEmpty);
|
|
2892
|
+
}
|
|
2893
|
+
getCollisions() {
|
|
3080
2894
|
return [];
|
|
3081
|
-
}
|
|
3082
|
-
|
|
2895
|
+
}
|
|
2896
|
+
toJson() {
|
|
3083
2897
|
return {
|
|
3084
|
-
cells: this.cells.map(
|
|
3085
|
-
collisions: this.getCollisions().map(
|
|
2898
|
+
cells: this.cells.map((cell) => cell.toJson()),
|
|
2899
|
+
collisions: this.getCollisions().map((collision) => collision.toJson()),
|
|
3086
2900
|
word: this.toString(),
|
|
3087
2901
|
};
|
|
3088
|
-
}
|
|
3089
|
-
|
|
2902
|
+
}
|
|
2903
|
+
toString() {
|
|
3090
2904
|
return this.cells.map(String).join('');
|
|
3091
|
-
}
|
|
3092
|
-
|
|
3093
|
-
}());
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
3094
2907
|
exports["default"] = Pattern;
|
|
3095
2908
|
|
|
3096
2909
|
|
|
@@ -3104,12 +2917,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3104
2917
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3105
2918
|
};
|
|
3106
2919
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
var tiles = getTiles(cells);
|
|
2920
|
+
const constants_1 = __webpack_require__(7618);
|
|
2921
|
+
const Cell_1 = __importDefault(__webpack_require__(52251));
|
|
2922
|
+
class Result {
|
|
2923
|
+
constructor({ cells, id, numberOfCollisions, points, }) {
|
|
2924
|
+
const tiles = getTiles(cells);
|
|
3113
2925
|
this.cells = cells;
|
|
3114
2926
|
this.id = id;
|
|
3115
2927
|
this.length = cells.length;
|
|
@@ -3125,57 +2937,35 @@ var Result = /** @class */ (function () {
|
|
|
3125
2937
|
this.tilesCharacters = getTilesCharacters(tiles);
|
|
3126
2938
|
this.word = getWord(cells);
|
|
3127
2939
|
}
|
|
3128
|
-
|
|
2940
|
+
static fromJson(json) {
|
|
3129
2941
|
return new Result({
|
|
3130
2942
|
cells: json.cells.map(Cell_1.default.fromJson),
|
|
3131
2943
|
id: json.id,
|
|
3132
2944
|
numberOfCollisions: json.numberOfCollisions,
|
|
3133
2945
|
points: json.points,
|
|
3134
2946
|
});
|
|
3135
|
-
}
|
|
3136
|
-
|
|
2947
|
+
}
|
|
2948
|
+
toJson() {
|
|
3137
2949
|
return {
|
|
3138
|
-
cells: this.cells.map(
|
|
2950
|
+
cells: this.cells.map((cell) => cell.toJson()),
|
|
3139
2951
|
id: this.id,
|
|
3140
2952
|
numberOfCollisions: this.numberOfCollisions,
|
|
3141
2953
|
points: this.points,
|
|
3142
2954
|
};
|
|
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
|
-
};
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
const charactersComparator = (a, b) => a.localeCompare(b);
|
|
2958
|
+
const getBlanks = (tiles) => tiles.filter(({ isBlank }) => isBlank);
|
|
2959
|
+
const getConsonants = (tiles) => tiles.filter(isConsonant);
|
|
2960
|
+
const getVowels = (tiles) => tiles.filter(isVowel);
|
|
2961
|
+
const getNonBlankCharacters = (tiles) => getNonBlanks(tiles).map(({ character }) => character);
|
|
2962
|
+
const getNonBlanks = (tiles) => tiles.filter(({ isBlank }) => !isBlank);
|
|
2963
|
+
const getPointsRatio = (tiles, points) => points / tiles.length;
|
|
2964
|
+
const getTiles = (cells) => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
|
|
2965
|
+
const getTilesCharacters = (tiles) => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
|
|
2966
|
+
const getWord = (cells) => cells.map(String).join('');
|
|
2967
|
+
const isConsonant = ({ character, isBlank }) => constants_1.CONSONANTS.includes(character) && !isBlank;
|
|
2968
|
+
const isVowel = ({ character, isBlank }) => constants_1.VOWELS.includes(character) && !isBlank;
|
|
3179
2969
|
exports["default"] = Result;
|
|
3180
2970
|
|
|
3181
2971
|
|
|
@@ -3186,14 +2976,13 @@ exports["default"] = Result;
|
|
|
3186
2976
|
|
|
3187
2977
|
|
|
3188
2978
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
var character = _a.character, _b = _a.isBlank, isBlank = _b === void 0 ? false : _b;
|
|
2979
|
+
const constants_1 = __webpack_require__(7618);
|
|
2980
|
+
class Tile {
|
|
2981
|
+
constructor({ character, isBlank = false }) {
|
|
3193
2982
|
this.character = character;
|
|
3194
2983
|
this.isBlank = isBlank;
|
|
3195
2984
|
}
|
|
3196
|
-
|
|
2985
|
+
static fromJson(json) {
|
|
3197
2986
|
if (!json) {
|
|
3198
2987
|
return Tile.Null;
|
|
3199
2988
|
}
|
|
@@ -3201,35 +2990,34 @@ var Tile = /** @class */ (function () {
|
|
|
3201
2990
|
character: json.character,
|
|
3202
2991
|
isBlank: json.isBlank,
|
|
3203
2992
|
});
|
|
3204
|
-
}
|
|
3205
|
-
|
|
2993
|
+
}
|
|
2994
|
+
clone() {
|
|
3206
2995
|
return new Tile({
|
|
3207
2996
|
character: this.character,
|
|
3208
2997
|
isBlank: this.isBlank,
|
|
3209
2998
|
});
|
|
3210
|
-
}
|
|
3211
|
-
|
|
2999
|
+
}
|
|
3000
|
+
equals(other) {
|
|
3212
3001
|
return this.character === other.character && this.isBlank === other.isBlank;
|
|
3213
|
-
}
|
|
3214
|
-
|
|
3002
|
+
}
|
|
3003
|
+
toJson() {
|
|
3215
3004
|
return {
|
|
3216
3005
|
character: this.character,
|
|
3217
3006
|
isBlank: this.isBlank,
|
|
3218
3007
|
};
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3008
|
+
}
|
|
3009
|
+
toString() {
|
|
3221
3010
|
return this.character;
|
|
3222
|
-
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
}());
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
Tile.Null = Object.freeze({
|
|
3014
|
+
character: constants_1.EMPTY_CELL,
|
|
3015
|
+
isBlank: false,
|
|
3016
|
+
clone: () => Tile.Null,
|
|
3017
|
+
equals: (other) => other === Tile.Null,
|
|
3018
|
+
toJson: () => null,
|
|
3019
|
+
toString: () => constants_1.EMPTY_CELL,
|
|
3020
|
+
});
|
|
3233
3021
|
exports["default"] = Tile;
|
|
3234
3022
|
|
|
3235
3023
|
|
|
@@ -3239,89 +3027,43 @@ exports["default"] = Tile;
|
|
|
3239
3027
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3240
3028
|
|
|
3241
3029
|
|
|
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
3030
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3283
3031
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3284
3032
|
};
|
|
3285
3033
|
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 () {
|
|
3034
|
+
const Pattern_1 = __importDefault(__webpack_require__(63207));
|
|
3035
|
+
class VerticalPattern extends Pattern_1.default {
|
|
3036
|
+
clone() {
|
|
3293
3037
|
return new VerticalPattern({
|
|
3294
3038
|
board: this.board,
|
|
3295
|
-
cells: this.cells.map(
|
|
3039
|
+
cells: this.cells.map((cell) => cell.clone()),
|
|
3296
3040
|
});
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
var collisions = [];
|
|
3041
|
+
}
|
|
3042
|
+
getCollisions() {
|
|
3043
|
+
const collisions = [];
|
|
3301
3044
|
this.cells
|
|
3302
|
-
.filter(
|
|
3303
|
-
.forEach(
|
|
3304
|
-
|
|
3305
|
-
|
|
3045
|
+
.filter((cell) => cell.isEmpty && (this.board.collidesLeft(cell) || this.board.collidesRight(cell)))
|
|
3046
|
+
.forEach((cell) => {
|
|
3047
|
+
const row = this.board.getRow(cell.y);
|
|
3048
|
+
let x = cell.x - 1;
|
|
3306
3049
|
while (x >= 0 && row[x].hasTile()) {
|
|
3307
3050
|
--x;
|
|
3308
3051
|
}
|
|
3309
|
-
|
|
3052
|
+
const previousCells = row.slice(x + 1, cell.x);
|
|
3310
3053
|
x = cell.x + 1;
|
|
3311
3054
|
while (x < row.length && row[x].hasTile()) {
|
|
3312
3055
|
++x;
|
|
3313
3056
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
3057
|
+
const nextCells = row.slice(cell.x + 1, x);
|
|
3058
|
+
const cells = [...previousCells, cell, ...nextCells];
|
|
3316
3059
|
if (cells.length > 1) {
|
|
3317
|
-
|
|
3060
|
+
const pattern = new Pattern_1.default({ board: this.board, cells });
|
|
3318
3061
|
collisions.push(pattern);
|
|
3319
3062
|
}
|
|
3320
3063
|
});
|
|
3321
3064
|
return collisions;
|
|
3322
|
-
}
|
|
3323
|
-
|
|
3324
|
-
}(Pattern_1.default));
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3325
3067
|
exports["default"] = VerticalPattern;
|
|
3326
3068
|
|
|
3327
3069
|
|
|
@@ -3331,46 +3073,24 @@ exports["default"] = VerticalPattern;
|
|
|
3331
3073
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3332
3074
|
|
|
3333
3075
|
|
|
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
3076
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3350
3077
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3351
3078
|
};
|
|
3352
3079
|
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));
|
|
3080
|
+
const constants_1 = __webpack_require__(7618);
|
|
3081
|
+
const Bonus_1 = __importDefault(__webpack_require__(37706));
|
|
3082
|
+
class WordBonus extends Bonus_1.default {
|
|
3083
|
+
constructor() {
|
|
3084
|
+
super(...arguments);
|
|
3085
|
+
this.type = constants_1.BONUS_WORD;
|
|
3086
|
+
}
|
|
3087
|
+
get value() {
|
|
3088
|
+
return {
|
|
3089
|
+
characterMultiplier: 1,
|
|
3090
|
+
wordMultiplier: this.multiplier,
|
|
3091
|
+
};
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3374
3094
|
exports["default"] = WordBonus;
|
|
3375
3095
|
|
|
3376
3096
|
|
|
@@ -3381,14 +3101,13 @@ exports["default"] = WordBonus;
|
|
|
3381
3101
|
|
|
3382
3102
|
|
|
3383
3103
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
var definitions = _a.definitions, isAllowed = _a.isAllowed, word = _a.word;
|
|
3104
|
+
class WordDefinition {
|
|
3105
|
+
constructor({ definitions, isAllowed, word }) {
|
|
3387
3106
|
this.definitions = definitions;
|
|
3388
3107
|
this.isAllowed = isAllowed;
|
|
3389
3108
|
this.word = word;
|
|
3390
3109
|
}
|
|
3391
|
-
|
|
3110
|
+
static fromJson(json) {
|
|
3392
3111
|
if (!json) {
|
|
3393
3112
|
return WordDefinition.Null;
|
|
3394
3113
|
}
|
|
@@ -3397,22 +3116,21 @@ var WordDefinition = /** @class */ (function () {
|
|
|
3397
3116
|
isAllowed: json.isAllowed,
|
|
3398
3117
|
word: json.word,
|
|
3399
3118
|
});
|
|
3400
|
-
}
|
|
3401
|
-
|
|
3119
|
+
}
|
|
3120
|
+
toJson() {
|
|
3402
3121
|
return {
|
|
3403
3122
|
definitions: this.definitions,
|
|
3404
3123
|
isAllowed: this.isAllowed,
|
|
3405
3124
|
word: this.word,
|
|
3406
3125
|
};
|
|
3407
|
-
}
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
}());
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
WordDefinition.Null = Object.freeze({
|
|
3129
|
+
definitions: [],
|
|
3130
|
+
isAllowed: false,
|
|
3131
|
+
word: '',
|
|
3132
|
+
toJson: () => null,
|
|
3133
|
+
});
|
|
3416
3134
|
exports["default"] = WordDefinition;
|
|
3417
3135
|
|
|
3418
3136
|
|