Bill Rogers wrote:Fred your opening statement about chess pieces not caring about where they have been is not entire true. Pawns always must know where they have been as they can not move backwards and a king at times must also remember where he has been as in the case where he moved out of check?
If this seems like nit-picking, then I applogise it was only meant it the to point out a small but missed fact.
Bill
Not at all Bill, I appreciate your comment and while I agree in chess terms, I have not stored this information with a piece object. Not saying my way is better or anything, but in my program a piece doesn't really move or keep track of itself, if that's what you are implying. Therefore objectification is not a must. The program only knows that a character 'P' occupies a certain array cell. And because it is an upper case P, it will not attempt to transfer the character to an array cell with a larger row index.
See what I mean about it doesn't matter where the pawn has been? Likewise for en passant, There is a variable called epTarget which contains the co-ordinate of the enpassant target square. So en-passant is a property of the position, not the pawn.
like wise with castling priveleges. The king does not remember that it has moved. As soon as a character 'K', or 'R', is shifted within the array, , a game variable of type boolean is set to say that White can no longer castle.
