From 31cc4448ec30d5a4021480417fc8690279257f95 Mon Sep 17 00:00:00 2001 From: tenmore <61951543+akatenmore@users.noreply.github.com> Date: Fri, 21 May 2021 10:42:01 +1200 Subject: [PATCH 1/7] Fixed enpassant bug --- src/validation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/validation.js b/src/validation.js index 2a98bac..2ffd043 100644 --- a/src/validation.js +++ b/src/validation.js @@ -151,7 +151,7 @@ export function makeMove(startCell, endCell, { isTest } = {}) { let isBackRank = endCell[1] === (invertColour(colour) === 'w' ? '8' : '1'); if(piece === 'p' && isBackRank){ if(!global.promotionPiece){ - console.log('NO PROMOTION PIECE FOUND'); + console.error('NO PROMOTION PIECE FOUND'); global.boardArray = beforeState; return false; } else { @@ -170,7 +170,7 @@ export function makeMove(startCell, endCell, { isTest } = {}) { const enpassantNumber = colour === 'w' ? (+endCell[1] - 1) : (+endCell[1] + 1); global.enpassantSquare = endCell[0] + enpassantNumber; } else { - global.enpassantSquare === '-'; + global.enpassantSquare = '-'; } if (isCheck(global.currentTurn)) { From 88e3bcd645c68657c4e6ce2762a10e992183cf94 Mon Sep 17 00:00:00 2001 From: tenmore <61951543+akatenmore@users.noreply.github.com> Date: Fri, 21 May 2021 10:47:47 +1200 Subject: [PATCH 2/7] Added Exports --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4d6dddf..ac22e13 100644 --- a/index.js +++ b/index.js @@ -13,10 +13,13 @@ import { setupBoard } from './src/helpers.js'; 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'; export default { setupBoard, createBoard, validation, findAllMoves, + isCheck, + gameEndingStatus, } From 527b2bdc0fbcfbb359d2ef5b0867f908c1a0d3c7 Mon Sep 17 00:00:00 2001 From: Nixinova <42429413+Nixinova@users.noreply.github.com> Date: Fri, 21 May 2021 10:48:46 +1200 Subject: [PATCH 3/7] Release 0.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6f0373b..19814f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fenfurnace", - "version": "0.1.0", + "version": "0.1.1", "description": "A chess engine designed to work entirely from a FEN position.", "main": "index.js", "type": "module", From f1f63bed22c7ae86b10629f95b7c2a8493451ac2 Mon Sep 17 00:00:00 2001 From: tenmore <61951543+akatenmore@users.noreply.github.com> Date: Fri, 21 May 2021 10:56:11 +1200 Subject: [PATCH 4/7] fixed bug with check --- src/validation/is-check.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]) ) { From 8262f68bf4bdf5622c46cb572b238831e021210c Mon Sep 17 00:00:00 2001 From: tenmore <61951543+akatenmore@users.noreply.github.com> Date: Fri, 21 May 2021 11:01:17 +1200 Subject: [PATCH 5/7] .js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ac22e13..dfd8718 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,7 @@ 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'; export default { setupBoard, createBoard, From 3e2d7d46469d6a2484b1d398bfcccdc000fb7e91 Mon Sep 17 00:00:00 2001 From: tenmore <61951543+akatenmore@users.noreply.github.com> Date: Fri, 21 May 2021 11:05:49 +1200 Subject: [PATCH 6/7] import undo --- index.js | 1 + src/validation.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index dfd8718..aa2c8f2 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ 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.js'; +import undo from './src/board/undo.js' export default { setupBoard, createBoard, 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; From e4b6eb2add0cac7c58ba20285474bb284e1cf8a8 Mon Sep 17 00:00:00 2001 From: Nixinova <42429413+Nixinova@users.noreply.github.com> Date: Fri, 21 May 2021 11:14:03 +1200 Subject: [PATCH 7/7] Release 0.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",