gigachess 0.4.3 → 0.6.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 (60) hide show
  1. package/README.md +94 -39
  2. package/dist/attacks.d.ts +12 -4
  3. package/dist/attacks.d.ts.map +1 -1
  4. package/dist/attacks.js +161 -74
  5. package/dist/bishopSplit32Blob.d.ts +2 -0
  6. package/dist/bishopSplit32Blob.d.ts.map +1 -0
  7. package/dist/bishopSplit32Blob.js +2 -0
  8. package/dist/board.d.ts +27 -1
  9. package/dist/board.d.ts.map +1 -1
  10. package/dist/board.js +351 -36
  11. package/dist/castling.d.ts +2 -0
  12. package/dist/castling.d.ts.map +1 -1
  13. package/dist/castling.js +27 -12
  14. package/dist/chess.d.ts +11 -4
  15. package/dist/chess.d.ts.map +1 -1
  16. package/dist/chess.js +521 -137
  17. package/dist/chesstree.d.ts +9 -0
  18. package/dist/chesstree.d.ts.map +1 -1
  19. package/dist/chesstree.js +85 -7
  20. package/dist/core.d.ts +1 -1
  21. package/dist/core.d.ts.map +1 -1
  22. package/dist/core.js +1 -1
  23. package/dist/fast/bishopSplit32Blob-NOHWZEWR.js +1 -0
  24. package/dist/fast/index.js +1 -0
  25. package/dist/fast/rookSplit32Blob-C3ANUNTJ.js +1 -0
  26. package/dist/fast/zobristBlob-HIMMLZLJ.js +1 -0
  27. package/dist/fast.d.ts +12 -0
  28. package/dist/fast.d.ts.map +1 -0
  29. package/dist/fast.js +11 -0
  30. package/dist/fen.d.ts.map +1 -1
  31. package/dist/fen.js +139 -124
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +2 -2
  35. package/dist/perftCompact.d.ts +3 -0
  36. package/dist/perftCompact.d.ts.map +1 -0
  37. package/dist/perftCompact.js +358 -0
  38. package/dist/pgn.d.ts +4 -0
  39. package/dist/pgn.d.ts.map +1 -1
  40. package/dist/pgn.js +7 -2
  41. package/dist/rookSplit32Blob.d.ts +2 -0
  42. package/dist/rookSplit32Blob.d.ts.map +1 -0
  43. package/dist/rookSplit32Blob.js +2 -0
  44. package/dist/san.d.ts.map +1 -1
  45. package/dist/san.js +14 -40
  46. package/dist/squareSet.d.ts +2 -0
  47. package/dist/squareSet.d.ts.map +1 -1
  48. package/dist/squareSet.js +6 -1
  49. package/dist/standardMovegen.d.ts +3 -0
  50. package/dist/standardMovegen.d.ts.map +1 -0
  51. package/dist/standardMovegen.js +253 -0
  52. package/dist/zobrist.d.ts.map +1 -1
  53. package/dist/zobrist.js +17 -15
  54. package/package.json +15 -6
  55. package/dist/bishopMagicBlob.d.ts +0 -2
  56. package/dist/bishopMagicBlob.d.ts.map +0 -1
  57. package/dist/bishopMagicBlob.js +0 -11
  58. package/dist/rookMagicBlob.d.ts +0 -2
  59. package/dist/rookMagicBlob.d.ts.map +0 -1
  60. package/dist/rookMagicBlob.js +0 -11
