Learn how to program a Chess game in C#!
Welcome to part 14 of my C# Chess tutorial.
This time we give pawns the ability to capture en passant.
First, we add two positions to the Board class.
When a pawn advances two squares, we store the position of the skipped square in the board.
This is acheived using a class dedicated to this move, which we call "DoubleMove".
For actually capturing en passant, we add another move class called "EnPassant".
We generate both of these moves from the Pawn class.
Finally, we make sure that skipped squares are reset so they are never "out of date".
Assets:
[ Ссылка ]
Source code is available here:
[ Ссылка ]
Chapters:
0:00 - Plan
0:09 - Capturing En Passant
1:02 - Store Skipped Position
3:19 - DoublePawn Move
6:12 - EnPassant Move
8:56 - Generate New Moves
10:19 - An Issue!
11:15 - Reset Skipped Position
12:24 - Success!
![](https://s2.save4k.ru/pic/X6uIMBsxte4/maxresdefault.jpg)