@scrabble-solver/types 2.13.9 → 2.13.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Board.d.ts +1 -1
- package/build/Board.js +2 -2
- package/build/Config.d.ts +3 -4
- package/build/Config.js +7 -10
- package/build/ConfigJson.d.ts +3 -4
- package/build/Pattern.js +1 -1
- package/package.json +3 -3
- package/src/Board.ts +2 -2
- package/src/Config.ts +8 -12
- package/src/ConfigJson.ts +3 -4
- package/src/Pattern.ts +1 -1
package/build/Board.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BoardJson from './BoardJson';
|
|
2
2
|
import Cell from './Cell';
|
|
3
3
|
declare class Board {
|
|
4
|
-
static create(
|
|
4
|
+
static create(size: number): Board;
|
|
5
5
|
static fromJson(json: BoardJson): Board;
|
|
6
6
|
static fromStringArray(stringArray: string[]): Board;
|
|
7
7
|
readonly columnsCount: number;
|
package/build/Board.js
CHANGED
|
@@ -7,8 +7,8 @@ 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
|
-
static create(
|
|
11
|
-
return Board.fromStringArray(Array(
|
|
10
|
+
static create(size) {
|
|
11
|
+
return Board.fromStringArray(Array(size).fill(Array(size).fill(' ').join('')));
|
|
12
12
|
}
|
|
13
13
|
static fromJson(json) {
|
|
14
14
|
return new Board({
|
package/build/Config.d.ts
CHANGED
|
@@ -12,12 +12,11 @@ declare class Config {
|
|
|
12
12
|
readonly config: ConfigJson;
|
|
13
13
|
readonly pointsMap: Record<string, number>;
|
|
14
14
|
constructor(config: ConfigJson);
|
|
15
|
-
get allTilesBonusScore(): number;
|
|
16
15
|
get alphabet(): string[];
|
|
16
|
+
get bingoScore(): number;
|
|
17
17
|
get blankScore(): number;
|
|
18
18
|
get blanksCount(): number;
|
|
19
|
-
get
|
|
20
|
-
get boardWidth(): number;
|
|
19
|
+
get boardSize(): number;
|
|
21
20
|
get game(): Game;
|
|
22
21
|
get locale(): Locale;
|
|
23
22
|
get twoCharacterTiles(): string[];
|
|
@@ -28,7 +27,7 @@ declare class Config {
|
|
|
28
27
|
getTilePoints(tile: Tile | null): number | undefined;
|
|
29
28
|
hasCharacter(character: string): boolean;
|
|
30
29
|
isTwoCharacterTilePrefix(character: string): boolean;
|
|
31
|
-
get
|
|
30
|
+
get rackSize(): number;
|
|
32
31
|
get tiles(): TileConfig[];
|
|
33
32
|
toJson(): ConfigJson;
|
|
34
33
|
}
|
package/build/Config.js
CHANGED
|
@@ -15,23 +15,20 @@ class Config {
|
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.pointsMap = getPointsMap(this.config);
|
|
17
17
|
}
|
|
18
|
-
get allTilesBonusScore() {
|
|
19
|
-
return this.config.allTilesBonusScore;
|
|
20
|
-
}
|
|
21
18
|
get alphabet() {
|
|
22
19
|
return getAlphabet(this.config);
|
|
23
20
|
}
|
|
21
|
+
get bingoScore() {
|
|
22
|
+
return this.config.bingoScore;
|
|
23
|
+
}
|
|
24
24
|
get blankScore() {
|
|
25
25
|
return this.config.blankScore;
|
|
26
26
|
}
|
|
27
27
|
get blanksCount() {
|
|
28
28
|
return this.config.blanksCount;
|
|
29
29
|
}
|
|
30
|
-
get
|
|
31
|
-
return this.config.
|
|
32
|
-
}
|
|
33
|
-
get boardWidth() {
|
|
34
|
-
return this.config.boardWidth;
|
|
30
|
+
get boardSize() {
|
|
31
|
+
return this.config.boardSize;
|
|
35
32
|
}
|
|
36
33
|
get game() {
|
|
37
34
|
return this.config.game;
|
|
@@ -75,8 +72,8 @@ class Config {
|
|
|
75
72
|
isTwoCharacterTilePrefix(character) {
|
|
76
73
|
return typeof this.getTwoCharacterTileByPrefix(character) !== 'undefined';
|
|
77
74
|
}
|
|
78
|
-
get
|
|
79
|
-
return this.config.
|
|
75
|
+
get rackSize() {
|
|
76
|
+
return this.config.rackSize;
|
|
80
77
|
}
|
|
81
78
|
get tiles() {
|
|
82
79
|
return this.config.tiles;
|
package/build/ConfigJson.d.ts
CHANGED
|
@@ -3,16 +3,15 @@ import Game from './Game';
|
|
|
3
3
|
import Locale from './Locale';
|
|
4
4
|
import TileConfig from './TileConfig';
|
|
5
5
|
interface ConfigJson {
|
|
6
|
-
|
|
6
|
+
bingoScore: number;
|
|
7
7
|
blankScore: number;
|
|
8
8
|
blanksCount: number;
|
|
9
|
-
|
|
10
|
-
boardWidth: number;
|
|
9
|
+
boardSize: number;
|
|
11
10
|
bonuses: BonusJson[];
|
|
12
11
|
game: Game;
|
|
13
12
|
locale: Locale;
|
|
14
|
-
maximumCharactersCount: number;
|
|
15
13
|
name: string;
|
|
14
|
+
rackSize: number;
|
|
16
15
|
tiles: TileConfig[];
|
|
17
16
|
}
|
|
18
17
|
export default ConfigJson;
|
package/build/Pattern.js
CHANGED
|
@@ -7,7 +7,7 @@ class Pattern {
|
|
|
7
7
|
}
|
|
8
8
|
canBePlaced(config) {
|
|
9
9
|
const emptyCellsCount = this.getEmptyCellsCount();
|
|
10
|
-
const isUsedCellsCountInRange = emptyCellsCount >= 1 && emptyCellsCount <= config.
|
|
10
|
+
const isUsedCellsCountInRange = emptyCellsCount >= 1 && emptyCellsCount <= config.rackSize;
|
|
11
11
|
return (isUsedCellsCountInRange &&
|
|
12
12
|
(this.hasAtLeast1NonEmptyCell() || this.collides() || (this.goesThroughBoardCenter() && this.board.isEmpty())));
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/types",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.11",
|
|
4
4
|
"description": "Scrabble Solver 2 - Types",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rimraf build/"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@scrabble-solver/constants": "^2.13.
|
|
26
|
+
"@scrabble-solver/constants": "^2.13.11"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "1b418c5dadc1ff365839cd7825f57eb6d182a815"
|
|
29
29
|
}
|
package/src/Board.ts
CHANGED
|
@@ -5,8 +5,8 @@ import Cell from './Cell';
|
|
|
5
5
|
import Tile from './Tile';
|
|
6
6
|
|
|
7
7
|
class Board {
|
|
8
|
-
public static create(
|
|
9
|
-
return Board.fromStringArray(Array(
|
|
8
|
+
public static create(size: number): Board {
|
|
9
|
+
return Board.fromStringArray(Array(size).fill(Array(size).fill(' ').join('')));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
public static fromJson(json: BoardJson): Board {
|
package/src/Config.ts
CHANGED
|
@@ -28,14 +28,14 @@ class Config {
|
|
|
28
28
|
this.pointsMap = getPointsMap(this.config);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public get allTilesBonusScore(): number {
|
|
32
|
-
return this.config.allTilesBonusScore;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
31
|
public get alphabet(): string[] {
|
|
36
32
|
return getAlphabet(this.config);
|
|
37
33
|
}
|
|
38
34
|
|
|
35
|
+
public get bingoScore(): number {
|
|
36
|
+
return this.config.bingoScore;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
39
|
public get blankScore(): number {
|
|
40
40
|
return this.config.blankScore;
|
|
41
41
|
}
|
|
@@ -44,12 +44,8 @@ class Config {
|
|
|
44
44
|
return this.config.blanksCount;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
public get
|
|
48
|
-
return this.config.
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public get boardWidth(): number {
|
|
52
|
-
return this.config.boardWidth;
|
|
47
|
+
public get boardSize(): number {
|
|
48
|
+
return this.config.boardSize;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
public get game(): Game {
|
|
@@ -108,8 +104,8 @@ class Config {
|
|
|
108
104
|
return typeof this.getTwoCharacterTileByPrefix(character) !== 'undefined';
|
|
109
105
|
}
|
|
110
106
|
|
|
111
|
-
public get
|
|
112
|
-
return this.config.
|
|
107
|
+
public get rackSize(): number {
|
|
108
|
+
return this.config.rackSize;
|
|
113
109
|
}
|
|
114
110
|
|
|
115
111
|
public get tiles(): TileConfig[] {
|
package/src/ConfigJson.ts
CHANGED
|
@@ -4,16 +4,15 @@ import Locale from './Locale';
|
|
|
4
4
|
import TileConfig from './TileConfig';
|
|
5
5
|
|
|
6
6
|
interface ConfigJson {
|
|
7
|
-
|
|
7
|
+
bingoScore: number;
|
|
8
8
|
blankScore: number;
|
|
9
9
|
blanksCount: number;
|
|
10
|
-
|
|
11
|
-
boardWidth: number;
|
|
10
|
+
boardSize: number;
|
|
12
11
|
bonuses: BonusJson[];
|
|
13
12
|
game: Game;
|
|
14
13
|
locale: Locale;
|
|
15
|
-
maximumCharactersCount: number;
|
|
16
14
|
name: string;
|
|
15
|
+
rackSize: number;
|
|
17
16
|
tiles: TileConfig[];
|
|
18
17
|
}
|
|
19
18
|
|
package/src/Pattern.ts
CHANGED
|
@@ -15,7 +15,7 @@ class Pattern {
|
|
|
15
15
|
|
|
16
16
|
public canBePlaced(config: Config): boolean {
|
|
17
17
|
const emptyCellsCount = this.getEmptyCellsCount();
|
|
18
|
-
const isUsedCellsCountInRange = emptyCellsCount >= 1 && emptyCellsCount <= config.
|
|
18
|
+
const isUsedCellsCountInRange = emptyCellsCount >= 1 && emptyCellsCount <= config.rackSize;
|
|
19
19
|
return (
|
|
20
20
|
isUsedCellsCountInRange &&
|
|
21
21
|
(this.hasAtLeast1NonEmptyCell() || this.collides() || (this.goesThroughBoardCenter() && this.board.isEmpty()))
|