package/dist/fen.js CHANGED
@@ -139,59 +139,105 @@ export function parseFen(fen, opts) {
139
139
  // per-piece `setPiece`. The scanner walks the raw string with charCodeAt:
140
140
  // '/' drops a rank, '1'..'8' skips empty squares, anything else must be a
141
141
  // piece letter (color = uppercase ⇒ white).
142
- const scratch = board.newScratchBoard();
143
- let r = 7;
144
- let file = 0;
145
- for (let k = fs[0]; k < fe[0]; k++) {
146
- const c = fen.charCodeAt(k);
147
- if (c === 47) {
148
- // '/': next rank down
149
- if (file !== 8 || r === 0)
150
- return Err({ code: "fen/invalidPiecePlacement" });
151
- r--;
152
- file = 0;
153
- continue;
154
- }
155
- if (c >= 49 && c <= 56) {
156
- // '1'..'8': consecutive empty squares
157
- file += c - 48;
158
- if (file > 8)
142
+ // Build locally owned words, then materialize the public board once.
143
+ let scratch;
144
+ {
145
+ let wl = 0, wh = 0, bl = 0, bh = 0, pl = 0, ph = 0, nl = 0, nh = 0, il = 0, ih = 0, rl = 0, rh = 0, ql = 0, qh = 0, kl = 0, kh = 0;
146
+ let wk = -1, bk = -1, r = 7, file = 0;
147
+ for (let k = fs[0]; k < fe[0]; k++) {
148
+ const c = fen.charCodeAt(k);
149
+ if (c === 47) {
150
+ if (file !== 8 || r === 0)
151
+ return Err({ code: "fen/invalidPiecePlacement" });
152
+ r--;
153
+ file = 0;
154
+ continue;
155
+ }
156
+ if (c >= 49 && c <= 56) {
157
+ file += c - 48;
158
+ if (file > 8)
159
+ return Err({ code: "fen/invalidPiecePlacement" });
160
+ continue;
161
+ }
162
+ if (file >= 8)
159
163
  return Err({ code: "fen/invalidPiecePlacement" });
160
- continue;
164
+ const index = r * 8 + file, bit = 1 << (index & 31), high = index >= 32, white = c < 97;
165
+ if (high) {
166
+ switch (c | 32) {
167
+ case 112:
168
+ ph |= bit;
169
+ break;
170
+ case 110:
171
+ nh |= bit;
172
+ break;
173
+ case 98:
174
+ ih |= bit;
175
+ break;
176
+ case 114:
177
+ rh |= bit;
178
+ break;
179
+ case 113:
180
+ qh |= bit;
181
+ break;
182
+ case 107:
183
+ kh |= bit;
184
+ if (white)
185
+ wk = index;
186
+ else
187
+ bk = index;
188
+ break;
189
+ default: return Err({ code: "fen/invalidPiecePlacement" });
190
+ }
191
+ if (white)
192
+ wh |= bit;
193
+ else
194
+ bh |= bit;
195
+ }
196
+ else {
197
+ switch (c | 32) {
198
+ case 112:
199
+ pl |= bit;
200
+ break;
201
+ case 110:
202
+ nl |= bit;
203
+ break;
204
+ case 98:
205
+ il |= bit;
206
+ break;
207
+ case 114:
208
+ rl |= bit;
209
+ break;
210
+ case 113:
211
+ ql |= bit;
212
+ break;
213
+ case 107:
214
+ kl |= bit;
215
+ if (white)
216
+ wk = index;
217
+ else
218
+ bk = index;
219
+ break;
220
+ default: return Err({ code: "fen/invalidPiecePlacement" });
221
+ }
222
+ if (white)
223
+ wl |= bit;
224
+ else
225
+ bl |= bit;
226
+ }
227
+ file++;
161
228
  }
162
- if (file >= 8)
229
+ if (file !== 8 || r !== 0)
163
230
  return Err({ code: "fen/invalidPiecePlacement" });
164
- // inline role/color decode (no per-piece object allocation)
165
- let role;
166
- switch (c | 32) {
167
- case 112:
168
- role = Role.Pawn;
169
- break; // p
170
- case 110:
171
- role = Role.Knight;
172
- break; // n
173
- case 98:
174
- role = Role.Bishop;
175
- break; // b
176
- case 114:
177
- role = Role.Rook;
178
- break; // r
179
- case 113:
180
- role = Role.Queen;
181
- break; // q
182
- case 107:
183
- role = Role.King;
184
- break; // k
185
- default: return Err({ code: "fen/invalidPiecePlacement" });
186
- }
187
- const color = c >= 97 ? Color.Black : Color.White; // lowercase ⇒ black
188
- const sqIdx = r * 8 + file;
189
- board.putPieceInPlace(scratch, sqIdx, { color, role });
190
- file++;
231
+ scratch = {
232
+ white: { lo: wl >>> 0, hi: wh >>> 0 }, black: { lo: bl >>> 0, hi: bh >>> 0 },
233
+ pawn: { lo: pl >>> 0, hi: ph >>> 0 }, knight: { lo: nl >>> 0, hi: nh >>> 0 },
234
+ bishop: { lo: il >>> 0, hi: ih >>> 0 }, rook: { lo: rl >>> 0, hi: rh >>> 0 },
235
+ queen: { lo: ql >>> 0, hi: qh >>> 0 }, king: { lo: kl >>> 0, hi: kh >>> 0 },
236
+ occupied: { lo: (wl | bl) >>> 0, hi: (wh | bh) >>> 0 }, promoted: { lo: 0, hi: 0 },
237
+ kingSq: [wk, bk]
238
+ };
191
239
  }
192
- if (file !== 8 || r !== 0)
193
- return Err({ code: "fen/invalidPiecePlacement" });
194
- const curBoard = board.cloneBoard(scratch);
240
+ const curBoard = scratch;
195
241
  // ----- active color -----
196
242
  let turn;
197
243
  if (fieldCount < 2) {
@@ -210,8 +256,9 @@ export function parseFen(fen, opts) {
210
256
  return Err({ code: "fen/invalidActiveColor" });
211
257
  }
212
258
  // ----- castling -----
213
- let whiteSet = new Set();
214
- let blackSet = new Set();
259
+ let standardMask = 0;
260
+ const whiteSet = opts?.chess960 ? new Set() : undefined;
261
+ const blackSet = opts?.chess960 ? new Set() : undefined;
215
262
  const castlingStart = fieldCount > 2 ? fs[2] : -1;
216
263
  const castlingIsDash = castlingStart === -1 || (fe[2] - fs[2] === 1 && fen.charCodeAt(fs[2]) === 45);
217
264
  if (!castlingIsDash) {
@@ -231,13 +278,13 @@ export function parseFen(fen, opts) {
231
278
  return Err({ code: "fen/invalidCastling" });
232
279
  }
233
280
  if (ch === "K")
234
- whiteSet.add(7);
281
+ standardMask |= CASTLE_WK;
235
282
  else if (ch === "Q")
236
- whiteSet.add(0);
283
+ standardMask |= CASTLE_WQ;
237
284
  else if (ch === "k")
238
- blackSet.add(63);
285
+ standardMask |= CASTLE_BK;
239
286
  else if (ch === "q")
240
- blackSet.add(56);
287
+ standardMask |= CASTLE_BQ;
241
288
  }
242
289
  else {
243
290
  // chess960 tolerant
@@ -334,7 +381,7 @@ export function parseFen(fen, opts) {
334
381
  // duplicate check not needed; Set handles
335
382
  // For non-960, ensure no duplicate file letters etc already handled
336
383
  }
337
- const castling = makeCastling(whiteSet, blackSet);
384
+ const castling = opts?.chess960 ? makeCastling(whiteSet, blackSet) : CASTLING_RIGHTS_TABLE[standardMask];
338
385
  // ----- en passant -----
339
386
  // Structural validation (square name + rank for the side to move) stays
340
387
  // unconditional per purechess-rules. The capturability check moves behind
@@ -383,7 +430,7 @@ export function parseFen(fen, opts) {
383
430
  }
384
431
  // ----- halfmove -----
385
432
  const half = fieldCount > 4 ? parseFenCount(fen, fs[4], fe[4]) : 0;
386
- if (!Number.isInteger(half) || half < 0 || half > 150)
433
+ if (!Number.isSafeInteger(half) || half < 0)
387
434
  return Err({ code: "fen/invalidHalfmove" });
388
435
  // ----- fullmove -----
389
436
  const full = fieldCount > 5 ? parseFenCount(fen, fs[5], fe[5]) : 1;
@@ -391,48 +438,29 @@ export function parseFen(fen, opts) {
391
438
  return Err({ code: "fen/invalidFullmove" });
392
439
  // ----- validations per purechess-rules -----
393
440
  // pawn on back rank
394
- for (let f = 0; f < 8; f++) {
395
- const sq1 = f; // rank 1
396
- const sq8 = 56 + f; // rank 8
397
- const p1 = board.pieceAt(curBoard, sq1);
398
- const p8 = board.pieceAt(curBoard, sq8);
399
- if (p1 && p1.role === Role.Pawn)
400
- return Err({ code: "fen/pawnOnBackRank" });
401
- if (p8 && p8.role === Role.Pawn)
402
- return Err({ code: "fen/pawnOnBackRank" });
403
- }
404
- // kings count
405
- const whiteKings = sq.popcnt(sq.and(curBoard.white, curBoard.king));
406
- const blackKings = sq.popcnt(sq.and(curBoard.black, curBoard.king));
407
- const totalKings = sq.popcnt(curBoard.king);
408
- if (totalKings !== 2 || whiteKings !== 1 || blackKings !== 1) {
441
+ if ((curBoard.pawn.lo & 255) || (curBoard.pawn.hi & 0xff000000))
442
+ return Err({ code: "fen/pawnOnBackRank" });
443
+ const wl = curBoard.white.lo & curBoard.king.lo, wh = curBoard.white.hi & curBoard.king.hi;
444
+ const bl = curBoard.black.lo & curBoard.king.lo, bh = curBoard.black.hi & curBoard.king.hi;
445
+ const w = wl | wh, b = bl | bh;
446
+ if (!w || !b || (wl && wh) || (bl && bh) || (w & (w - 1)) || (b & (b - 1)))
409
447
  return Err({ code: "fen/kingsCount" });
410
- }
411
448
  // kings adjacent
412
- const wkSq = board.kingSquare(curBoard, Color.White);
413
- const bkSq = board.kingSquare(curBoard, Color.Black);
449
+ const wkSq = scratch.kingSq[Color.White];
450
+ const bkSq = scratch.kingSq[Color.Black];
414
451
  if (wkSq !== undefined && bkSq !== undefined) {
415
452
  const wAtt = attacks.kingAttacks(wkSq);
416
453
  if (sq.has(wAtt, bkSq))
417
454
  return Err({ code: "fen/kingsAdjacent" });
418
455
  }
419
- // oppositeCheck: side not to move king attacked
420
- if (wkSq !== undefined && bkSq !== undefined) {
421
- const whiteAttacked = attacks.isAttacked(curBoard, wkSq, Color.Black);
422
- const blackAttacked = attacks.isAttacked(curBoard, bkSq, Color.White);
423
- // illegal if both in check
424
- if (whiteAttacked && blackAttacked)
425
- return Err({ code: "fen/oppositeCheck" });
426
- // illegal if opponent king is in check (side not to move)
427
- if (turn === Color.White && blackAttacked)
428
- return Err({ code: "fen/oppositeCheck" });
429
- if (turn === Color.Black && whiteAttacked)
430
- return Err({ code: "fen/oppositeCheck" });
431
- }
456
+ // Only the non-moving king must not be attacked; double check of
457
+ // both kings necessarily violates that condition as well.
458
+ if (turn === Color.White ? attacks.isAttacked(curBoard, bkSq, Color.White) : attacks.isAttacked(curBoard, wkSq, Color.Black))
459
+ return Err({ code: "fen/oppositeCheck" });
432
460
  const is960 = !!opts?.chess960;
433
461
  const kingSqPair = [wkSq ?? -1, bkSq ?? -1];
434
462
  curBoard.kingSq = kingSqPair;
435
- const chk = attacks.kingAttackers(curBoard, turn);
463
+ const chk = attacks.attackersTo(curBoard, kingSqPair[turn], turn === Color.White ? Color.Black : Color.White);
436
464
  const setup = {
437
465
  board: curBoard,
438
466
  turn,
@@ -459,44 +487,31 @@ export function parseFen(fen, opts) {
459
487
  }
460
488
  export function makeFen(setup, opts) {
461
489
  const boardVal = setup.board;
462
- // piece placement
463
490
  let placement = "";
464
491
  for (let r = 7; r >= 0; r--) {
465
- let empty = 0;
466
- let rankStr = "";
467
- for (let f = 0; f < 8; f++) {
468
- const sqIdx = r * 8 + f;
469
- // occupancy + role/color via direct bit tests (no per-square pieceAt
470
- // allocation — task 5.1)
471
- if (!sq.has(boardVal.occupied, sqIdx)) {
472
- empty++;
473
- }
474
- else {
475
- if (empty > 0) {
476
- rankStr += String(empty);
477
- empty = 0;
478
- }
479
- const isWhite = sq.has(boardVal.white, sqIdx);
480
- let ch;
481
- if (sq.has(boardVal.pawn, sqIdx))
482
- ch = isWhite ? "P" : "p";
483
- else if (sq.has(boardVal.knight, sqIdx))
484
- ch = isWhite ? "N" : "n";
485
- else if (sq.has(boardVal.bishop, sqIdx))
486
- ch = isWhite ? "B" : "b";
487
- else if (sq.has(boardVal.rook, sqIdx))
488
- ch = isWhite ? "R" : "r";
489
- else if (sq.has(boardVal.queen, sqIdx))
490
- ch = isWhite ? "Q" : "q";
491
- else
492
- ch = isWhite ? "K" : "k";
493
- rankStr += ch;
494
- }
492
+ const high = r >= 4, shift = (r & 3) * 8;
493
+ const occupied = high ? boardVal.occupied.hi : boardVal.occupied.lo;
494
+ const white = high ? boardVal.white.hi : boardVal.white.lo;
495
+ const pawn = high ? boardVal.pawn.hi : boardVal.pawn.lo;
496
+ const knight = high ? boardVal.knight.hi : boardVal.knight.lo;
497
+ const bishop = high ? boardVal.bishop.hi : boardVal.bishop.lo;
498
+ const rook = high ? boardVal.rook.hi : boardVal.rook.lo;
499
+ const queen = high ? boardVal.queen.hi : boardVal.queen.lo;
500
+ let bits = (occupied >>> shift) & 255, prev = 0;
501
+ while (bits) {
502
+ const bit = bits & -bits, f = 31 - Math.clz32(bit), mask = bit << shift;
503
+ if (f > prev)
504
+ placement += String(f - prev);
505
+ const w = (white & mask) !== 0;
506
+ placement += pawn & mask ? (w ? "P" : "p") : knight & mask ? (w ? "N" : "n") :
507
+ bishop & mask ? (w ? "B" : "b") : rook & mask ? (w ? "R" : "r") :
508
+ queen & mask ? (w ? "Q" : "q") : (w ? "K" : "k");
509
+ prev = f + 1;
510
+ bits &= bits - 1;
495
511
  }
496
- if (empty > 0)
497
- rankStr += String(empty);
498
- placement += rankStr;
499
- if (r > 0)
512
+ if (prev < 8)
513
+ placement += String(8 - prev);
514
+ if (r)
500
515
  placement += "/";
501
516
  }
502
517
  const active = setup.turn === Color.White ? "w" : "b";
package/dist/index.d.ts CHANGED
@@ -11,8 +11,8 @@ export * from "./packedMove.js";
11
11
  export { knightAttacks, kingAttacks, pawnAttacks, bishopAttacks, rookAttacks, queenAttacks, ensureMagicTablesLoaded, magicTablesLoaded, ray, between, lineRay, LINE_RAY_LO, LINE_RAY_HI, isAttacked, } from "./attacks.js";
12
12
  export { kingAttackers } from "./attacks.js";
13
13
  export { CASTLE_PATH_LO, CASTLE_PATH_HI, CASTLE_CLEAR_STD, } from "./castling.js";
14
- export { dests, allDests, detectCastling, isCheck, isCheckFresh, isCheckmate, isStalemate, isInsufficientMaterial, isFiftyMoveDraw, isSeventyFiveMoveDraw, isThreefoldRepetition, isLegal, isNullMoveLegal, perft, countLegalMoves, legalMovesInto, forEachLegalMove, MoveCounter, makeMove, makeNullMove, play, INITIAL_FEN, } from "./chess.js";
14
+ export { dests, allDests, detectCastling, isCheck, isCheckFresh, isCheckmate, isStalemate, isInsufficientMaterial, isFiftyMoveDraw, isSeventyFiveMoveDraw, isThreefoldRepetition, repetitionKey, isFivefoldRepetition, isLegal, isNullMoveLegal, perft, countLegalMoves, legalMovesInto, forEachLegalMove, MoveCounter, makeMove, makeNullMove, play, INITIAL_FEN, } from "./chess.js";
15
15
  export type { CastlingPlan, NullUndo } from "./chess.js";
16
- export { pgnImport, buildTree, build, pgnExport, TreeWrapperImpl, } from "./chesstree.js";
16
+ export { pgnImport, buildTree, build, pgnExport, TreeWrapperImpl, NAG_GLYPHS, glyphForNag, } from "./chesstree.js";
17
17
  export type { TreeWrapper, TreeNode, Path, Comment, Glyph, Clock, Shape, Eval as TreeEval, Game, Player, AnalyseData, } from "./chesstree.js";
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrE,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,cAAc,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,OAAO,EACP,eAAe,EACf,KAAK,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,IAAI,QAAQ,EAChB,IAAI,EACJ,MAAM,EACN,WAAW,GACZ,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrE,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,cAAc,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,eAAe,EACf,KAAK,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,IAAI,QAAQ,EAChB,IAAI,EACJ,MAAM,EACN,WAAW,GACZ,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -16,6 +16,6 @@ export { knightAttacks, kingAttacks, pawnAttacks, bishopAttacks, rookAttacks, qu
16
16
  export { kingAttackers } from "./attacks.js";
17
17
  export { CASTLE_PATH_LO, CASTLE_PATH_HI, CASTLE_CLEAR_STD, } from "./castling.js";
18
18
  // chess core (avoid duplicate Position and kingAttackers)
19
- export { dests, allDests, detectCastling, isCheck, isCheckFresh, isCheckmate, isStalemate, isInsufficientMaterial, isFiftyMoveDraw, isSeventyFiveMoveDraw, isThreefoldRepetition, isLegal, isNullMoveLegal, perft, countLegalMoves, legalMovesInto, forEachLegalMove, MoveCounter, makeMove, makeNullMove, play, INITIAL_FEN, } from "./chess.js";
19
+ export { dests, allDests, detectCastling, isCheck, isCheckFresh, isCheckmate, isStalemate, isInsufficientMaterial, isFiftyMoveDraw, isSeventyFiveMoveDraw, isThreefoldRepetition, repetitionKey, isFivefoldRepetition, isLegal, isNullMoveLegal, perft, countLegalMoves, legalMovesInto, forEachLegalMove, MoveCounter, makeMove, makeNullMove, play, INITIAL_FEN, } from "./chess.js";
20
20
  // chesstree integration (tree shapes + analysis API, folded into the root)
21
- export { pgnImport, buildTree, build, pgnExport, TreeWrapperImpl, } from "./chesstree.js";
21
+ export { pgnImport, buildTree, build, pgnExport, TreeWrapperImpl, NAG_GLYPHS, glyphForNag, } from "./chesstree.js";
@@ -0,0 +1,3 @@
1
+ import type { Position } from "./types.js";
2
+ export declare function compactPerft(pos: Position, depth: number): number | undefined;
3
+ //# sourceMappingURL=perftCompact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perftCompact.d.ts","sourceRoot":"","sources":["../src/perftCompact.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA6S3C,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAmE7E"}