gigachess 0.2.1 → 0.4.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.
- package/README.md +103 -108
- package/dist/attacks.d.ts +6 -3
- package/dist/attacks.d.ts.map +1 -1
- package/dist/attacks.js +45 -1
- package/dist/board.d.ts +111 -45
- package/dist/board.d.ts.map +1 -1
- package/dist/board.js +747 -14
- package/dist/castling.d.ts +41 -0
- package/dist/castling.d.ts.map +1 -0
- package/dist/castling.js +267 -0
- package/dist/chess.d.ts +30 -28
- package/dist/chess.d.ts.map +1 -1
- package/dist/chess.js +835 -458
- package/dist/chess960.d.ts +1 -1
- package/dist/chess960.d.ts.map +1 -1
- package/dist/chess960.js +2 -2
- package/dist/chessjs.d.ts +13 -0
- package/dist/chessjs.d.ts.map +1 -0
- package/dist/chessjs.js +23 -0
- package/dist/chessops/board.d.ts +1 -1
- package/dist/chessops/board.d.ts.map +1 -1
- package/dist/chessops/chess.js +1 -1
- package/dist/chessops/convert.d.ts +1 -1
- package/dist/chessops/convert.d.ts.map +1 -1
- package/dist/chessops/convert.js +1 -6
- package/dist/chessops/fenInternal.d.ts +1 -1
- package/dist/chessops/fenInternal.d.ts.map +1 -1
- package/dist/chessops/fenInternal.js +2 -2
- package/dist/chessops/index.js +2 -2
- package/dist/chessops/setup.js +1 -1
- package/dist/chessops/types.js +1 -1
- package/dist/chesstree.d.ts +1 -1
- package/dist/chesstree.d.ts.map +1 -1
- package/dist/chesstree.js +5 -5
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +2 -2
- package/dist/fen.d.ts.map +1 -1
- package/dist/fen.js +84 -48
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -8
- package/dist/packedMove.js +2 -2
- package/dist/san.d.ts.map +1 -1
- package/dist/san.js +148 -172
- package/dist/squareSet.js +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/zobrist.d.ts +22 -0
- package/dist/zobrist.d.ts.map +1 -1
- package/dist/zobrist.js +107 -36
- package/dist/zobristBlob.js +1 -1
- package/package.json +8 -6
package/dist/zobrist.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Constants are the standard Polyglot opening-book random array (781 entries;
|
|
6
6
|
// interop-critical fixed numeric data), stored in src/zobristBlob.ts as base64
|
|
7
7
|
// of little-endian u64 bytes — the same size/load rationale as the magic-table
|
|
8
|
-
// blobs. The blob module is NEVER in the static import graph of
|
|
8
|
+
// blobs. The blob module is NEVER in the static import graph of gigachess/core
|
|
9
9
|
// (bundle gate): it loads via dynamic import() behind `ensureZobristLoaded()`.
|
|
10
10
|
// Until loaded — or if loading fails — hashing is unavailable (positions carry
|
|
11
11
|
// no zobrist fields; `makeMove` skips maintenance) and callers can probe with
|
|
@@ -22,9 +22,8 @@
|
|
|
22
22
|
// side to move exists (pseudo-legal capture), per Polyglot/Shakmaty
|
|
23
23
|
// 780 side to move (XORed when WHITE is to move — python-chess
|
|
24
24
|
// `hash_turn` semantics, which match the Polyglot book format)
|
|
25
|
-
// MIT
|
|
25
|
+
// MIT gigachess.
|
|
26
26
|
import { Color, Role } from "./types.js";
|
|
27
|
-
import { squareFile } from "./util.js";
|
|
28
27
|
const N_KEYS = 781;
|
|
29
28
|
const IDX_CASTLING = 768;
|
|
30
29
|
const IDX_EP = 772;
|
|
@@ -32,6 +31,22 @@ const IDX_SIDE = 780;
|
|
|
32
31
|
let keyLo = null;
|
|
33
32
|
let keyHi = null;
|
|
34
33
|
let loadPromise = null;
|
|
34
|
+
/**
|
|
35
|
+
* splitmix64 state seed for the 12 derived Chess960 castling keys (ADR-003).
|
|
36
|
+
* Published seed: 0x00C0_FFEE_DABA_D00D.
|
|
37
|
+
*/
|
|
38
|
+
export const CASTLE_KEY_SEED = 0x00c0ffeedabad00dn;
|
|
39
|
+
const MASK64 = 0xffffffffffffffffn;
|
|
40
|
+
function splitmix64(stateRef) {
|
|
41
|
+
stateRef.state = (stateRef.state + 0x9e3779b97f4a7c15n) & MASK64;
|
|
42
|
+
let z = stateRef.state;
|
|
43
|
+
z = ((z ^ (z >> 30n)) * 0xbf58476d1ce4e5b9n) & MASK64;
|
|
44
|
+
z = ((z ^ (z >> 27n)) * 0x94d049bb133111ebn) & MASK64;
|
|
45
|
+
return (z ^ (z >> 31n)) & MASK64;
|
|
46
|
+
}
|
|
47
|
+
let castleKeyLo = null;
|
|
48
|
+
let castleKeyHi = null;
|
|
49
|
+
export { castleKeyLo, castleKeyHi, keyLo, keyHi, IDX_EP, IDX_SIDE };
|
|
35
50
|
/**
|
|
36
51
|
* Loads the Polyglot key blob (idempotent). Safe to call repeatedly; the
|
|
37
52
|
* returned promise resolves once the tables are available. Failures propagate
|
|
@@ -51,6 +66,42 @@ export function ensureZobristLoaded() {
|
|
|
51
66
|
}
|
|
52
67
|
keyLo = lo;
|
|
53
68
|
keyHi = hi;
|
|
69
|
+
// Initialize the 16 rook-file castling keys (ADR-003, decision D2)
|
|
70
|
+
// Indexed by `colorIdx * 8 + file` (Black = 0, White = 1, file = 0..7)
|
|
71
|
+
const cLo = new Uint32Array(16);
|
|
72
|
+
const cHi = new Uint32Array(16);
|
|
73
|
+
const stateRef = { state: CASTLE_KEY_SEED };
|
|
74
|
+
const prng = new BigUint64Array(12);
|
|
75
|
+
for (let i = 0; i < 12; i++) {
|
|
76
|
+
prng[i] = splitmix64(stateRef);
|
|
77
|
+
}
|
|
78
|
+
// Black (color index 0) files b..g (1..6)
|
|
79
|
+
for (let f = 1; f <= 6; f++) {
|
|
80
|
+
const val = prng[f - 1];
|
|
81
|
+
cLo[f] = Number(val & 0xffffffffn) >>> 0;
|
|
82
|
+
cHi[f] = Number((val >> 32n) & 0xffffffffn) >>> 0;
|
|
83
|
+
}
|
|
84
|
+
// White (color index 1) files b..g (1..6) -> indices 8+f = 9..14
|
|
85
|
+
for (let f = 1; f <= 6; f++) {
|
|
86
|
+
const val = prng[6 + f - 1];
|
|
87
|
+
cLo[8 + f] = Number(val & 0xffffffffn) >>> 0;
|
|
88
|
+
cHi[8 + f] = Number((val >> 32n) & 0xffffffffn) >>> 0;
|
|
89
|
+
}
|
|
90
|
+
// Pin the a/h keys to the Polyglot castling keys:
|
|
91
|
+
// White O-O (h-file) = 1*8+7 = 15 -> Polyglot 768
|
|
92
|
+
// White O-O-O (a-file) = 1*8+0 = 8 -> Polyglot 769
|
|
93
|
+
// Black O-O (h-file) = 0*8+7 = 7 -> Polyglot 770
|
|
94
|
+
// Black O-O-O (a-file) = 0*8+0 = 0 -> Polyglot 771
|
|
95
|
+
cLo[15] = lo[768];
|
|
96
|
+
cHi[15] = hi[768];
|
|
97
|
+
cLo[8] = lo[769];
|
|
98
|
+
cHi[8] = hi[769];
|
|
99
|
+
cLo[7] = lo[770];
|
|
100
|
+
cHi[7] = hi[770];
|
|
101
|
+
cLo[0] = lo[771];
|
|
102
|
+
cHi[0] = hi[771];
|
|
103
|
+
castleKeyLo = cLo;
|
|
104
|
+
castleKeyHi = cHi;
|
|
54
105
|
});
|
|
55
106
|
// see attacks.ts: fire-and-forget callers must not trigger an
|
|
56
107
|
// unhandled-rejection warning; awaiting callers still observe the error.
|
|
@@ -60,9 +111,9 @@ export function ensureZobristLoaded() {
|
|
|
60
111
|
}
|
|
61
112
|
/** Whether the Zobrist tables are loaded (false ⇒ hashing is skipped). */
|
|
62
113
|
export function zobristTablesLoaded() {
|
|
63
|
-
return keyLo !== null && keyHi !== null;
|
|
114
|
+
return keyLo !== null && keyHi !== null && castleKeyLo !== null && castleKeyHi !== null;
|
|
64
115
|
}
|
|
65
|
-
function pieceKeyIdx(color, role, sqIdx) {
|
|
116
|
+
export function pieceKeyIdx(color, role, sqIdx) {
|
|
66
117
|
// Polyglot layout (python-chess ZobristHasher.hash_board): piece_index =
|
|
67
118
|
// 2*role + colorPivot where role order is pawn, knight, bishop, rook,
|
|
68
119
|
// queen, king and the color pivot follows python-chess's occupied_co
|
|
@@ -70,18 +121,34 @@ function pieceKeyIdx(color, role, sqIdx) {
|
|
|
70
121
|
// white pawn, black knight, white knight, …), then * 64 + square (a1 = 0).
|
|
71
122
|
return (2 * role + (color === Color.White ? 1 : 0)) * 64 + sqIdx;
|
|
72
123
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Castling key index: `(color === White ? 1 : 0) * 8 + rookFile` (ADR-003).
|
|
126
|
+
*/
|
|
127
|
+
export function castlingKeyIdx(color, rookSq, _kingSq) {
|
|
128
|
+
const colorIdx = color === Color.White ? 1 : 0;
|
|
129
|
+
const file = rookSq & 7;
|
|
130
|
+
return (colorIdx << 3) | file;
|
|
131
|
+
}
|
|
132
|
+
export function castleFileKey(color, file) {
|
|
133
|
+
if (!zobristTablesLoaded())
|
|
134
|
+
throw new Error("zobrist tables not loaded — call ensureZobristLoaded() first");
|
|
135
|
+
const colorIdx = color === Color.White ? 1 : 0;
|
|
136
|
+
const idx = (colorIdx << 3) | (file & 7);
|
|
137
|
+
return { lo: castleKeyLo[idx], hi: castleKeyHi[idx] };
|
|
138
|
+
}
|
|
139
|
+
function xorCastleInto(lo, hi, castleIdx) {
|
|
140
|
+
const t = castleKeyLo;
|
|
141
|
+
const h = castleKeyHi;
|
|
142
|
+
return [(lo ^ t[castleIdx]) >>> 0, (hi ^ h[castleIdx]) >>> 0];
|
|
77
143
|
}
|
|
78
144
|
/** True when a pawn of `side` stands adjacent to the ep square (legal capture). */
|
|
79
|
-
function epIsHashable(
|
|
145
|
+
export function epIsHashable(target, epSquare, side) {
|
|
146
|
+
const b = "board" in target && target.board ? target.board : target;
|
|
80
147
|
const file = epSquare & 7;
|
|
81
148
|
const pawnRank = (epSquare >> 3) + (side === Color.White ? -1 : 1);
|
|
82
149
|
if (pawnRank < 0 || pawnRank > 7)
|
|
83
150
|
return false;
|
|
84
|
-
const colorOcc = side === Color.White ?
|
|
151
|
+
const colorOcc = side === Color.White ? b.white : b.black;
|
|
85
152
|
for (let df = -1; df <= 1; df += 2) {
|
|
86
153
|
const f = file + df;
|
|
87
154
|
if (f < 0 || f > 7)
|
|
@@ -89,7 +156,7 @@ function epIsHashable(pos, epSquare, side) {
|
|
|
89
156
|
const sqIdx = (pawnRank << 3) | f;
|
|
90
157
|
const bit = sqIdx < 32 ? (1 << sqIdx) >>> 0 : (1 << (sqIdx - 32)) >>> 0;
|
|
91
158
|
const occWord = sqIdx < 32 ? colorOcc.lo : colorOcc.hi;
|
|
92
|
-
const pawnWord = sqIdx < 32 ?
|
|
159
|
+
const pawnWord = sqIdx < 32 ? b.pawn.lo : b.pawn.hi;
|
|
93
160
|
if (((occWord & pawnWord & bit) >>> 0) !== 0)
|
|
94
161
|
return true;
|
|
95
162
|
}
|
|
@@ -158,16 +225,13 @@ export function calculateZobrist(pos) {
|
|
|
158
225
|
}
|
|
159
226
|
}
|
|
160
227
|
}
|
|
161
|
-
// castling rights (
|
|
228
|
+
// castling rights (indexed by (color, rook file) — ADR-003 / 16 keys)
|
|
162
229
|
for (let color = 0; color <= 1; color++) {
|
|
163
230
|
const rights = color === Color.White ? pos.castling.white : pos.castling.black;
|
|
164
231
|
if (rights.size === 0)
|
|
165
232
|
continue;
|
|
166
|
-
const ksq = kingSqOf(pos, color);
|
|
167
|
-
if (ksq === undefined)
|
|
168
|
-
continue;
|
|
169
233
|
for (const rs of rights) {
|
|
170
|
-
[lo, hi] =
|
|
234
|
+
[lo, hi] = xorCastleInto(lo, hi, castlingKeyIdx(color, rs));
|
|
171
235
|
}
|
|
172
236
|
}
|
|
173
237
|
// en passant (only when a legal capture exists — Polyglot semantics)
|
|
@@ -232,26 +296,33 @@ export function zobristAfterMove(pos, move, plan, isEnPassant, captured, newPos)
|
|
|
232
296
|
else if (captured !== undefined && captured !== null) {
|
|
233
297
|
[lo, hi] = xorInto(lo, hi, pieceKeyIdx(captured.color, captured.role, move.to));
|
|
234
298
|
}
|
|
235
|
-
// castling rights:
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (ks !== undefined)
|
|
249
|
-
[lo, hi] = xorInto(lo, hi, castlingKeyIdx(Color.White, rs, ks));
|
|
299
|
+
// castling rights: fast bitmask diff for standard chess, fallback for 960
|
|
300
|
+
if (!pos.isChess960 && pos.castlingMask !== undefined && newPos.castlingMask !== undefined) {
|
|
301
|
+
const diff = pos.castlingMask ^ newPos.castlingMask;
|
|
302
|
+
if (diff !== 0) {
|
|
303
|
+
if (diff & 1)
|
|
304
|
+
[lo, hi] = xorCastleInto(lo, hi, 15); // WK: White h-file (768)
|
|
305
|
+
if (diff & 2)
|
|
306
|
+
[lo, hi] = xorCastleInto(lo, hi, 8); // WQ: White a-file (769)
|
|
307
|
+
if (diff & 4)
|
|
308
|
+
[lo, hi] = xorCastleInto(lo, hi, 7); // BK: Black h-file (770)
|
|
309
|
+
if (diff & 8)
|
|
310
|
+
[lo, hi] = xorCastleInto(lo, hi, 0); // BQ: Black a-file (771)
|
|
311
|
+
}
|
|
250
312
|
}
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
313
|
+
else {
|
|
314
|
+
for (const rs of pos.castling.white) {
|
|
315
|
+
[lo, hi] = xorCastleInto(lo, hi, castlingKeyIdx(Color.White, rs));
|
|
316
|
+
}
|
|
317
|
+
for (const rs of pos.castling.black) {
|
|
318
|
+
[lo, hi] = xorCastleInto(lo, hi, castlingKeyIdx(Color.Black, rs));
|
|
319
|
+
}
|
|
320
|
+
for (const rs of newPos.castling.white) {
|
|
321
|
+
[lo, hi] = xorCastleInto(lo, hi, castlingKeyIdx(Color.White, rs));
|
|
322
|
+
}
|
|
323
|
+
for (const rs of newPos.castling.black) {
|
|
324
|
+
[lo, hi] = xorCastleInto(lo, hi, castlingKeyIdx(Color.Black, rs));
|
|
325
|
+
}
|
|
255
326
|
}
|
|
256
327
|
// en passant state (both directions, legality-filtered)
|
|
257
328
|
if (pos.epSquare !== null && pos.epSquare !== undefined && epIsHashable(pos, pos.epSquare, pos.turn)) {
|
package/dist/zobristBlob.js
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
// castling (W-K, W-Q, B-K, B-Q), 772..779 en-passant file a..h, 780 side).
|
|
8
8
|
// Stored as data (not object literals) per the same size/load rationale as
|
|
9
9
|
// the magic-table blobs; loaded via dynamic import() so it never lands in
|
|
10
|
-
// the static graph of
|
|
10
|
+
// the static graph of gigachess/core (bundle gate).
|
|
11
11
|
export const POLYGLOT_KEYS_B64 = "QW13M34kOZ3HpaoFgDn3Kkc1YiRQAdtE4mqnYj73FZyJDJxIZUSDdb8BMCA6rJAyeSIEYR+tuw/KYPvyj5A66BBcdVhddn4NLeCvziI4CBqww17i8NUFltUuOtFc/yHQMi5nSl3xvUCVY9VvFFUTAeXZ80Ygg7RdzBn3fy2LnyOhmrSFrqHRBXHJj26PhJ9nC+0fgP+7SXTwrbfDsc0Rfcy3HniecMeCbHgQlRyPIfPmu1Gv83gUM0OUIefljbNL/FD9vG6cZKoL1K9So5i9jReS14FLB9KH4Srp01HH8xm/mrFi8DCrtMR6BEKsAAV7XdgJGqgsRckAdaJNUWyqJEe0AXVCNJ9MQQiRPNePphSTvRxGg5sbpw+F8bCVi0gDQMCT/zQre2OUCtk9mrzRCTvdoTSDZnU1I1rEpJcrXnMLQL3xcHByGOcCv1nSrMsfVWWbzsKnENNEgl3+4D+YvySoVHRP0XSfNTC6uUrc61H6sJrbBcWCXEGyMDSK/vf83j26uSmnUzJ1MBsIaMN0jOczfBaHbLy5IE4CgyuP9H5/vVHD1AXVEUOidiyp/GhluKcyD/Sw4E1dfsMMRpPWli+faGPLQOJCYZaR4trcK21R2eQ2AguIQrYbF5hYSg9fiC/5efWQ+DmLOFZz9LXFk3gbI42dNdxjdq2Y6orKFuzHLajC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Wsdvm9h4kbsIL2XPMcNc6DN81axriYmmAstiTOgChkLg8096ZHIlC3QreRTHPcvsUVXpC5NCDpLOfzCHGdwtVVkOsTaNnCYUnr6om1vg=";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gigachess",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The fastest chess engine in
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "The fastest chess library and engine in TypeScript. 45x faster than chess.js, 18.7M nodes/s perft, zero dependencies, 100% MIT.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Itshak <aistreltsov@outlook.com>",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"import": "./dist/chessops/index.js"
|
|
58
58
|
},
|
|
59
59
|
"./chessjs": {
|
|
60
|
-
"types": "./dist/
|
|
61
|
-
"import": "./dist/
|
|
60
|
+
"types": "./dist/chessjs.d.ts",
|
|
61
|
+
"import": "./dist/chessjs.js"
|
|
62
62
|
},
|
|
63
63
|
"./chessops/board": {
|
|
64
64
|
"types": "./dist/chessops/board.d.ts",
|
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"typecheck": "tsc --noEmit",
|
|
109
|
-
"test": "npm run typecheck && node tests/perft.mjs && node tests/castling.mjs && node tests/parity.mjs && node tests/purity.mjs && node tests/compat-chessops.mjs && node tests/chessjs-parity.mjs && node tests/chesstree-parity.mjs && node tests/zobrist-parity.mjs && node tests/packed-moves.mjs",
|
|
109
|
+
"test": "npm run typecheck && node tests/native-board.mjs && node tests/perft.mjs && node tests/castling.mjs && node tests/parity.mjs && node tests/purity.mjs && node tests/compat-chessops.mjs && node tests/chessjs-parity.mjs && node tests/chesstree-parity.mjs && node tests/zobrist-parity.mjs && node tests/packed-moves.mjs && node tests/zero-copy-moves.mjs && node tests/fuzz-differential.mjs",
|
|
110
|
+
"test:fuzz": "node tests/fuzz-differential.mjs",
|
|
110
111
|
"bench": "node bench/bench-sliding.mjs --iters 1000000 && node bench/bench-perft.mjs --depth 5 && node bench/bench-pgn.mjs --games 1000 && node bench/bench-fen-san.mjs --iters 1000 && node bench/bench-bundle.mjs --entry core",
|
|
111
112
|
"bench:sliding": "node bench/bench-sliding.mjs",
|
|
112
113
|
"bench:perft": "node bench/bench-perft.mjs",
|
|
@@ -127,7 +128,8 @@
|
|
|
127
128
|
"chessops": "0.15.1",
|
|
128
129
|
"esbuild": "^0.25.0",
|
|
129
130
|
"rescript": "^12.3.1",
|
|
130
|
-
"typescript": "^5.7.0"
|
|
131
|
+
"typescript": "^5.7.0",
|
|
132
|
+
"ultrachess": "^1.4.0"
|
|
131
133
|
},
|
|
132
134
|
"dependencies": {
|
|
133
135
|
"@badrap/result": "0.3.1"
|