chess-tactics 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,10 @@ class TrapTactics extends _tactics_1.BaseTactic {
15
15
  return {
16
16
  type: "trap",
17
17
  attackedPieces: [
18
- { square: cosmeticTrap.trappedPiece.square, piece: chess.get(currentMove.to) },
18
+ {
19
+ square: cosmeticTrap.trappedPiece.square,
20
+ piece: cosmeticTrap.trappedPiece.piece,
21
+ },
19
22
  ],
20
23
  ...tacticalSequence,
21
24
  };
@@ -37,7 +40,10 @@ class TrapTactics extends _tactics_1.BaseTactic {
37
40
  if (this.pieceIsTrapped(fen, m)) {
38
41
  if (m.captured && _utils_1.PIECE_VALUES[m.piece] < _utils_1.PIECE_VALUES[m.captured]) {
39
42
  return {
40
- trappedPiece: { square: m.to, piece: m.captured },
43
+ trappedPiece: {
44
+ square: m.to,
45
+ piece: { type: m.captured, color: m.color === "w" ? "b" : "w" },
46
+ },
41
47
  trappingSquares: chess
42
48
  .moves({ square: m.to, verbose: true })
43
49
  .map((s) => s.to)
@@ -50,7 +56,10 @@ class TrapTactics extends _tactics_1.BaseTactic {
50
56
  (0, _utils_1.invertTurn)(chessCopy);
51
57
  if ((0, _utils_1.attackingSquareIsGood)(chessCopy.fen(), m.to)) {
52
58
  return {
53
- trappedPiece: { square: m.to, piece: m.captured },
59
+ trappedPiece: {
60
+ square: m.to,
61
+ piece: { type: m.captured, color: m.color === "w" ? "b" : "w" },
62
+ },
54
63
  trappingSquares: chess
55
64
  .moves({ square: m.to, verbose: true })
56
65
  .map((s) => s.to)
@@ -37,7 +37,7 @@ class SequenceInterpreter {
37
37
  let tacticalSequence = [];
38
38
  const chess = new chess_js_1.Chess(this.position);
39
39
  const moves = this.evaluation.sequence;
40
- for (let i = 0; i < Math.min(5, moves.length - 1); i++) {
40
+ for (let i = 0; i < moves.length; i++) {
41
41
  const move = moves[i];
42
42
  tacticalSequence.push(move);
43
43
  const position = chess.fen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chess-tactics",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/antonryoung02/chess-tactics.git"