Closed StillLearnin closed 8 years ago
as the readme states, there's no chess logic inside chessground. I.E. chessground does not know the rules of chess. They have to be provided by a third party. You have to tell chessground to remove the taken pawn.
Hey, i know this issue is closed since a long time, but for the people who use chessJs as a third party this is a simple and dirty workaround: use the .move() method of chessJS. This method return a object with 'flags' property. If the flag is : e that's a en passant standard capture. If you watch this flag, just load Chessground with the correct fen who is returned by ChessJS under the .fen() method. In my class called Engine:
var move = this.chess.move({ from: orig, to: dest, promotion: 'q' })
if (move.flags === 'e') {
this.cg.set({ fen: this.chess.fen() })
}
That's better than working with the .setPieces() method of Chessground.
When capturing an enemy pawn that has passed your pawn by moving two places, clicking your pawn shows that you can either move straight ahead or capture the enemy pawn.
After capturing the enemy pawn, the enemy pawn remains on the board but can't be moved.