Author: Sune Fischer
Date: 04:06:34 05/07/03
Go up one level in this thread
On May 07, 2003 at 06:37:47, Uri Blass wrote: >>And so you generate the moves at depth 0 when you will not need them :) >> >>This because the way you check for legal moves are by going to the next ply to >>see if the king gets captured, right? >> >>Well this is incredibly slow, believe me it is faster to see if a move leaves >>the king in check. This can be done staticly quite fast, check if you move a >>pinned piece or if king goes to attacked square. > >Yes > >I practically do it in the generate move so I do not generate illegal moves in >the first place but movei is more complex and I have arrays that tell me if a >square is attacked or if a piece is pinned. Well we both do things differently because we use attack tables, but for "standard" move generators I've not been able to decide which I like best. It seems to me that doing the attack detection has a cost one way or the other, so in all those cases you fail high you can throw a lot of moves away which doesn't need to be checked for. If you hold off on doing the check until you actually make the move, then nothing is "wasted". Depends of course if it is much easier to detect the attack while generating them than while making them, but I don't see why that should the case. However, if one does expensive move ordering, like SEE, maybe in that case the table turns. >I agree that even for a simple program in most cases it is possible even to >avoid checking if the king is in check by detecting no king move and no move of >piece that is suspected to be a king but the first step for a simple program to >increase speed is simply checking after every move if the king is in check >instead of generating the list of moves. I think there are only three special cases, 1) you are in check and need to get out 2) moving the king safely to unattacked squares 3) not moving pinned pieces out of their pinned direction These are something one can optimize for later, for a start I think it is good enough to simply check if the king is put into a check. -S. >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.