| View previous topic :: View next topic |
| Author |
Message |
H.G.Muller

Joined: 10 Mar 2006 Posts: 12776 Location: Amsterdam
|
Post subject: Re: Perishing Perft ! Posted: Tue May 22, 2007 7:50 am |
|
|
| GeoffW wrote: |
My makemove code uses the 0x88 delta trick you mentioned to figure out if in check, but I am currently doing this right at the end of makemove().
This is less than optimum as it would be best to do it at the start of makemove(), to save the move make and move undo code. That is much trickier to code however, so i am just contemplating that one now.
Where do you test for sideToMove in check ? At start or end of makemove() ? |
Quick Perft (which is actually the basis of Joker) does the self-check test after MakeMove, but only for King moves, e.p. captures. This to prevent the King from trying to hide behind himself, end because e.p. pins are not trivially detected (e.g. if both involved Pawns are n the pin line).
Castlings are King moves, but in the MakeMove part that moves the Rook it is checked if the Rook ends up in-check. (So illegal castlings are treated as self-checks.)
Other moves can never cause self-check, and thus do not have to be tested at all. This because the move generator does not generate illegal moves with pinned pieces. This is much more efficient: There are only 5 enemy sliders that could pin something, and most of those fail the 0x88 test for alignment with your King. If occasionally one is aligned, that piece is excluded from normal move generation, disabling many moves at once. This saves a lot of time compared to testing each move separately for the pin condition. If a pinned piece has moves along the pin line, they are generated in the code section that handles the pins, as it is already aware what the pin line is, and has already determined upto where the moves can go (from own King upto and including pinner).
As a fringe benifit, testing for the pins automatically tell you if you are in distant check yourself. Alternatively, if you test moves for delivering check to the opponent after they are made, you can at the same time without much extra work detect new pins as well, and differentially maintain a list of pinned pieces.
When you are in check before the move, your primary concern is not if your move puts you in check, but to get out of it. It helps if your 0x88 test already tells you if the move is a distant check or a contact check. In the latter case you can limit yourself to King moves and capture of the checker. (With non-pinned pieces. Note that a move of a pinned piece on the pin line can never capture the checker or block the check.) The distant case is a pain, and I could not devise any quicker way than simply generating all moves, and then doing the 0x88 test compared to own King to see if they fal on the check line, and if they do, test if they indeed block it. (Perhaps the latter could be still sped up by also having a 0x88 distance table, but checks are not sufficiently common to care very much how you handle them.)
How exactly you handle the castlings and e.p. captures is also completely irrelevant fr speed. |
|
| Back to top |
|
 |
|
| Subject |
Author |
Date/Time |
Perishing Perft ! |
GeoffW |
Thu May 17, 2007 4:26 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Thu May 17, 2007 5:07 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Thu May 17, 2007 5:10 pm |
Re: Perishing Perft ! |
pijl |
Thu May 17, 2007 5:11 pm |
Re: Perishing Perft ! |
Steven Edwards |
Thu May 17, 2007 5:18 pm |
Re: Perishing Perft ! |
Steven Edwards |
Thu May 17, 2007 6:16 pm |
Re: Perishing Perft ! |
Uri Blass |
Thu May 17, 2007 6:22 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Thu May 17, 2007 6:44 pm |
Re: Perishing Perft ! |
H.G.Muller |
Fri May 18, 2007 6:46 am |
Re: Perishing Perft ! |
Uri Blass |
Fri May 18, 2007 7:59 am |
Re: Perishing Perft ! |
Dann Corbit |
Fri May 18, 2007 9:25 pm |
Re: Perishing Perft ! |
Uri Blass |
Fri May 18, 2007 9:59 pm |
Re: Perishing Perft ! |
Dann Corbit |
Tue May 22, 2007 4:08 am |
Depth 9, SAN order |
Steven Edwards |
Thu May 17, 2007 7:20 pm |
Re: Depth 9, SAN order |
Reinhard Scharnagl |
Sat May 19, 2007 9:13 pm |
Re: Perishing Perft ! |
Uri Blass |
Thu May 17, 2007 5:52 pm |
Re: Perishing Perft ! |
H.G.Muller |
Thu May 17, 2007 6:11 pm |
Re: Perishing Perft ! |
GeoffW |
Sat May 19, 2007 3:46 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Sat May 19, 2007 5:05 pm |
Re: Perishing Perft ! |
GeoffW |
Sat May 19, 2007 5:29 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Sat May 19, 2007 5:53 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Sat May 19, 2007 6:16 pm |
Re: Perishing Perft ! |
GeoffW |
Sat May 19, 2007 8:14 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Sat May 19, 2007 8:34 pm |
Re: Perishing Perft ! |
Reinhard Scharnagl |
Sat May 19, 2007 8:42 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Sun May 20, 2007 12:16 am |
Re: Perishing Perft ! |
Reinhard Scharnagl |
Sun May 20, 2007 12:29 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Sun May 20, 2007 2:54 pm |
Re: Perishing Perft ! |
Ross Boyd |
Sat May 19, 2007 10:19 pm |
Re: Perishing Perft ! |
Filip Tvrzsky |
Sun May 20, 2007 1:51 am |
Re: Perishing Perft ! |
H.G.Muller |
Sun May 20, 2007 8:08 pm |
Re: Perishing Perft ! |
Filip Tvrzsky |
Sun May 20, 2007 9:08 pm |
Re: Perishing Perft ! |
GeoffW |
Sun May 20, 2007 10:56 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Mon May 21, 2007 10:26 pm |
Re: Perishing Perft ! |
H.G.Muller |
Tue May 22, 2007 7:50 am |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|