Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: about in_check()

Author: Sune Fischer

Date: 17:14:12 06/16/03

Go up one level in this thread


On June 16, 2003 at 17:28:06, Filip Tvrzsky wrote:

>On June 15, 2003 at 04:48:58, Sune Fischer wrote:
>
>>On June 14, 2003 at 23:57:41, Russell Reagan wrote:
>>
>>>On June 14, 2003 at 19:34:12, Magoo wrote:
>>>
>>>>"Maybe it is possible not to check for check at all and just check if a capture
>>>>removes the king one ply later."
>>>>
>>>>Yes this is possible, but as i discoverd its really slow, in the early stages of
>>>>my program i did just what you say. The thing is if you are going to do a search
>>>>to depth D, you are really doing a search to depth D+1, which is much much
>>>>slower than doing a search to depth D and calling in_check() after each move.
>>>
>>>I think if you use the "capture the king" method of detecting illegal moves, you
>>>have to sort the move list first, and put "captures of the king" at the very
>>>top. Then if your program moves a piece that was pinned (exposing the king,
>>>illegal), the very first next move you will search will be the capture of the
>>>king. So you only visit one extra node, not one extra ply. If you don't sort the
>>>illegal moves to the top of your legal move list, then you will do a LOT of
>>>searching before you find the illegal move, and your program will probably be
>>>slow.
>>
>>Actually you don't need to make any of the moves or even sort the list to see if
>>the king is captured. You can start by scanning the movelist for a king capture.
>>The problem is that you generated moves in a illegal position (because your last
>>move was illegal), and that is just pure no good for nothing overhead.
>>
>>-S.
>
>IMHO better is just to break up the move generator immediately after detecting
>that the enemy king can be captured and to return some special value (normally
>my move generator returns the number of possible moves) which indicates to your
>search function that the position is illegal. I do it so.
>Filip

Yes perhaps, depends how much you have to mess up the move gen to do it, IMO.

The assumption is that the king capture is quite rare (say less than 1% are
pins), so most of the time you would need to move order and do the moves anyway.
Giving the king a high value would automaticly put it at the top of the
ordering, that way you only have to check 1 move for being a king capture.

Seems simpler to implement, it may even be faster.(?)

-S.



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.