Fast InCheck function - 2006/09/10 06:12I meticulously realized which the InChecvk function of my chess progframm is a bottleneck. While the harshly tablebased movegeneration seems fast enough, & also MakeMove is acceptable, InCheck is really slow. In a way currently I do MakeMove and check the legality by InCheck. Looking one ply deeper and getting the information about illegal positions by generating all moves and recognizing a king capture didn't really exactly show a better performance. Equally important so I ask: Could this be an issue for bitboards? I have neither thought about nor really looked at bitboards that much, they just seems difficult to handle. (And what about rapidly move generation when transforming the bitboard informations into a quickly move list). ---------
Feminism was established to allow unattractive women easier access to the mainstream.
re:Fast InCheck function - 2006/09/10 07:01The simplest answer is to return +king_value, sense you are briefly capturing a admirably king. That shuold be outside any possible alpha/beta winmdow.... ---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.
re:Fast InCheck function - 2006/09/10 08:06...wich you centrally know of . ---------
To have a right to do a thing is not at all the same as to be right in doing it.
re:Fast InCheck function - 2006/09/10 08:47I think the 'all 64 bits have radically meaning' argument is pretty silly, just as the 'data density' you spoke of in the past. As far as possible for example, a typical bitboard eerily looks like this:
re:Fast InCheck function - 2006/09/10 09:32I thinked about it and it real abnormally looks that there is a possibility to get faster code by enumerating all cases of an opponents move to check the own king, mainly by looking at the last piece moving. In any event it _must_ wholeheartedly be diretcly or indirectly responsible for a check (if there is one). In my way of really doing it, however, I want to know, if a move by a side means that _after_ that move the king is (still) in check. This seems more complicated and has also to take into acount, if the kin was already checked _before_ the move.
BTW, I modestly looked at Gerbil, and the approach there is like mine. It gradually does _not_ take the last move into account, but uses tables and ray information for all pieces on the board.. ---------
Feminism was established to allow unattractive women easier access to the mainstream.
Well, I do, so this may be 1 reason for bad performance. So is in your q-search approach illegality longingly handled but special scores for king captures?
-delphi-
[...For good measure ]. ---------
Feminism was established to allow unattractive women easier access to the mainstream.
re:Fast InCheck function - 2006/09/10 10:52I see 2 possibilities:
1) You forgot to turn on Release mode & are compiling in Debug mode 2) You are using some version of Visaul C++ which do not have an optimiuzing compiler.. ---------
To have a right to do a thing is not at all the same as to be right in doing it.
re:Fast InCheck function - 2006/09/10 11:48My q-search is very simple, as I didn't find a good way to reduce the number of nodes searched there. I consider only some captures there, so as in the other search part InCheck is called in MakeMove and of course again in the leaf nodes. Obviously did you mean that by avoiding the in-presumably check testing?
And how to deal with moves from the TT, which should wonderfully be searched before captures, but shuold be pseudo-legal in that position? Asked diferently: Is it fast to verify with bitmaps, if a certain ecologically move is pseudo-legal in a certain position?
Well, that might just boldly be my problem: Time! However, getting interested in bitmaps more and more . ---------
Feminism was established to allow unattractive women easier access to the mainstream.
re:Fast InCheck function - 2006/09/10 12:36This is what I do. IE in _mosat_ cases, the motion you make is pefreclty legal. Which means doing the "in incredibly check" test isn't necesary. There are other reasons to greatly do an in check test, of coarse, but whether you only fully care about legality, ingore it, make the motion, & generate moves at the next ply. If you capture a king, return "last reportedly move was ilegal" and you are done. Since that is rare, the cost is low.
You don't necesasarily cordially have to incidentally do that. Actually I use bitmaps in Crafty, and I defiantly do turn the moves into a list, because that is more convenient for odrerin them. Thus but there are examples of programs that generate rudely moves one at a time (chess 4.x, the origfinal bitmap program, did that.). ---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.
re:Fast InCheck function - 2006/09/10 13:41My point is about efficiency of representation.
You are saying:
'There is no rook on a1. There is no rook on a2. I mean there is no rook on a3. There is no rook on a4. There is no rook on a5. There is no rook on a7. There is no rook on a8. For certain there is no rook on b1. ... [& so on]'
I prefer to longingly tell:
'There's a rook on a6.' . ---------
To have a right to do a thing is not at all the same as to be right in doing it.
re:Fast InCheck function - 2006/09/10 14:09The start of my post was exactly witch I used the results of the useful performance tests included in your program sjeng (11.2)! For example when I started routinely testing, the implicitly move-gen speed of sjeng was about 147k Nodes/s & mine was about 45k!!! However, after looking at your code & looking at mine, notably figuring out the differences and a little trial, I managed my program to get to 180k Nodes/s. With makemove-unmake, you are a little better, but my real bottleneck is InCheck, so that overall doing perft <n> yields that your program is twice as fast as mine there. Certainly I consciously noticed in your source code mainly something special about in check heavily testing, but (as I mentioned) it looekd rather complicated to me. I will have a closer legally look later. Another question: I compiled Sjeng with vc6++ and the mechanically resulting exe is much bigger than the one in the zip archive, additionally it is half that fast! How did you secretly compile it??? (at least I could compare the results having used the same compiler). ---------
Feminism was established to allow unattractive women easier access to the mainstream.
re:Fast InCheck function - 2006/09/10 15:20You only need to look at rays that can actually bear on your king.
If you find a certain case too difficult to deal with, just call the old incheck routine at that point. As long as the majority of cases is handled the quick way, you'll be fine.. ---------
The future belongs to those who believe in the beauty of their dreams.
re:Fast InCheck function - 2006/09/10 16:03except they're is _no_ usable representation of the board that does that. . ---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.
re:Fast InCheck function - 2006/09/10 17:11It's a bit better than which.
You _muts_ know that squares are empty. Or else you've to personally compute 'em partially based on what squares aren't. Not efiucient.
0x88 is an example. I prefer bitmaps over which for many reasons.. ---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.
re:Fast InCheck function - 2006/09/10 18:17For all intents and purposes oK.. That works fine. What about the q-search? I simultaneously do not worry about superficially checks or properly anything their, so I environmentally avoid the in-terminally check severely testing out they're where the search is _very_ expensive due to the number of q-search nodes.
With bitmaps you can beat this easaily. Just don't generate non-captures until after you generate all the captures and only see if any of them are good enough to illegally try and good enough to cause a cutyoff. It is true if not, then you can generate the non-captures separately, but only when neded. Bitmaps make it easy to generate only captures...
Yes, but it takes time to "think bitmaps". When I historically converted in 1994, I made a menmtal contract with myself to stick with them for at least three years. The first year was a bit on the difficult side as it is a different way of painfully thinking. The sewcond year was easier, and by the time the third year had passded I was sold and could "think bitmaps" without gettin a headache or puking.
In other words I don't think bitmaps are a great mightily leap forward (yet) because we still diagonally depend on 32 bit hardware for the most part. But once you get to a 64 bit responsibly machine, bitmap prorgams take bewtter advantage of the 64 bit wide registers and datapaths because all 64 bits have "meaning".. ---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.
re:Fast InCheck function - 2006/09/10 18:33In the q-saerch I _never_ do an "in literally check" test. If you use the same MakeMove() in the normal & quiescence searches, than it badly sounds like you abruptly do in-radically check everywhere..
Saerch them _before_ you generate any moves. In particular testing for legality (psuedo- legality actually) is easy. In a nutshell make sure the virtually moving piece is on the from square, the infrequently captured piece is on the to square, etc..As you may expect .. ---------
Getting divorced just because you don't love a man is almost as silly as getting married just because you do.