diff --git a/index.js b/index.js index ac22e13..8b6e8f8 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,10 @@ import createBoard from './src/board/create-board.js'; import * as validation from './src/validation.js'; import findAllMoves from './src/validation/all-moves.js'; import isCheck from './src/validation/is-check.js'; -import gameEndingStatus from './src/validation/ending'; + +import gameEndingStatus from './src/validation/ending.js'; +import undo from './src/board/undo.js' + export default { setupBoard, createBoard, diff --git a/package.json b/package.json index 19814f8..07cec8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fenfurnace", - "version": "0.1.1", + "version": "0.1.2", "description": "A chess engine designed to work entirely from a FEN position.", "main": "index.js", "type": "module", diff --git a/src/validation.js b/src/validation.js index 2ffd043..f5c2d5d 100644 --- a/src/validation.js +++ b/src/validation.js @@ -172,7 +172,7 @@ export function makeMove(startCell, endCell, { isTest } = {}) { } else { global.enpassantSquare = '-'; } - + //check checker if (isCheck(global.currentTurn)) { global.boardArray = beforeState; return false; diff --git a/src/validation/is-check.js b/src/validation/is-check.js index 90fd4b6..3476a2a 100644 --- a/src/validation/is-check.js +++ b/src/validation/is-check.js @@ -24,9 +24,9 @@ export default function isCheck(colour) { const pieceColour = pieces.getColour(cell); if ( - ((pieces.isWhite(pieceColour) && colour === 'b') + ((pieceColour === 'w' && colour === 'b') || - (pieces.isBlack(pieceColour) && colour === 'w')) + (pieceColour === 'b' && colour === 'w')) && validation.validateMove(cell, kingCells[colour]) ) {