trigo / trigo-web /app /test_capture.js
k-l-lambda's picture
updated
502af73
const { TrigoGame } = require("../../inc/trigo/trigoGame.js");
const { StoneType } = require("../../inc/trigo/game.js");
const game = new TrigoGame({ x: 5, y: 5, z: 1 });
game.startGame();
console.log("=== Testing 2D Capture ===");
game.drop({ x: 2, y: 2, z: 0 }); // Black
console.log("After move 1, board[3][2][0]:", game.getBoard()[3][2][0]);
game.drop({ x: 3, y: 2, z: 0 }); // White (target)
console.log("After move 2, board[3][2][0]:", game.getBoard()[3][2][0]);
game.drop({ x: 4, y: 2, z: 0 }); // Black
console.log("After move 3, board[3][2][0]:", game.getBoard()[3][2][0]);
game.drop({ x: 3, y: 1, z: 0 }); // White elsewhere
game.drop({ x: 3, y: 3, z: 0 }); // Black
console.log("After move 5, board[3][2][0]:", game.getBoard()[3][2][0]);
game.drop({ x: 1, y: 1, z: 0 }); // White elsewhere
game.drop({ x: 2, y: 1, z: 0 }); // Black - should capture
console.log("\nAfter final move:");
console.log("board[3][2][0]:", game.getBoard()[3][2][0], "(should be 0/EMPTY if captured)");
console.log("Last step capturedPositions:", game.getLastStep()?.capturedPositions);
console.log("Captured counts:", game.getCapturedCounts());