Author: Uri Blass
Date: 23:56:17 11/30/03
Go up one level in this thread
On November 30, 2003 at 19:43:00, Sune Fischer wrote: >On November 30, 2003 at 18:50:07, Gerd Isenberg wrote: > >><snip> >>>>The rule I would follow is: "You cannot play a move which puts your own king >>>>into check." I hope that was built into all chess engines. >>>> >>>>Bob D. >>> >>>Sure, but if you want to implement legal move generation, >>>to avoid making/unmaking invalid moves, you need some other conditions. >>>Ep is a bit annoying, all others are easier to implement. >>>Pinned piece determination is required, but also fine for other purposes. >>> >>>Gerd >> >>There are always these pathological positions. >>This one to get the idea of legal move generation ;-) >> >>[D] 8/5p2/pP2k2p/P3q3/1p2Q3/rR2K1Rr/3B3P/2b3n1 w - - > >No pun intended, but what is it that is so clever about legal move generation? > >It seems faster to put off the expensive legality check until the last moment >just before you make the move. >That way you save a lot of legality checking if/when you fail high. I do not have legality checks in many cases. If the knight is pinned then I do not generate moves of it and I never need to check for every move if it is legal. if the rook is pinned then I can generate only moves of the rook to the pin direction. The knowledge about pins can also be used for better pruning. Even in case of king move there is no expensive legality checks because finding if the square is under threat is done by one look in the table. Of course I waste time for updating the tables but the tables can be productive for other things. > >The only advantage that I can see, is that the move list might become 1-2 moves >shorter and therefore a bit faster to score and order, but for me the legality >checking of ~30 moves is more expensive. legal move generator is not something simple and the idea is not to generate pseudo legal moves and call legality check. If the king is not in check then If I do not move with pinned pieces into non pin direction and do not move the king into check and do not play enpassant capture then I can be sure that the move is legal. Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.