Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: about in_check()

Author: Sune Fischer

Date: 07:06:47 06/15/03

Go up one level in this thread


On June 15, 2003 at 09:06:50, Bo Persson 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.
>
>And if you already have a MVV/LVA routine, it will pop up there automatically if
>you just score it higher than PxQ.
>
>
>>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.
>
>Except if it is faster than *always* verifiying the legality first. :-)
>
>The extra move generation (captures only?) will happen just sometimes, the
>legality check will be needed for every move. Which is fastest?

Yes, I mentioned that somewhere.
It is about the frequency of illegal moves versus the cost.

The thing that makes really makes it worth it IMO, is if you make a special
check evade generator.

-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.