Author: Dieter Buerssner
Date: 12:20:58 12/05/03
Go up one level in this thread
On December 05, 2003 at 14:18:27, Georg v. Zimmermann wrote: >just had a little idea and was wondering whether anyone of you is doing that. >When in check there are obviously two ways to generate moves, either flip >through all pieces and see whether they can capture attacker/ move in between, ... and king moves, of course. >or flip through the in-between squares and see whether pieces can move there. in-between obviously includes the checking piece, here. >Now usually b) will be faster. But in some positions when the attacker is far >aways from the king and few pieces are left, a) will be faster. I wonder if >someone has 2 versions and uses a) or b) depending on the board situation ? It >is an insignificant gain in an insignificant function, I know. But still ... I cannot answer your concrete question. But a similar problem can be an Incheck-routine. To detect, if you are in check, two approaches can be: a) Loop over the opponent pieces, and see, if one checks my K; b) "Generate" (reverse) moves for the king square, assuming it can be any sort of piece, and see, if it will hit an opponent piece of the right kind. With a full board, b) can be faster, while with an empty board a) can be faster. I change between those two alternatives depending on material on board (also, at root I do some more heuristics, like seeing if the K has a "good" pawn shield in front of him - which will favor b). For my engine, this was a bit faster in general, than just using one method all the time. The engine decides about the method to use for Incheck() after each root move (by setting a function pointer). Regards, Dieter
This page took 0.01 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.