Pins

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Pins

Post by cdani »

Henk wrote: Maybe give a penalty if a piece is undefended in middle game. But that may also be too costly.
You know what I will say :-)

For example in Stockfish:

Code: Select all

// Enemies not defended by a pawn and under our attack
    weak =   pos.pieces(Them)
          & ~ei.attackedBy[Them][PAWN]
          &  ei.attackedBy[Us][ALL_PIECES];
Fast and relative easy with bitboards :-)
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Pins

Post by Henk »

cdani wrote:
Henk wrote: Maybe give a penalty if a piece is undefended in middle game. But that may also be too costly.
You know what I will say :-)

For example in Stockfish:

Code: Select all

// Enemies not defended by a pawn and under our attack
    weak =   pos.pieces(Them)
          & ~ei.attackedBy[Them][PAWN]
          &  ei.attackedBy[Us][ALL_PIECES];
Fast and relative easy with bitboards :-)
I only use bugboards.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Pins

Post by Henk »

There are even more pins for instance after d3d4 knight can not move for white will play b5b6. So there are pieces that shield weak squares like square c7.

Maybe give a penalty to each weak square. But it might be difficult or expensive to detect weak squares.

[d] 1k1r1bnr/1pp1p3/5pp1/pPN1n2p/2P2B2/3P4/P3BPPP/1R1R2K1 w - - 0 22