En Passant not possible in "Without in-memory" mode
Closed this issue · 3 comments
kkalamarski commented
First of all, it's a great project - I'm using it as a base to build my chess AI.
I've noticed that in static mode en passant is not listed as a possible move.
Steps to reproduce:
FEN: rn1qk2r/pbp1nppp/1p2p3/3pP3/1bBP4/2N2N2/PPP2PPP/R1BQK2R w KQkq d6 0 7
Expected legal move: E5 takes D6
board object:
{
moves: {
C4: [
'B5', 'A6',
'D5', 'B3',
'D3', 'E2',
'F1'
],
F3: [ 'G5', 'H4', 'D2', 'G1' ],
A2: [ 'A3', 'A4' ],
B2: [ 'B3' ],
G2: [ 'G3', 'G4' ],
H2: [ 'H3', 'H4' ],
A1: [ 'B1' ],
C1: [ 'D2', 'E3', 'F4', 'G5', 'H6' ],
D1: [ 'D2', 'D3', 'E2' ],
E1: [ 'E2', 'F1', 'D2', 'G1' ],
H1: [ 'G1', 'F1' ]
},
pieces: {
A8: 'r',
B8: 'n',
D8: 'q',
E8: 'k',
H8: 'r',
A7: 'p',
B7: 'b',
C7: 'p',
E7: 'n',
F7: 'p',
G7: 'p',
H7: 'p',
B6: 'p',
E6: 'p',
D5: 'p',
E5: 'P',
B4: 'b',
C4: 'B',
D4: 'P',
C3: 'N',
F3: 'N',
A2: 'P',
B2: 'P',
C2: 'P',
F2: 'P',
G2: 'P',
H2: 'P',
A1: 'R',
C1: 'B',
D1: 'Q',
E1: 'K',
H1: 'R'
},
turn: 'white',
isFinished: false,
check: false,
checkMate: false,
castling: {
whiteLong: true,
whiteShort: true,
blackLong: true,
blackShort: true
},
enPassant: 'd6',
halfMove: 0,
fullMove: 7
}
running this code fails:
jsChess.move('rn1qk2r/pbp1nppp/1p2p3/3pP3/1bBP4/2N2N2/PPP2PPP/R1BQK2R w KQkq d6 0 7', 'E5', 'D6')
Error message: Invalid move from E5 to D6 for white
Keep up the good work!
josefjadrny commented
Hi @kkalamarski
firstly, let me thank you for your feedback!
I can confirm that you found a BUG! 👍
Thank you for #12 , but there is a new bug with this solution. Please check my review. Or, if you prefer, I can fix it on my own.
kkalamarski commented
That makes sense, I will update my PR later today 👍
josefjadrny commented
Thank you!