@scrabble-solver/types 2.10.0 → 2.10.2
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/build/Board.js +5 -5
- package/build/BoardJson.d.ts +1 -1
- package/build/Cell.js +7 -7
- package/build/Collision.d.ts +1 -1
- package/build/CollisionJson.d.ts +1 -1
- package/build/Config.js +3 -3
- package/build/Result.d.ts +1 -1
- package/build/Result.js +8 -8
- package/build/Tile.js +4 -4
- package/build/WordDefinition.js +6 -6
- package/package.json +3 -3
package/build/Board.js
CHANGED
|
@@ -7,11 +7,6 @@ const constants_1 = require("@scrabble-solver/constants");
|
|
|
7
7
|
const Cell_1 = __importDefault(require("./Cell"));
|
|
8
8
|
const Tile_1 = __importDefault(require("./Tile"));
|
|
9
9
|
class Board {
|
|
10
|
-
constructor({ rows }) {
|
|
11
|
-
this.rows = rows;
|
|
12
|
-
this.columnsCount = rows[0].length;
|
|
13
|
-
this.rowsCount = rows.length;
|
|
14
|
-
}
|
|
15
10
|
static create(width, height) {
|
|
16
11
|
return Board.fromStringArray(Array(height).fill(Array(width).fill(' ').join('')));
|
|
17
12
|
}
|
|
@@ -30,6 +25,11 @@ class Board {
|
|
|
30
25
|
}))),
|
|
31
26
|
});
|
|
32
27
|
}
|
|
28
|
+
constructor({ rows }) {
|
|
29
|
+
this.rows = rows;
|
|
30
|
+
this.columnsCount = rows[0].length;
|
|
31
|
+
this.rowsCount = rows.length;
|
|
32
|
+
}
|
|
33
33
|
get center() {
|
|
34
34
|
const x = Math.floor(this.columnsCount / 2);
|
|
35
35
|
const y = Math.floor(this.rowsCount / 2);
|
package/build/BoardJson.d.ts
CHANGED
package/build/Cell.js
CHANGED
|
@@ -5,13 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Tile_1 = __importDefault(require("./Tile"));
|
|
7
7
|
class Cell {
|
|
8
|
-
// eslint-disable-next-line no-undef
|
|
9
|
-
constructor({ isEmpty = true, tile = Tile_1.default.Null, x, y }) {
|
|
10
|
-
this.isEmpty = isEmpty;
|
|
11
|
-
this.tile = tile;
|
|
12
|
-
this.x = x;
|
|
13
|
-
this.y = y;
|
|
14
|
-
}
|
|
15
8
|
static fromJson(json) {
|
|
16
9
|
return new Cell({
|
|
17
10
|
isEmpty: json.isEmpty,
|
|
@@ -20,6 +13,13 @@ class Cell {
|
|
|
20
13
|
y: json.y,
|
|
21
14
|
});
|
|
22
15
|
}
|
|
16
|
+
// eslint-disable-next-line no-undef
|
|
17
|
+
constructor({ isEmpty = true, tile = Tile_1.default.Null, x, y }) {
|
|
18
|
+
this.isEmpty = isEmpty;
|
|
19
|
+
this.tile = tile;
|
|
20
|
+
this.x = x;
|
|
21
|
+
this.y = y;
|
|
22
|
+
}
|
|
23
23
|
clone() {
|
|
24
24
|
return new Cell({
|
|
25
25
|
isEmpty: this.isEmpty,
|
package/build/Collision.d.ts
CHANGED
package/build/CollisionJson.d.ts
CHANGED
package/build/Config.js
CHANGED
|
@@ -7,14 +7,14 @@ const constants_1 = require("@scrabble-solver/constants");
|
|
|
7
7
|
const CharacterBonus_1 = __importDefault(require("./CharacterBonus"));
|
|
8
8
|
const WordBonus_1 = __importDefault(require("./WordBonus"));
|
|
9
9
|
class Config {
|
|
10
|
+
static fromJson(json) {
|
|
11
|
+
return new Config(json);
|
|
12
|
+
}
|
|
10
13
|
constructor(config) {
|
|
11
14
|
this.bonuses = getBonuses(config);
|
|
12
15
|
this.config = config;
|
|
13
16
|
this.pointsMap = getPointsMap(this.config);
|
|
14
17
|
}
|
|
15
|
-
static fromJson(json) {
|
|
16
|
-
return new Config(json);
|
|
17
|
-
}
|
|
18
18
|
get allTilesBonusScore() {
|
|
19
19
|
return this.config.allTilesBonusScore;
|
|
20
20
|
}
|
package/build/Result.d.ts
CHANGED
package/build/Result.js
CHANGED
|
@@ -6,6 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const constants_1 = require("@scrabble-solver/constants");
|
|
7
7
|
const Cell_1 = __importDefault(require("./Cell"));
|
|
8
8
|
class Result {
|
|
9
|
+
static fromJson(json) {
|
|
10
|
+
return new Result({
|
|
11
|
+
id: json.id,
|
|
12
|
+
cells: json.cells.map(Cell_1.default.fromJson),
|
|
13
|
+
collisions: json.collisions.map((collision) => collision.map(Cell_1.default.fromJson)),
|
|
14
|
+
points: json.points,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
9
17
|
constructor({ cells, id, collisions, points, }) {
|
|
10
18
|
const tiles = getTiles(cells);
|
|
11
19
|
this.blanksCount = getBlanks(tiles).length;
|
|
@@ -23,14 +31,6 @@ class Result {
|
|
|
23
31
|
this.words = getWords(cells, collisions);
|
|
24
32
|
this.wordsCount = 1 + this.collisions.length;
|
|
25
33
|
}
|
|
26
|
-
static fromJson(json) {
|
|
27
|
-
return new Result({
|
|
28
|
-
id: json.id,
|
|
29
|
-
cells: json.cells.map(Cell_1.default.fromJson),
|
|
30
|
-
collisions: json.collisions.map((collision) => collision.map(Cell_1.default.fromJson)),
|
|
31
|
-
points: json.points,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
34
|
toJson() {
|
|
35
35
|
return {
|
|
36
36
|
cells: this.cells.map((cell) => cell.toJson()),
|
package/build/Tile.js
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const constants_1 = require("@scrabble-solver/constants");
|
|
4
4
|
class Tile {
|
|
5
|
-
constructor({ character, isBlank = false }) {
|
|
6
|
-
this.character = character;
|
|
7
|
-
this.isBlank = isBlank;
|
|
8
|
-
}
|
|
9
5
|
static fromJson(json) {
|
|
10
6
|
if (!json) {
|
|
11
7
|
return Tile.Null;
|
|
@@ -15,6 +11,10 @@ class Tile {
|
|
|
15
11
|
isBlank: json.isBlank,
|
|
16
12
|
});
|
|
17
13
|
}
|
|
14
|
+
constructor({ character, isBlank = false }) {
|
|
15
|
+
this.character = character;
|
|
16
|
+
this.isBlank = isBlank;
|
|
17
|
+
}
|
|
18
18
|
clone() {
|
|
19
19
|
return new Tile({
|
|
20
20
|
character: this.character,
|
package/build/WordDefinition.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class WordDefinition {
|
|
4
|
-
constructor({ definitions, exists, isAllowed, word }) {
|
|
5
|
-
this.definitions = definitions;
|
|
6
|
-
this.exists = exists;
|
|
7
|
-
this.isAllowed = isAllowed;
|
|
8
|
-
this.word = word;
|
|
9
|
-
}
|
|
10
4
|
static fromJson(json) {
|
|
11
5
|
if (!json) {
|
|
12
6
|
return WordDefinition.Null;
|
|
@@ -18,6 +12,12 @@ class WordDefinition {
|
|
|
18
12
|
word: json.word,
|
|
19
13
|
});
|
|
20
14
|
}
|
|
15
|
+
constructor({ definitions, exists, isAllowed, word }) {
|
|
16
|
+
this.definitions = definitions;
|
|
17
|
+
this.exists = exists;
|
|
18
|
+
this.isAllowed = isAllowed;
|
|
19
|
+
this.word = word;
|
|
20
|
+
}
|
|
21
21
|
toJson() {
|
|
22
22
|
return {
|
|
23
23
|
definitions: this.definitions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/types",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "Scrabble Solver 2 - Types",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"clean:force": "npm run clean && rimraf package-lock.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@scrabble-solver/constants": "^2.10.
|
|
27
|
+
"@scrabble-solver/constants": "^2.10.2"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "4feaabfad2a10079c28e04f446c98dbf0383d520"
|
|
30
30
|
}
|