Author: Tony Werten
Date: 06:20:31 07/01/04
Go up one level in this thread
On July 01, 2004 at 04:39:24, Gerd Isenberg wrote:
>On July 01, 2004 at 02:50:35, Tony Werten wrote:
>
>>Hi all,
>>
>>although I like the principle of bitboards, it really bothers me that I can't
>>seem to find a decent/fast way to evaluate weighted safe squares.
>>
>>Suppose I want to (simple) evaluate a rook, I generate a bitboard with all
>>reachable squares and mask off the squares attacked by lower pieces (that's no
>>problem).
>>
>>(This doesn't exacly generate safe squares, only the ones that aren't attacked
>>at all by opponents pieces are, for the remaining squares one would need a SEE,
>>but that's not the point )
>>
>>Now I can use this bitboard ( say rook on e4 ), mask the rank state, and look in
>>a precomputed table how this rankstate scores on an e rank. No problem.
>>
>>But how to do the files ? If I use the rotated board, I need to have the
>>opponents attackboard in this rotated board as well, wich would be very costly
>>to compute (ie also for the bishops,queens ) and very complicated.
>>
>>Any ideas ? Am I missing something ?
>>
>>BTW, doing a popcount isn't a solution, since it violates the elegance of
>>bitboards ( and is slow ?)
>
>Ok, bitscan traversing and psq-lookup is a even more violation IMHO ;-)
:) That's what I meant. Popcount will only give an unweighted value.
>
>For safe rook attacks one may look for boolean pattern/properties (depending on
>the game state). Intersect the attack set with several small areas of the board,
>like center, remaining extended center, squares near opposite or own king,
>passers, squares behind passers or other movable pawns e.g. to support a
>minority attack, squares on open/halfopen files, squares on some rook
>trajetories to opposite king and what ever else.
>
>With those sets, look whether they are empty and if not, probably look whether
>the population count is greater one.
OK, that's a different approach. Rook, knight and bishop can at most attack 2
squares in the (centre) centre. That gives some possibilities to play with.
>
>That may be implemented loopless and with some preconditions:
>
>if ( safeRookAttacks )
>{
> set = safeRookAttacks & someAreaOfInterest;
> bunus += f1*(set!=0) + f2*((set&(set-1))!=0);
I know about conditional moves, but are there conditional multiplies ?
But even with some conditional stuff fiddling, I have to agree with Vincent on
this, this would leave a horrible amount of patterns. That would definately have
to be "write once, never touch it again" code.
Tony
> ...
>}
>
>Of course such statements "cry" for MMX,SSE2,Itanium or AltiVec SIMD
>instructions like pcmpeq to build -1|0 masks to "and" with. Itanium has popcnt
>instruction, and there are rumors that AMD64 has undocumented popcnt too,
>somewhere in the bt opcode range.
>
>SIMD within a register (SWAR) popcount looks relative expensive, but up to four
>or even more popcounts may be processed simultaniously, only with a little more
>time than one, by keeping all units busy. One may combine attack sets, e.g. from
>knights(2)/bishops(1) to "odd" and "atLeasstTwo" bitboards with five bitwise
>operations to safe one additional popcount per disjoint set too.
>
>Gerd
>
>>
>>Tony
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.