Author: Dan Newman
Date: 01:34:00 02/03/01
Go up one level in this thread
On February 02, 2001 at 10:33:20, Robert Hyatt wrote: >On February 02, 2001 at 00:57:30, David Rasmussen wrote: > >>On February 01, 2001 at 18:43:58, Robert Hyatt wrote: >> >>>On February 01, 2001 at 15:26:43, David Rasmussen wrote: >>> >>>>On February 01, 2001 at 10:37:04, Robert Hyatt wrote: >>>> >>>>> >>>>>You can look at my code named "GenerateCheckEvasions()" but the idea is >>>>>this (simplified and maybe wrong): >>>>> >>>>>1. If I am checked by a single piece, capture it. >>>>> >>>>>2. If I am checked by a single sliding piece, interpose. >>>>> >>>>>3. If I am checked by either 1 or two pieces, move the king out of the check. >>>>> >>>>>for 3, you might think that I have to check for legality after generating a >>>>>king move, but it isn't needed. If the checking piece is a slider, I have to >>>>>move in any direction but +/- the checking direction. Bitmaps handle all of >>>>>this easily, so that I can produce moves that I _know_ are legal. >>>> >>>>OK, I am aware of the idea of a CheckEvasions() function. I just didn't see >>>>anybody talking about checking moves only. I assumed you meant you were able to >>>>generate _all_ moves legally, somehow. >>> >>> >>>No, sorry. Although it is probably possible to do so by bitboard tricks >>>dealing with diagonals/ranks/files passing through the king's square.. >> >>Yes, but can it be done without losing performance, or even with a performance >>gain overall? I guess we don't know. > > >I am not a fan of generating only legal moves for the general case. Since most >moves are legal, unless you start off in check, doing the extra legality work >is a headache, particularly since most of those moves likely won't be searched >anyway, thanks to alpha/beta. > >I did the check evasion code because there almost all moves produced by a normal >move generator will be illegal, and rejecting them takes longer to do after they >are generated and tried than it takes to simply not generate them in the first >place. I do a kind of odd variation of this in Shrike. I generate pseudo-legal check evasions. That is, I generate only moves that capture or block the checking piece and king moves (only king moves in the case of double check), but I don't immediately test to see if the king is left en prise. The reason for this is that I embedded the legality testing code inside make(), so I'd be doing extra work if I vetted the moves in the generator too. -Dan.
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.