I'm working on a chess program for comsci, and surprisingly, the pawn is the hardest piece to program.
If you're not familiar with chess, this is the basic move of the pawn:
If the pawn is in its initial position, it can move 2 spaces forward, however, subsequent moves can only be one space forward. Secondly, it captures oponents if they are exactly one space forward and one space left or right (one diagonal space) ahead of them.
I just need to figure out how to keep track of whether a piece has moved or not. I guess I can put an if statement somewhere that determines if the piece is in the starting location, but if a pawn moves to the other side of the board, it might be considered a starting location of the opponent's side. My head hurts...
Thanks for the help!