I'm not sure anymore, but I also expected some problems with kingmoves. That's why I check for a legal move.Gerd Isenberg wrote:Tony wrote: You have to check if the returning move is legal off course. ie also for checks etc.
TonyI think the only legality check needed for undoing black's move[1] are such cases Uri mentioned.Code: Select all
pos[0] white to move legal reversible white move[0], from[0]->to[0], pos[1] black to move legal reversible black move[1], from[1]->to[1], pos[2] white to move legal white move[2], from[2]->to[2], where to[2] == from[0] && from[2] == to[0] pos[3] black to move is black move[3] legal to repeat the position? pos[4] == pos[0] again
If black's move[1] was a distant move of a sliding piece, but the way back to from[1] is now interrupted, because the of to[2] is occupied again, thus to[2] (or from[0]) is member of the inbetween set of from[1]->to[1]. That is true for checks as well.
Tony