+ 1

Chess problem

Given a board position in FEN format, your task is to find out all the move(s) that Pawn(s) of the playing side can make.

15th Sep 2017, 6:28 PM
Dinesh Kumar
Dinesh Kumar - avatar
2 ответов
+ 4
* Each pond could have a boolean that would indicate if it has moved yet Lets it be called hasMoved * If the pond has not moved, the pond can move up an extra space. The first space cannot have a piece on it. * If an opponent pond is on a forward diagonal to the selected pond, then the selected pond can move on that piece, to take it out. * If an opponent pond has moved a pond 2 spaces up, the first space is still eligable to be taken. That is, if the diagonal to the selected pond is that space. (This is called 'en passant' and is likely more difficult to implement) This can all be done by having a 2d array of each Piece. Piece[] board; (Or however your array is of board positions, I'm not sure) Either way this will have the positions of each piece on the board. This is what you can use to find out if there is a piece infront of, or diagonal to, your selected pond.
15th Sep 2017, 7:10 PM
Rrestoring faith
Rrestoring faith - avatar
0
thanku @Rrestoring faith
15th Sep 2017, 7:12 PM
Dinesh Kumar
Dinesh Kumar - avatar