@weshell/chess.js 0.0.0-stage → 1.0.0

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 (51) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +87 -2
  3. package/dist/attack.d.ts +32 -0
  4. package/dist/attack.d.ts.map +1 -0
  5. package/dist/attack.js +103 -0
  6. package/dist/attack.js.map +1 -0
  7. package/dist/board.d.ts +33 -0
  8. package/dist/board.d.ts.map +1 -0
  9. package/dist/board.js +49 -0
  10. package/dist/board.js.map +1 -0
  11. package/dist/chess.d.ts +232 -0
  12. package/dist/chess.d.ts.map +1 -0
  13. package/dist/chess.js +1335 -0
  14. package/dist/chess.js.map +1 -0
  15. package/dist/fen.d.ts +38 -0
  16. package/dist/fen.d.ts.map +1 -0
  17. package/dist/fen.js +308 -0
  18. package/dist/fen.js.map +1 -0
  19. package/dist/hash.d.ts +34 -0
  20. package/dist/hash.d.ts.map +1 -0
  21. package/dist/hash.js +98 -0
  22. package/dist/hash.js.map +1 -0
  23. package/dist/index.d.ts +3 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +2 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/move.d.ts +55 -0
  28. package/dist/move.d.ts.map +1 -0
  29. package/dist/move.js +79 -0
  30. package/dist/move.js.map +1 -0
  31. package/dist/movegen.d.ts +34 -0
  32. package/dist/movegen.d.ts.map +1 -0
  33. package/dist/movegen.js +242 -0
  34. package/dist/movegen.js.map +1 -0
  35. package/dist/node.d.ts +8 -0
  36. package/dist/node.d.ts.map +1 -0
  37. package/dist/node.js +2 -0
  38. package/dist/node.js.map +1 -0
  39. package/dist/notation.d.ts +33 -0
  40. package/dist/notation.d.ts.map +1 -0
  41. package/dist/notation.js +257 -0
  42. package/dist/notation.js.map +1 -0
  43. package/dist/pgn.d.ts +12 -0
  44. package/dist/pgn.d.ts.map +1 -0
  45. package/dist/pgn.js +1347 -0
  46. package/dist/pgn.js.map +1 -0
  47. package/dist/types.d.ts +118 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/types.js +237 -0
  50. package/dist/types.js.map +1 -0
  51. package/package.json +45 -4
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23
+ POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,88 @@
1
- # Temporary Holding Version
1
+ # @weshell/chess.js
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A fork of [chess.js](https://github.com/jhlywa/chess.js) (based on v1.4.0) with
4
+ **Chess960 / Fischer Random** support.
5
+
6
+ - Load and play Chess960 positions via X-FEN / Shredder-FEN castling rights,
7
+ e.g. `bbqnnrkr/pppppppp/8/8/8/8/PPPPPPPP/BBQNNRKR w KQkq - 0 1`
8
+ - Chess960 castling with the standard fixed destinations (`g1`/`c1` for the
9
+ king, `f1`/`d1` for the rook) from any starting array
10
+ - **King-takes-rook move input** — `chess.move({ from: 'g1', to: 'h1' })`
11
+ castles (the lichess-style 960 drag encoding)
12
+ - **Stationary-king castling** — a king that already stands on its destination
13
+ square can still castle, via SAN or by dragging onto the rook
14
+ - Everything else from chess.js v1.4.0: SAN, FEN, PGN load/save, verbose
15
+ moves, perft, undo/redo history
16
+
17
+ ## Install
18
+
19
+ ```
20
+ npm install @weshell/chess.js
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```js
26
+ import { Chess } from '@weshell/chess.js'
27
+
28
+ // standard chess
29
+ const chess = new Chess()
30
+ chess.move('e4')
31
+ chess.pgn()
32
+
33
+ // Chess960 (Fischer Random)
34
+ const frc = new Chess('bbqnnrkr/pppppppp/8/8/8/8/PPPPPPPP/BBQNNRKR w KQkq - 0 1')
35
+ frc.move('f4')
36
+ frc.move('O-O') // 960 castling works from any starting array
37
+ ```
38
+
39
+ ## Chess960 notes
40
+
41
+ - **FEN castling field**: `K`/`Q` (and lowercase) refer to the outermost rook
42
+ on each side of the king, matching X-FEN. Shredder-style file letters
43
+ (`Hh`, `Fa`, …) are also accepted on input; output always uses the
44
+ outermost-rook letters.
45
+ - **Castling move objects** carry `rookFrom` in addition to `from` / `to`,
46
+ where `to` is the king's destination square. When the king already stands
47
+ on its destination, `from === to`; the rook's destination is the standard
48
+ `f1`/`d1`.
49
+ - **King-takes-rook**: passing the rook's square as `to` performs the castle.
50
+
51
+ ## Differences from upstream chess.js
52
+
53
+ - `movegen.ts`: Chess960-aware castling generation (rook squares derived from
54
+ the board, not hardcoded `a1`/`h1`)
55
+ - `fen.ts`: X-FEN / Shredder-FEN castling-rights parsing and serialization
56
+ - `move.ts`: `Move` exposes `rookFrom`
57
+ - `chess.ts`: `move()` accepts the king-takes-rook encoding as a fallback
58
+
59
+ The public API is otherwise unchanged; see the
60
+ [chess.js README](https://github.com/jhlywa/chess.js#api) for the full API.
61
+
62
+ ## Development
63
+
64
+ ```
65
+ npm run build # tsc -> dist/
66
+ npm test # node test/smoke.mjs (requires build first)
67
+ ```
68
+
69
+ Module layout under `src/`:
70
+
71
+ | Module | Purpose |
72
+ | ----------- | ------------------------------------------------------ |
73
+ | `types.ts` | constants and type definitions (0x88 board, move flags) |
74
+ | `board.ts` | 0x88 square helpers (rank/file/algebraic/swapColor) |
75
+ | `hash.ts` | zobrist hashing (xoroshiro128 key stream) |
76
+ | `attack.ts` | attack detection (pure functions over the board) |
77
+ | `movegen.ts`| pseudo-legal move generation incl. Chess960 castling |
78
+ | `fen.ts` | FEN validation/serialization + castling field parse/emit|
79
+ | `notation.ts`| SAN generation/parsing (pure helpers) |
80
+ | `move.ts` | the public `Move` class |
81
+ | `chess.ts` | the stateful `Chess` class (public API) |
82
+ | `pgn.js` | Peggy-generated PGN parser (from `pgn.peggy`) |
83
+ | `node.ts` | PGN variation-tree node type |
84
+
85
+ ## License
86
+
87
+ BSD-2-Clause — see [LICENSE](LICENSE). Based on
88
+ [chess.js](https://github.com/jhlywa/chess.js) by Jeff Hlywa.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ * POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+ import type { Color, Piece, Square } from './types.js';
28
+ export declare function attacked(board: Piece[], color: Color, square: number): boolean;
29
+ export declare function attacked(board: Piece[], color: Color, square: number, verbose: false): boolean;
30
+ export declare function attacked(board: Piece[], color: Color, square: number, verbose: true): Square[];
31
+ export declare function isKingAttacked(board: Piece[], kings: Record<Color, number>, color: Color): boolean;
32
+ //# sourceMappingURL=attack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attack.d.ts","sourceRoot":"","sources":["../src/attack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAItD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EAAE,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAA;AACV,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EAAE,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,KAAK,GACb,OAAO,CAAA;AACV,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EAAE,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,GACZ,MAAM,EAAE,CAAA;AAqFX,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAC5B,KAAK,EAAE,KAAK,GACX,OAAO,CAGT"}
package/dist/attack.js ADDED
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ * POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+ import { ATTACKS, Ox88, PAWN, PIECE_MASKS, RAYS } from './types.js';
28
+ import { algebraic, swapColor } from './board.js';
29
+ export function attacked(board, color, square, verbose) {
30
+ const attackers = [];
31
+ for (let i = Ox88.a8; i <= Ox88.h1; i++) {
32
+ // did we run off the end of the board
33
+ if (i & 0x88) {
34
+ i += 7;
35
+ continue;
36
+ }
37
+ // if empty square or wrong color
38
+ if (board[i] === undefined || board[i].color !== color) {
39
+ continue;
40
+ }
41
+ const piece = board[i];
42
+ const difference = i - square;
43
+ // skip - to/from square are the same
44
+ if (difference === 0) {
45
+ continue;
46
+ }
47
+ const index = difference + 119;
48
+ if (ATTACKS[index] & PIECE_MASKS[piece.type]) {
49
+ if (piece.type === PAWN) {
50
+ if ((difference > 0 && piece.color === 'w') ||
51
+ (difference <= 0 && piece.color === 'b')) {
52
+ if (!verbose) {
53
+ return true;
54
+ }
55
+ else {
56
+ attackers.push(algebraic(i));
57
+ }
58
+ }
59
+ continue;
60
+ }
61
+ // if the piece is a knight or a king
62
+ if (piece.type === 'n' || piece.type === 'k') {
63
+ if (!verbose) {
64
+ return true;
65
+ }
66
+ else {
67
+ attackers.push(algebraic(i));
68
+ continue;
69
+ }
70
+ }
71
+ const offset = RAYS[index];
72
+ let j = i + offset;
73
+ let blocked = false;
74
+ while (j !== square) {
75
+ if (board[j] != null) {
76
+ blocked = true;
77
+ break;
78
+ }
79
+ j += offset;
80
+ }
81
+ if (!blocked) {
82
+ if (!verbose) {
83
+ return true;
84
+ }
85
+ else {
86
+ attackers.push(algebraic(i));
87
+ continue;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ if (verbose) {
93
+ return attackers;
94
+ }
95
+ else {
96
+ return false;
97
+ }
98
+ }
99
+ export function isKingAttacked(board, kings, color) {
100
+ const square = kings[color];
101
+ return square === -1 ? false : attacked(board, swapColor(color), square);
102
+ }
103
+ //# sourceMappingURL=attack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attack.js","sourceRoot":"","sources":["../src/attack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAmBjD,MAAM,UAAU,QAAQ,CACtB,KAAc,EACd,KAAY,EACZ,MAAc,EACd,OAAiB;IAEjB,MAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,sCAAsC;QACtC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;YACb,CAAC,IAAI,CAAC,CAAA;YACN,SAAQ;QACV,CAAC;QAED,iCAAiC;QACjC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YACvD,SAAQ;QACV,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACtB,MAAM,UAAU,GAAG,CAAC,GAAG,MAAM,CAAA;QAE7B,qCAAqC;QACrC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;YACrB,SAAQ;QACV,CAAC;QAED,MAAM,KAAK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AAO,EAAE,CAAC;oBACb,OAAO,IAAI,CAAA;gBACb,CAAC;qBAAM,CAAC;oBACN,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC5B,SAAQ;gBACV,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,SAAS,CAAA;IAClB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,KAAc,EACd,KAA4B,EAC5B,KAAY;IAEZ,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAA;AAC1E,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ * POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+ import type { Color, Square } from './types.js';
28
+ export declare function rank(square: number): number;
29
+ export declare function file(square: number): number;
30
+ export declare function isDigit(c: string): boolean;
31
+ export declare function algebraic(square: number): Square;
32
+ export declare function swapColor(color: Color): Color;
33
+ //# sourceMappingURL=board.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAI/C,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3C;AAGD,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE1C;AAGD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE7C"}
package/dist/board.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ * POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+ import { BLACK, WHITE } from './types.js';
28
+ // Extracts the zero-based rank of an 0x88 square.
29
+ export function rank(square) {
30
+ return square >> 4;
31
+ }
32
+ // Extracts the zero-based file of an 0x88 square.
33
+ export function file(square) {
34
+ return square & 0xf;
35
+ }
36
+ export function isDigit(c) {
37
+ return '0123456789'.indexOf(c) !== -1;
38
+ }
39
+ // Converts a 0x88 square to algebraic notation.
40
+ export function algebraic(square) {
41
+ const f = file(square);
42
+ const r = rank(square);
43
+ return ('abcdefgh'.substring(f, f + 1) +
44
+ '87654321'.substring(r, r + 1));
45
+ }
46
+ export function swapColor(color) {
47
+ return color === WHITE ? BLACK : WHITE;
48
+ }
49
+ //# sourceMappingURL=board.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board.js","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEzC,kDAAkD;AAClD,MAAM,UAAU,IAAI,CAAC,MAAc;IACjC,OAAO,MAAM,IAAI,CAAC,CAAA;AACpB,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,IAAI,CAAC,MAAc;IACjC,OAAO,MAAM,GAAG,GAAG,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;AACvC,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IACtB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IACtB,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QACpC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAW,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAY;IACpC,OAAO,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACxC,CAAC"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ * POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+ import type { Color, Piece, PieceSymbol, Square } from './types.js';
28
+ import { KING, QUEEN } from './types.js';
29
+ import { Move } from './move.js';
30
+ export { WHITE, BLACK, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING, DEFAULT_POSITION, SQUARES, SEVEN_TAG_ROSTER, } from './types.js';
31
+ export type { Color, PieceSymbol, Square, Piece } from './types.js';
32
+ export { xoroshiro128 } from './hash.js';
33
+ export { validateFen } from './fen.js';
34
+ export { Move } from './move.js';
35
+ export declare class Chess {
36
+ private _board;
37
+ private _turn;
38
+ private _header;
39
+ private _kings;
40
+ private _epSquare;
41
+ private _halfMoves;
42
+ private _moveNumber;
43
+ private _history;
44
+ private _comments;
45
+ private _castling;
46
+ private _castlingRooks;
47
+ private _hash;
48
+ private _positionCount;
49
+ constructor(fen?: string, { skipValidation }?: {
50
+ skipValidation?: boolean | undefined;
51
+ });
52
+ clear({ preserveHeaders }?: {
53
+ preserveHeaders?: boolean | undefined;
54
+ }): void;
55
+ load(fen: string, { skipValidation, preserveHeaders }?: {
56
+ skipValidation?: boolean | undefined;
57
+ preserveHeaders?: boolean | undefined;
58
+ }): void;
59
+ private _loadCastling;
60
+ fen({ forceEnpassantSquare, }?: {
61
+ forceEnpassantSquare?: boolean;
62
+ }): string;
63
+ private _pieceKey;
64
+ private _epKey;
65
+ private _castlingKey;
66
+ private _computeHash;
67
+ private _updateSetup;
68
+ reset(): void;
69
+ get(square: Square): Piece | undefined;
70
+ findPiece(piece: Piece): Square[];
71
+ put({ type, color }: {
72
+ type: PieceSymbol;
73
+ color: Color;
74
+ }, square: Square): boolean;
75
+ private _set;
76
+ private _put;
77
+ private _clear;
78
+ remove(square: Square): Piece | undefined;
79
+ private _updateCastlingRights;
80
+ private _updateEnPassantSquare;
81
+ attackers(square: Square, attackedBy?: Color): Square[];
82
+ private _isKingAttacked;
83
+ hash(): string;
84
+ isAttacked(square: Square, attackedBy: Color): boolean;
85
+ isCheck(): boolean;
86
+ inCheck(): boolean;
87
+ isCheckmate(): boolean;
88
+ isStalemate(): boolean;
89
+ isInsufficientMaterial(): boolean;
90
+ isThreefoldRepetition(): boolean;
91
+ isDrawByFiftyMoves(): boolean;
92
+ isDraw(): boolean;
93
+ isGameOver(): boolean;
94
+ moves(): string[];
95
+ moves({ square }: {
96
+ square: Square;
97
+ }): string[];
98
+ moves({ piece }: {
99
+ piece: PieceSymbol;
100
+ }): string[];
101
+ moves({ square, piece }: {
102
+ square: Square;
103
+ piece: PieceSymbol;
104
+ }): string[];
105
+ moves({ verbose, square }: {
106
+ verbose: true;
107
+ square?: Square;
108
+ }): Move[];
109
+ moves({ verbose, square }: {
110
+ verbose: false;
111
+ square?: Square;
112
+ }): string[];
113
+ moves({ verbose, square, }: {
114
+ verbose?: boolean;
115
+ square?: Square;
116
+ }): string[] | Move[];
117
+ moves({ verbose, piece }: {
118
+ verbose: true;
119
+ piece?: PieceSymbol;
120
+ }): Move[];
121
+ moves({ verbose, piece }: {
122
+ verbose: false;
123
+ piece?: PieceSymbol;
124
+ }): string[];
125
+ moves({ verbose, piece, }: {
126
+ verbose?: boolean;
127
+ piece?: PieceSymbol;
128
+ }): string[] | Move[];
129
+ moves({ verbose, square, piece, }: {
130
+ verbose: true;
131
+ square?: Square;
132
+ piece?: PieceSymbol;
133
+ }): Move[];
134
+ moves({ verbose, square, piece, }: {
135
+ verbose: false;
136
+ square?: Square;
137
+ piece?: PieceSymbol;
138
+ }): string[];
139
+ moves({ verbose, square, piece, }: {
140
+ verbose?: boolean;
141
+ square?: Square;
142
+ piece?: PieceSymbol;
143
+ }): string[] | Move[];
144
+ moves({ square, piece }: {
145
+ square?: Square;
146
+ piece?: PieceSymbol;
147
+ }): Move[];
148
+ private _moves;
149
+ move(move: string | {
150
+ from: string;
151
+ to: string;
152
+ promotion?: string;
153
+ } | null, { strict }?: {
154
+ strict?: boolean;
155
+ }): Move;
156
+ private _createMove;
157
+ private _push;
158
+ private _movePiece;
159
+ private _makeMove;
160
+ undo(): Move | null;
161
+ private _undoMove;
162
+ pgn({ newline, maxWidth, }?: {
163
+ newline?: string;
164
+ maxWidth?: number;
165
+ }): string;
166
+ /**
167
+ * @deprecated Use `setHeader` and `getHeaders` instead. This method will return null header tags (which is not what you want)
168
+ */
169
+ header(...args: string[]): Record<string, string | null>;
170
+ setHeader(key: string, value: string): Record<string, string>;
171
+ removeHeader(key: string): boolean;
172
+ getHeaders(): Record<string, string>;
173
+ loadPgn(pgn: string, { strict, newlineChar, }?: {
174
+ strict?: boolean;
175
+ newlineChar?: string;
176
+ }): void;
177
+ private _moveToSan;
178
+ private _moveFromSan;
179
+ ascii(): string;
180
+ perft(depth: number): number;
181
+ setTurn(color: Color): boolean;
182
+ turn(): Color;
183
+ board(): ({
184
+ square: Square;
185
+ type: PieceSymbol;
186
+ color: Color;
187
+ } | null)[][];
188
+ squareColor(square: Square): 'light' | 'dark' | null;
189
+ history(): string[];
190
+ history({ verbose }: {
191
+ verbose: true;
192
+ }): Move[];
193
+ history({ verbose }: {
194
+ verbose: false;
195
+ }): string[];
196
+ history({ verbose }: {
197
+ verbose: boolean;
198
+ }): string[] | Move[];
199
+ private _getPositionCount;
200
+ private _incPositionCount;
201
+ private _decPositionCount;
202
+ private _pruneComments;
203
+ getComment(): string;
204
+ setComment(comment: string): void;
205
+ /**
206
+ * @deprecated Renamed to `removeComment` for consistency
207
+ */
208
+ deleteComment(): string;
209
+ removeComment(): string;
210
+ getComments(): {
211
+ fen: string;
212
+ comment: string;
213
+ }[];
214
+ /**
215
+ * @deprecated Renamed to `removeComments` for consistency
216
+ */
217
+ deleteComments(): {
218
+ fen: string;
219
+ comment: string;
220
+ }[];
221
+ removeComments(): {
222
+ fen: string;
223
+ comment: string;
224
+ }[];
225
+ setCastlingRights(color: Color, rights: Partial<Record<typeof KING | typeof QUEEN, boolean>>): boolean;
226
+ getCastlingRights(color: Color): {
227
+ [KING]: boolean;
228
+ [QUEEN]: boolean;
229
+ };
230
+ moveNumber(): number;
231
+ }
232
+ //# sourceMappingURL=chess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chess.d.ts","sourceRoot":"","sources":["../src/chess.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAEV,KAAK,EAGL,KAAK,EACL,WAAW,EACX,MAAM,EACP,MAAM,YAAY,CAAA;AACnB,OAAO,EAOL,IAAI,EAIJ,KAAK,EASN,MAAM,YAAY,CAAA;AAcnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAA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