@fgv/ts-sudoku-lib 5.0.0-2 → 5.0.0-21

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.
Files changed (80) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/config/api-extractor.json +343 -0
  3. package/config/rig.json +16 -0
  4. package/dist/tsdoc-metadata.json +1 -1
  5. package/lib/test/unit/collections.test.d.ts +2 -0
  6. package/lib/test/unit/common/cell.test.d.ts +2 -0
  7. package/lib/test/unit/common/ids.test.d.ts +2 -0
  8. package/lib/test/unit/common/puzzle.test.d.ts +2 -0
  9. package/lib/test/unit/common/puzzleSession.test.d.ts +2 -0
  10. package/lib/test/unit/common/puzzleState.test.d.ts +2 -0
  11. package/lib/test/unit/puzzles/killerSudokuState.test.d.ts +2 -0
  12. package/package.json +14 -14
  13. package/src/index.ts +30 -0
  14. package/src/packlets/collections/collections.ts +124 -0
  15. package/src/packlets/collections/data/puzzles.json +61 -0
  16. package/src/packlets/collections/index.ts +25 -0
  17. package/src/packlets/common/cage.ts +98 -0
  18. package/src/packlets/common/cell.ts +116 -0
  19. package/src/packlets/common/common.ts +120 -0
  20. package/src/packlets/common/converters.ts +84 -0
  21. package/src/packlets/common/ids.ts +98 -0
  22. package/src/packlets/common/index.ts +37 -0
  23. package/src/packlets/common/model.ts +39 -0
  24. package/src/packlets/common/public.ts +100 -0
  25. package/src/packlets/common/puzzle.ts +523 -0
  26. package/src/packlets/common/puzzleSession.ts +415 -0
  27. package/src/packlets/common/puzzleState.ts +108 -0
  28. package/src/packlets/file/converters.ts +49 -0
  29. package/src/packlets/file/index.ts +28 -0
  30. package/src/packlets/file/model.ts +33 -0
  31. package/src/packlets/puzzles/anyPuzzle.ts +50 -0
  32. package/src/packlets/puzzles/index.ts +30 -0
  33. package/src/packlets/puzzles/killerSudokuPuzzle.ts +151 -0
  34. package/src/packlets/puzzles/sudokuPuzzle.ts +46 -0
  35. package/src/packlets/puzzles/sudokuXPuzzle.ts +67 -0
  36. package/CHANGELOG.md +0 -106
  37. package/lib/index.d.ts.map +0 -1
  38. package/lib/index.js.map +0 -1
  39. package/lib/packlets/collections/collections.d.ts.map +0 -1
  40. package/lib/packlets/collections/collections.js.map +0 -1
  41. package/lib/packlets/collections/index.d.ts.map +0 -1
  42. package/lib/packlets/collections/index.js.map +0 -1
  43. package/lib/packlets/common/cage.d.ts.map +0 -1
  44. package/lib/packlets/common/cage.js.map +0 -1
  45. package/lib/packlets/common/cell.d.ts.map +0 -1
  46. package/lib/packlets/common/cell.js.map +0 -1
  47. package/lib/packlets/common/common.d.ts.map +0 -1
  48. package/lib/packlets/common/common.js.map +0 -1
  49. package/lib/packlets/common/converters.d.ts.map +0 -1
  50. package/lib/packlets/common/converters.js.map +0 -1
  51. package/lib/packlets/common/ids.d.ts.map +0 -1
  52. package/lib/packlets/common/ids.js.map +0 -1
  53. package/lib/packlets/common/index.d.ts.map +0 -1
  54. package/lib/packlets/common/index.js.map +0 -1
  55. package/lib/packlets/common/model.d.ts.map +0 -1
  56. package/lib/packlets/common/model.js.map +0 -1
  57. package/lib/packlets/common/public.d.ts.map +0 -1
  58. package/lib/packlets/common/public.js.map +0 -1
  59. package/lib/packlets/common/puzzle.d.ts.map +0 -1
  60. package/lib/packlets/common/puzzle.js.map +0 -1
  61. package/lib/packlets/common/puzzleSession.d.ts.map +0 -1
  62. package/lib/packlets/common/puzzleSession.js.map +0 -1
  63. package/lib/packlets/common/puzzleState.d.ts.map +0 -1
  64. package/lib/packlets/common/puzzleState.js.map +0 -1
  65. package/lib/packlets/file/converters.d.ts.map +0 -1
  66. package/lib/packlets/file/converters.js.map +0 -1
  67. package/lib/packlets/file/index.d.ts.map +0 -1
  68. package/lib/packlets/file/index.js.map +0 -1
  69. package/lib/packlets/file/model.d.ts.map +0 -1
  70. package/lib/packlets/file/model.js.map +0 -1
  71. package/lib/packlets/puzzles/anyPuzzle.d.ts.map +0 -1
  72. package/lib/packlets/puzzles/anyPuzzle.js.map +0 -1
  73. package/lib/packlets/puzzles/index.d.ts.map +0 -1
  74. package/lib/packlets/puzzles/index.js.map +0 -1
  75. package/lib/packlets/puzzles/killerSudokuPuzzle.d.ts.map +0 -1
  76. package/lib/packlets/puzzles/killerSudokuPuzzle.js.map +0 -1
  77. package/lib/packlets/puzzles/sudokuPuzzle.d.ts.map +0 -1
  78. package/lib/packlets/puzzles/sudokuPuzzle.js.map +0 -1
  79. package/lib/packlets/puzzles/sudokuXPuzzle.d.ts.map +0 -1
  80. package/lib/packlets/puzzles/sudokuXPuzzle.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2023 Erik Fortune
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { AnyPuzzle as Any } from './anyPuzzle';
26
+ import { KillerSudokuPuzzle as Killer } from './killerSudokuPuzzle';
27
+ import { SudokuPuzzle as Sudoku } from './sudokuPuzzle';
28
+ import { SudokuXPuzzle as SudokuX } from './sudokuXPuzzle';
29
+
30
+ export { Any, Killer, Sudoku, SudokuX };
@@ -0,0 +1,151 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2023 Erik Fortune
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { Result, captureResult, fail, succeed } from '@fgv/ts-utils';
26
+ import { Cage, CageId, CellId, IPuzzleDescription, Ids, Puzzle, totalsByCageSize } from '../common';
27
+
28
+ const cageDefFormat: RegExp = /^[A-Za-z][0-9][0-9]$/;
29
+
30
+ /**
31
+ * @public
32
+ */
33
+ export class KillerSudokuPuzzle extends Puzzle {
34
+ private constructor(puzzle: IPuzzleDescription, cages: [CageId, Cage][]) {
35
+ super(puzzle, cages);
36
+ }
37
+
38
+ public static create(desc: IPuzzleDescription): Result<Puzzle> {
39
+ /* c8 ignore next 3 */
40
+ if (desc.type !== 'killer-sudoku') {
41
+ return fail(`Puzzle '${desc.description}' unsupported type ${desc.type}`);
42
+ }
43
+
44
+ return captureResult(() => {
45
+ const { cages, givens } = KillerSudokuPuzzle._getKillerCages(desc);
46
+ const cells = KillerSudokuPuzzle._getKillerCells(desc, givens);
47
+ return new KillerSudokuPuzzle({ ...desc, cells }, cages);
48
+ })
49
+ .onSuccess((puzzle) => {
50
+ return succeed(puzzle);
51
+ })
52
+ .onFailure((message) => {
53
+ return fail(`Failed to load killer puzzle "${desc.description}" - ${message}`);
54
+ });
55
+ }
56
+
57
+ private static _getKillerCages(puzzle: IPuzzleDescription): { cages: [CageId, Cage][]; givens: Cage[] } {
58
+ const decl = puzzle.cells.split('|');
59
+ if (decl.length !== 2) {
60
+ throw new Error(`malformed cells|cages "${puzzle.cells}"`);
61
+ }
62
+
63
+ const cageCells = KillerSudokuPuzzle._getCageCells(puzzle, decl[0]);
64
+ const allCages = KillerSudokuPuzzle._getCages(puzzle, cageCells, decl[1]);
65
+ const cages = allCages.filter(([__id, cage]) => cage.numCells > 1);
66
+ const givens = allCages.filter(([__id, cage]) => cage.numCells === 1).map(([__id, cage]) => cage);
67
+ return { cages, givens };
68
+ }
69
+
70
+ private static _getCageCells(puzzle: IPuzzleDescription, mappingDecl: string): Map<string, CellId[]> {
71
+ const cages: Map<string, CellId[]> = new Map();
72
+ const cageMapping = Array.from(mappingDecl);
73
+
74
+ if (cageMapping.length !== puzzle.rows * puzzle.cols) {
75
+ const expected = puzzle.rows * puzzle.cols;
76
+ const got = cageMapping.length;
77
+ throw new Error(`expected ${expected} cell mappings, found ${got}`);
78
+ }
79
+
80
+ for (let row = 0; row < puzzle.rows; row++) {
81
+ for (let col = 0; col < puzzle.cols; col++) {
82
+ const cage = cageMapping.shift()!;
83
+ const cell = Ids.cellId({ row, col }).orThrow();
84
+ const cells = cages.get(cage) ?? [];
85
+ cells.push(cell);
86
+ cages.set(cage, cells);
87
+ }
88
+ }
89
+
90
+ return cages;
91
+ }
92
+
93
+ private static _getCages(
94
+ __puzzle: IPuzzleDescription,
95
+ cageCells: Map<string, CellId[]>,
96
+ cagePart: string
97
+ ): [CageId, Cage][] {
98
+ const cages = new Map<CageId, Cage>();
99
+
100
+ const cageDefs = cagePart.split(',');
101
+ if (cageDefs.length !== cageCells.size) {
102
+ throw new Error(`expected ${cageCells.size} cage sizes, found ${cageDefs.length}`);
103
+ }
104
+
105
+ for (const def of cageDefs) {
106
+ if (!cageDefFormat.test(def)) {
107
+ throw new Error(`malformed cage spec ${def}`);
108
+ }
109
+ const cage = def.slice(0, 1);
110
+ const cageId = Ids.cageId(`K${cage}`).orThrow();
111
+
112
+ const total = Number.parseInt(def.slice(1));
113
+ const cells = cageCells.get(cage);
114
+ /* c8 ignore next 3 - should never happen */
115
+ if (!cells) {
116
+ throw new Error(`cage ${cageId} has no cells`);
117
+ }
118
+ if (cells.length < 1 || cells.length > 9) {
119
+ throw new Error(`invalid cell count ${cells.length} for cage ${cageId}`);
120
+ }
121
+ const { min, max } = totalsByCageSize[cells.length];
122
+ if (total < min || total > max) {
123
+ throw new Error(`invalid total ${total} for cage ${cageId} (expected ${min}..${max})`);
124
+ }
125
+
126
+ cages.set(cageId, Cage.create(cageId, 'killer', total, cells).orThrow());
127
+ }
128
+
129
+ return Array.from(cages.entries());
130
+ }
131
+
132
+ private static _getKillerCells(puzzle: IPuzzleDescription, givens: Cage[]): string {
133
+ const cells: string[] = [];
134
+ for (let row = 0; row < puzzle.rows; row++) {
135
+ for (let col = 0; col < puzzle.cols; col++) {
136
+ const cellId = Ids.cellId({ row, col }).orThrow();
137
+ const cage = givens.find((g) => g.cellIds[0] === cellId);
138
+ if (cage) {
139
+ /* c8 ignore next 3 - defense in depth should never happen */
140
+ if (cage.total < 1 || cage.total > 9) {
141
+ throw new Error(`invalid total ${cage.total} for cell ${cellId}`);
142
+ }
143
+ cells.push(String(cage.total));
144
+ } else {
145
+ cells.push('.');
146
+ }
147
+ }
148
+ }
149
+ return cells.join('');
150
+ }
151
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2023 Erik Fortune
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { Result, captureResult, fail, succeed } from '@fgv/ts-utils';
26
+ import { IPuzzleDescription, Puzzle } from '../common';
27
+
28
+ /**
29
+ * @public
30
+ */
31
+ export class SudokuPuzzle extends Puzzle {
32
+ private constructor(puzzle: IPuzzleDescription) {
33
+ super(puzzle);
34
+ }
35
+
36
+ public static create(puzzle: IPuzzleDescription): Result<Puzzle> {
37
+ /* c8 ignore next 3 */
38
+ if (puzzle.type !== 'sudoku') {
39
+ return fail(`Puzzle '${puzzle.description}' unsupported type ${puzzle.type}`);
40
+ }
41
+
42
+ return captureResult(() => new SudokuPuzzle(puzzle)).onSuccess((puzzle) => {
43
+ return succeed(puzzle);
44
+ });
45
+ }
46
+ }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2023 Erik Fortune
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { Result, captureResult, succeed } from '@fgv/ts-utils';
26
+ import { Cage, CageId, CellId, IPuzzleDescription, Ids, Puzzle } from '../common';
27
+
28
+ /**
29
+ * @public
30
+ */
31
+ export class SudokuXPuzzle extends Puzzle {
32
+ private constructor(puzzle: IPuzzleDescription, extraCages: [CageId, Cage][]) {
33
+ super(puzzle, extraCages);
34
+ }
35
+
36
+ public static create(puzzle: IPuzzleDescription): Result<Puzzle> {
37
+ /* c8 ignore next 3 */
38
+ if (puzzle.type !== 'sudoku-x') {
39
+ return fail(`Puzzle '${puzzle.description}' unsupported type ${puzzle.type}`);
40
+ }
41
+ return captureResult(() => {
42
+ return new SudokuXPuzzle(puzzle, SudokuXPuzzle._getXCages(puzzle));
43
+ }).onSuccess((puzzle) => {
44
+ return succeed(puzzle);
45
+ });
46
+ }
47
+
48
+ private static _getXCages(puzzle: IPuzzleDescription): [CageId, Cage][] {
49
+ const x1Cells: CellId[] = [];
50
+ const x2Cells: CellId[] = [];
51
+
52
+ for (let row = 0, col1 = 0, col2 = puzzle.cols - 1; row < puzzle.rows; row++, col1++, col2--) {
53
+ x1Cells.push(Ids.cellId({ row, col: col1 }).orThrow());
54
+ x2Cells.push(Ids.cellId({ row, col: col2 }).orThrow());
55
+ }
56
+
57
+ const x1Id = Ids.cageId('X1').orThrow();
58
+ const x2Id = Ids.cageId('X2').orThrow();
59
+
60
+ const x1 = Cage.create(x1Id, 'x', 45, x1Cells).orThrow();
61
+ const x2 = Cage.create(x2Id, 'x', 45, x2Cells).orThrow();
62
+ return [
63
+ [x1Id, x1],
64
+ [x2Id, x2]
65
+ ];
66
+ }
67
+ }
package/CHANGELOG.md DELETED
@@ -1,106 +0,0 @@
1
- # Change Log - @fgv/ts-sudoku-lib
2
-
3
- This log was last generated on Thu, 17 Jul 2025 00:13:24 GMT and should not be manually modified.
4
-
5
- ## 5.0.0
6
- Thu, 17 Jul 2025 00:13:24 GMT
7
-
8
- ### Updates
9
-
10
- - upgrade-dependencies
11
- - bump version
12
-
13
- ## 4.6.0
14
- Wed, 02 Jul 2025 05:48:16 GMT
15
-
16
- _Version update only_
17
-
18
- ## 4.5.1
19
- Wed, 02 Jul 2025 05:47:11 GMT
20
-
21
- ### Updates
22
-
23
- - update rushstack
24
-
25
- ## 4.5.0
26
- Tue, 01 Jul 2025 03:26:11 GMT
27
-
28
- ### Patches
29
-
30
- - Fix redundant conditional logic in updateCellValue and updateCellNotes methods that called identical functions in both branches of ternary operator
31
- - Fix incorrect TypeScript declaration file reference and build script in package.json
32
-
33
- ## 4.4.0
34
- Sat, 01 Feb 2025 17:13:10 GMT
35
-
36
- _Version update only_
37
-
38
- ## 4.3.0
39
- Thu, 30 Jan 2025 00:35:17 GMT
40
-
41
- _Version update only_
42
-
43
- ## 4.2.2
44
- Thu, 23 Jan 2025 06:19:32 GMT
45
-
46
- _Version update only_
47
-
48
- ## 4.2.1
49
- Tue, 21 Jan 2025 04:19:21 GMT
50
-
51
- _Version update only_
52
-
53
- ## 4.2.0
54
- Mon, 20 Jan 2025 09:46:53 GMT
55
-
56
- _Version update only_
57
-
58
- ## 4.1.0
59
- Thu, 09 Jan 2025 05:33:39 GMT
60
-
61
- ### Updates
62
-
63
- - update dependencies
64
-
65
- ## 4.0.2
66
- Tue, 14 May 2024 14:45:53 GMT
67
-
68
- _Version update only_
69
-
70
- ## 4.0.1
71
- Tue, 14 May 2024 05:02:20 GMT
72
-
73
- ### Updates
74
-
75
- - publish
76
-
77
- ## 4.0.0
78
- Tue, 14 May 2024 03:09:27 GMT
79
-
80
- ### Updates
81
-
82
- - update dependencies
83
- - update generated api docs
84
-
85
- ## 3.0.0
86
- Mon, 22 Jan 2024 07:00:18 GMT
87
-
88
- ### Updates
89
-
90
- - bump versions
91
- - refactor
92
- - initial checkin
93
- - Match ts-utils refactor
94
- - update dependencies
95
-
96
- ## 2.2.0
97
- Thu, 18 Jan 2024 05:45:04 GMT
98
-
99
- ### Updates
100
-
101
- - bump versions
102
- - refactor
103
- - initial checkin
104
- - Match ts-utils refactor
105
- - update dependencies
106
-
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAwC;AAK/B,oBAAI;AAJb,4DAA8C;AAI/B,0BAAO;AAFtB,yDAAuC;AACvC,oDAAkC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as File from './packlets/file';\nimport * as Puzzles from './packlets/puzzles';\n\nexport * from './packlets/collections';\nexport * from './packlets/common';\nexport { File, Puzzles };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/packlets/collections/collections.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAgC,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG9D;;;GAGG;AACH,qBAAa,gBAAgB;IAC3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,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC;iBAClC,OAAO,EAAE,CAAC;QACf,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;;AAdH,8CAeC;AAdgB,0BAAQ,GAAiC,SAAS,CAAC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as FileData from '../file';\nimport * as Puzzles from '../puzzles';\n\nimport { Result, captureResult, fail, succeed } from '@fgv/ts-utils';\n\nimport { IPuzzleDescription, PuzzleSession } from '../common';\nimport DefaultPuzzles from './data/puzzles.json';\n\n/**\n * A collection of puzzles of various types.\n * @public\n */\nexport class PuzzleCollection {\n /**\n * All puzzles in the collection.\n */\n public readonly puzzles: readonly IPuzzleDescription[];\n\n private readonly _byId: Map<string, IPuzzleDescription>;\n\n private constructor(puzzles: FileData.Model.IPuzzlesFile) {\n this.puzzles = puzzles.puzzles;\n this._byId = new Map(\n this.puzzles\n .map((p): [string | undefined, IPuzzleDescription] => [p.id, p])\n .filter((p): p is [string, IPuzzleDescription] => p !== undefined)\n );\n }\n\n /**\n * Creates a new puzzle from a loaded {@link File.Model.IPuzzlesFile | PuzzlesFile}\n * @param from - The {@link File.Model.IPuzzlesFile | puzzles file} to be loaded.\n * @returns `Success` with the resulting {@link PuzzleCollection | PuzzleCollection}\n * or `Failure` with details if an error occurs.\n */\n public static create(from: FileData.Model.IPuzzlesFile): Result<PuzzleCollection> {\n return captureResult(() => new PuzzleCollection(from));\n }\n\n /**\n * Creates a new puzzle from a JSON file.\n * @param path - path to the JSON file to be loaded.\n * @returns `Success` with the resulting {@link PuzzleCollection | PuzzleCollection}\n * or `Failure` with details if an error occurs.\n */\n public static load(path: string): Result<PuzzleCollection> {\n return FileData.Converters.loadJsonPuzzlesFileSync(path).onSuccess(PuzzleCollection.create);\n }\n\n /**\n * Gets a puzzle by id from this collection.\n * @param id - The string ID of the puzzle to be returned.\n * @returns `Success` with the requested {@link PuzzleSession | puzzle}, or\n * `Failure` with details if an error occurs.\n */\n public getPuzzle(id: string): Result<PuzzleSession> {\n return this.getDescription(id)\n .onSuccess((desc) => {\n return Puzzles.Any.create(desc);\n })\n .onSuccess((puzzle) => {\n return PuzzleSession.create(puzzle);\n });\n }\n\n /**\n * Gets a puzzle by id from this collection.\n * @param id - The string ID of the puzzle to be returned.\n * @returns `Success` with the requested {@link PuzzleSession | puzzle}, or\n * `Failure` with details if an error occurs.\n */\n public getDescription(id: string): Result<IPuzzleDescription> {\n const desc = this._byId.get(id);\n if (!desc) {\n return fail(`Puzzle \"${id}\" not found`);\n }\n return succeed(desc);\n }\n}\n\n/**\n * Get well-known {@link PuzzleCollection | puzzle collections}.\n * @public\n */\nexport class PuzzleCollections {\n private static _default: PuzzleCollection | undefined = undefined;\n\n /**\n * The default {@link PuzzleCollection | puzzle collection}.\n */\n public static get default(): PuzzleCollection {\n if (!PuzzleCollections._default) {\n PuzzleCollections._default = FileData.Converters.puzzlesFile\n .convert(DefaultPuzzles)\n .onSuccess(PuzzleCollection.create)\n .orThrow();\n }\n return PuzzleCollections._default;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/collections/index.ts"],"names":[],"mappings":"AAwBA,cAAc,eAAe,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/collections/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;AAEH,gDAA8B","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './collections';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cage.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/cage.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACtD,O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;QACjC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnC,8DAA8D;YAC9D,MAAM,KAAK,GAAG,MAAA,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,0CAAE,KAAK,CAAC;YAC/D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,QAAQ,CAAC,KAAmB;QACjC,OAAO,IAAI,CAAC,QAAQ;aACjB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;;YACV,8DAA8D;YAC9D,MAAM,KAAK,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,0CAAE,KAAK,CAAC;YAC5D,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACrC,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;CACF;AAjED,oBAiEC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, captureResult } from '@fgv/ts-utils';\nimport { CageId, CageType, CellId } from './common';\nimport { ICage } from './public';\nimport { PuzzleState } from './puzzleState';\n\n/**\n * @internal\n */\nexport class Cage implements ICage {\n public readonly id: CageId;\n public readonly cageType: CageType;\n public readonly total: number;\n\n protected readonly _cellIds: CellId[];\n private _values: Set<number>;\n\n private constructor(id: CageId, type: CageType, total: number, cells: CellId[]) {\n this.id = id;\n this.cageType = type;\n this.total = total;\n this._cellIds = Array.from(cells);\n this._values = new Set();\n }\n\n public get cellIds(): CellId[] {\n return Array.from(this._cellIds);\n }\n\n public get numCells(): number {\n return this._cellIds.length;\n }\n\n public static create(id: CageId, type: CageType, total: number, cells: CellId[]): Result<Cage> {\n return captureResult(() => new Cage(id, type, total, cells));\n }\n\n public containsCell(id: CellId): boolean {\n return this._cellIds.includes(id);\n }\n\n public containsValue(value: number, state: PuzzleState, ignore?: CellId[]): boolean {\n for (const cellId of this._cellIds) {\n if (!ignore?.includes(cellId)) {\n /* c8 ignore next - defense in depth, ? should never happen */\n if (state.getCellContents(cellId).orDefault()?.value === value) {\n return true;\n }\n }\n }\n return false;\n }\n\n public containedValues(state: PuzzleState): Set<number> {\n const values = new Set<number>();\n for (const cellId of this._cellIds) {\n /* c8 ignore next - defense in depth, ? should never happen */\n const value = state.getCellContents(cellId).orDefault()?.value;\n if (value !== undefined) {\n values.add(value);\n }\n }\n return values;\n }\n\n public toString(state?: PuzzleState): string {\n return this._cellIds\n .map((id) => {\n /* c8 ignore next - defense in depth, ? should never happen */\n const value = state?.getCellContents(id).orDefault()?.value;\n return value ? String(value) : '.';\n })\n .join('');\n }\n}\n"]}
@@ -1 +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AAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,QAAuB,EAAE,EAAE;YAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ,CAAC,KAAmB;;QACjC,MAAM,QAAQ,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAG,MAAA,IAAI,CAAC,cAAc,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAC;QACrD,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACjE,CAAC;CACF;AAxED,oBAwEC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, fail, succeed } from '@fgv/ts-utils';\nimport { Cage } from './cage';\nimport { CellId, ICellContents, ICellState } from './common';\nimport { ICell } from './public';\nimport { PuzzleState } from './puzzleState';\n\n/**\n * @internal\n */\nexport interface ICellInit {\n readonly id: CellId;\n readonly row: number;\n readonly col: number;\n readonly immutableValue?: number;\n}\n\n/**\n * @internal\n */\nexport class Cell implements ICellInit, ICell {\n public readonly id: CellId;\n public readonly row: number;\n public readonly col: number;\n public readonly cages: readonly Cage[];\n\n public readonly immutable: boolean;\n public readonly immutableValue?: number;\n\n public constructor(init: ICellInit, cages: readonly Cage[]) {\n this.id = init.id;\n this.row = init.row;\n this.col = init.col;\n this.cages = [...cages];\n this.immutableValue = init.immutableValue;\n this.immutable = init.immutableValue !== undefined;\n }\n\n public isValid(state: PuzzleState): boolean {\n if (this.immutable) {\n return true;\n }\n const cell = state.getCellContents(this.id).orDefault();\n return cell !== undefined && this.isValidValue(cell.value, state);\n }\n\n public hasValue(state: PuzzleState): boolean {\n if (this.immutable) {\n return true;\n }\n const cell = state.getCellContents(this.id).orDefault();\n /* c8 ignore next - defense in depth ? should never happen */\n return cell?.value !== undefined;\n }\n\n public isValidValue(value: number | undefined, state: PuzzleState): boolean {\n if (this.immutable) {\n return false;\n } else if (value === undefined) {\n return true;\n }\n return !this.cages.find((cage) => cage.containsValue(value, state, [this.id]));\n }\n\n public update(value: number | undefined, notes: number[]): Result<ICellState> {\n if (this.immutable) {\n return fail(`cannot set value \"${value}\" in immutable cell ${this.id}`);\n }\n return succeed({\n id: this.id,\n value,\n notes\n });\n }\n\n public updateValue(value: number | undefined, state: PuzzleState): Result<ICellState> {\n return state.getCellContents(this.id).onSuccess((contents: ICellContents) => {\n return this.update(value, contents.notes);\n });\n }\n\n public updateNotes(notes: number[], state: PuzzleState): Result<ICellState> {\n return state.getCellContents(this.id).onSuccess((contents: ICellContents) => {\n return this.update(contents.value, notes);\n });\n }\n\n public toString(state?: PuzzleState): string {\n const contents = state?.getCellContents(this.id).orDefault();\n const value = this.immutableValue ?? contents?.value;\n return value && value >= 1 && value <= 9 ? String(value) : '.';\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/common.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,GAAG,GAAG,QAAQ,CAAC;AAErE;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AAEH,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAAU,EAA4C,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAWnE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/packlets/common/common.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AA8DH;;;GAGG;AACU,QAAA,cAAc,GAAiB,CAAC,eAAe,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAEpF;;;;GAIG;AACU,QAAA,gBAAgB,GAA4C;IACvE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAClB,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAClB,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACnB,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACnB,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IACpB,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IACpB,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IACpB,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IACpB,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IACpB,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;CACrB,CAAC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Brand } from '@fgv/ts-utils';\n\n/**\n * Nominal identifier for a single {@Link ICell | cell} in a {@link PuzzleSession | puzzle}.\n * @public\n */\nexport type CellId = Brand<string, 'CellId'>;\n\n/**\n * Nominal identifier for a single {@Link ICage | cage} in a {@link PuzzleSession | puzzle}.\n * @public\n */\nexport type CageId = Brand<string, 'CageId'>;\n\n/**\n * Identifies the type of a {@Link ICage | cage}.\n * @public\n */\nexport type CageType = 'row' | 'column' | 'section' | 'x' | 'killer';\n\n/**\n * The row/column coordinate of a single {@Link ICell | cell} in a {@link PuzzleSession | puzzle}.\n * @public\n */\nexport interface IRowColumn {\n row: number;\n col: number;\n}\n\n/**\n * The contents of a single {@Link ICell | cell} in a {@link PuzzleSession | puzzle}.\n * @public\n */\nexport interface ICellContents {\n /**\n * The value of the {@link ICell | cell}, or `undefined` if no value has been assigned.\n */\n readonly value?: number;\n /**\n * Any notes associated with the {@link ICell | cell}.\n */\n readonly notes: number[];\n}\n\n/**\n * Describes the state of or a state update for a single {@link ICell |cell} in a\n * {@link PuzzleSession | puzzle}.\n * @public\n */\n\nexport interface ICellState extends ICellContents {\n readonly id: CellId;\n}\n\n/**\n * Describes the rules that apply to the puzzle.\n * @public\n */\nexport type PuzzleType = 'killer-sudoku' | 'sudoku' | 'sudoku-x';\n\n/**\n * All supported public types.\n * @public\n */\nexport const allPuzzleTypes: PuzzleType[] = ['killer-sudoku', 'sudoku', 'sudoku-x'];\n\n/**\n * The minimum and maximum possible values for a {@link ICage | cage}, by cage size in\n * {@link ICell | cells}.\n * @public\n */\nexport const totalsByCageSize: readonly { min: number; max: number }[] = [\n { min: 0, max: 0 },\n { min: 1, max: 9 },\n { min: 3, max: 17 },\n { min: 6, max: 24 },\n { min: 10, max: 30 },\n { min: 15, max: 35 },\n { min: 21, max: 39 },\n { min: 28, max: 42 },\n { min: 36, max: 44 },\n { min: 45, max: 45 }\n];\n\n/**\n * Navigation direction within a puzzle.\n * @public\n *\n */\nexport type NavigationDirection = 'down' | 'left' | 'right' | 'up';\n\n/**\n * Wrapping rules when navigating within a puzzle.\n * @public\n */\nexport type NavigationWrap = 'none' | 'wrap-around' | 'wrap-next';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/converters.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAqC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAmB7C;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,CAAC,MAAM,CAAyC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,CAAC,MAAM,CAAyC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,CAChC,UAAU,EACV,aAAa,CAAC,UAAU,CAAC,CAC+B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,kBAAkB,CAa3D,CAAC"}
@@ -1 +0,0 @@
1
- {"version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K,EAAE,qBAAU,CAAC,KAAK,CAAC,CAAC,qBAAU,CAAC,MAAM,EAAE,qBAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,kBAAO,EAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CACrG,EACD;IACE,cAAc,EAAE,CAAC,IAAI,CAAC;CACvB,CACF,CAAC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converter, Converters, Result, fail, succeed } from '@fgv/ts-utils';\nimport { CageId, CellId, PuzzleType, allPuzzleTypes } from './common';\nimport { IPuzzleDescription } from './model';\n\nconst cageIdRegExp: RegExp = /^(R[A-Z]$)|(C[0-9]$)|(S[A-Z][0-9]$)|(X[1-2]$)|(K[A-Za-z]$)/;\n\nfunction validateCageId(from: string): Result<CageId> {\n if (cageIdRegExp.test(from)) {\n return succeed(from as CageId);\n }\n return fail(`malformed cage ID \"${from}\" (expected \"R[A-Z]\", \"C[0-9]\" or \"S[A-Z][0-9]\")`);\n}\n\nconst cellIdRegExp: RegExp = /^[A-Z][0-9]$/;\nfunction validateCellId(from: string): Result<CellId> {\n if (cellIdRegExp.test(from)) {\n return succeed(from as CellId);\n }\n return fail(`malformed cell ID \"${from}\" (expected \"[A-Z][0-9]\")`);\n}\n\n/**\n * Converts an arbitrary value to a {@link CageId | CageId}.\n * @public\n */\nexport const cageId: Converter<CageId> = Converters.string.map(validateCageId);\n\n/**\n * Converts an arbitrary value to a {@link CellId | CellId}.\n * @public\n */\nexport const cellId: Converter<CellId> = Converters.string.map(validateCellId);\n\n/**\n * Converts an arbitrary value to a {@link PuzzleType | PuzzleType}.\n * @public\n */\nexport const puzzleType: Converter<\n PuzzleType,\n ReadonlyArray<PuzzleType>\n> = Converters.enumeratedValue<PuzzleType>(allPuzzleTypes);\n\n/**\n * Converts an arbitrary object to a {@link IPuzzleDescription | IPuzzleDescription}.\n * @public\n */\nexport const puzzleDescription: Converter<IPuzzleDescription> = Converters.strictObject<IPuzzleDescription>(\n {\n id: Converters.string,\n description: Converters.string,\n type: puzzleType,\n level: Converters.number,\n rows: Converters.number,\n cols: Converters.number,\n cells: Converters.oneOf([Converters.string, Converters.stringArray.map((s) => succeed(s.join('')))])\n },\n {\n optionalFields: ['id']\n }\n);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/ids.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AASxC;;GAEG;AACH,qBAAa,GAAG;WACA,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM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AE,CAAC;QAC7B,KAAK,IAAI,GAAG,GAAG,QAAQ,EAAE,GAAG,GAAG,QAAQ,GAAG,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;YACzD,KAAK,IAAI,GAAG,GAAG,QAAQ,EAAE,GAAG,GAAG,QAAQ,GAAG,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;gBACzD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE;oBACxD,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACjB,OAAO,IAAA,kBAAO,EAAC,EAAE,CAAC,CAAC;gBACrB,CAAC,CAAC,CAAC;gBAEH,2DAA2D;gBAC3D,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;oBACvB,OAAO,IAAA,eAAI,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAA,kBAAO,EAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF;AA1DD,kBA0DC","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, fail, succeed } from '@fgv/ts-utils';\nimport { CageId, CellId, IRowColumn } from './common';\nimport * as Converters from './converters';\nimport { ICage, ICell } from './public';\n\nconst firstRowIdChar: number = 'A'.charCodeAt(0);\nconst firstColIdChar: number = '1'.charCodeAt(0);\n\nfunction isRowColumn(from: unknown): from is IRowColumn {\n return typeof from === 'object' && from !== null && 'row' in from && `col` in from;\n}\n\n/**\n * @public\n */\nexport class Ids {\n public static cageId(from: string | ICage): Result<CageId> {\n if (typeof from === 'string') {\n return Converters.cageId.convert(from);\n }\n return succeed(from.id);\n }\n\n public static cellId(spec: string | IRowColumn | ICell): Result<CellId> {\n if (isRowColumn(spec)) {\n if ('id' in spec) {\n return succeed(spec.id);\n }\n const row = String.fromCharCode(firstRowIdChar + spec.row);\n const col = String.fromCharCode(firstColIdChar + spec.col);\n return succeed(`${row}${col}` as CellId);\n }\n return Converters.cellId.convert(spec);\n }\n\n public static rowCageId(row: number): CageId {\n return `R${String.fromCharCode(firstRowIdChar + row)}` as CageId;\n }\n\n public static columnCageId(col: number): CageId {\n return `C${String.fromCharCode(firstColIdChar + col)}` as CageId;\n }\n\n public static sectionCageId(row: number, col: number): CageId {\n row = Math.floor(row / 3) * 3;\n col = Math.floor(col / 3) * 3;\n return `S${String.fromCharCode(firstRowIdChar + row)}${String.fromCharCode(\n firstColIdChar + col\n )}` as CageId;\n }\n\n public static cellIds(\n firstRow: number,\n numRows: number,\n firstCol: number,\n numCols: number\n ): Result<CellId[]> {\n const cellIds: CellId[] = [];\n for (let row = firstRow; row < firstRow + numRows; row++) {\n for (let col = firstCol; col < firstCol + numCols; col++) {\n const result = this.cellId({ row, col }).onSuccess((id) => {\n cellIds.push(id);\n return succeed(id);\n });\n\n /* c8 ignore next 3 - defense in depth should not happen */\n if (result.isFailure()) {\n return fail(result.message);\n }\n }\n }\n return succeed(cellIds);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/common/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAA2C;AAYlC,gCAAU;AAVnB,yCAAuB;AACvB,yCAAuB;AACvB,2CAAyB;AACzB,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,gDAA8B","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Converters from './converters';\n\nexport * from './cage';\nexport * from './cell';\nexport * from './common';\nexport { Ids } from './ids';\nexport * from './model';\nexport * from './public';\nexport * from './puzzle';\nexport * from './puzzleSession';\nexport * from './puzzleState';\n\nexport { Converters };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/model.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/packlets/common/model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { PuzzleType } from './common';\n\n/**\n * Description of a single puzzle.\n * @public\n */\nexport interface IPuzzleDescription {\n id?: string;\n description: string;\n type: PuzzleType;\n level: number;\n rows: number;\n cols: number;\n cells: string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/public.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/packlets/common/public.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG","sourcesContent":["/*\n * MIT License\n *\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { CageId, CageType, CellId } from './common';\n\n/**\n * Describes the structure of a single cage in a {@link PuzzleSession | puzzle}.\n * Does not describe state.\n * @public\n */\nexport interface ICage {\n /**\n * Unique identifier for the cage.\n */\n readonly id: CageId;\n\n /**\n * The {@link CageType | type} of the cage.\n */\n readonly cageType: CageType;\n\n /**\n * The expected sum of all cells in the cage.\n */\n readonly total: number;\n\n /**\n * The number of cells in the cage.\n */\n readonly numCells: number;\n\n /**\n * The identity of each cell in the cage.\n */\n readonly cellIds: CellId[];\n\n /**\n * Determines if a supplied cell is present in the cage.\n * @param id - the identifier to be searched.\n */\n containsCell(id: CellId): boolean;\n}\n\n/**\n * Describes the structure of a single cell in a {@link PuzzleSession | puzzle}.\n * Does not describe state.\n * @public\n */\nexport interface ICell {\n /**\n * Unique identifier for the cell.\n */\n readonly id: CellId;\n\n /**\n * Row number of the cell.\n */\n readonly row: number;\n\n /**\n * Column number of the cell.\n */\n readonly col: number;\n\n /**\n * All of the {@Link ICage | cages} to which this cell belongs.\n */\n readonly cages: readonly ICage[];\n\n /**\n * Indicates whether this cell is a given value (immutable).\n */\n readonly immutable: boolean;\n\n /**\n * Given value of this cell, or `undefined` if the cell is not immutable.\n */\n readonly immutableValue?: number;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"puzzle.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/puzzle.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAA6B,MAAM,eAAe,CAAC;AAClE,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CA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