ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Undefended pieces
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Gary



Joined: 12 Dec 2006
Posts: 338

PostPost subject: Undefended pieces    Posted: Mon Mar 05, 2012 11:20 pm Reply to topic Reply with quote

I thought I would try this out after the recent thread on loose pieces. The idea is that in the opening, it's good to have pieces defended by each other. So, pieces that are undefended get a small penalty. This is in addition to the penalty they may receive by being attacked by an enemy piece.

Unfortunately, it did not seem to help. It was decently promising in 16k games at 5ply fixed depth matches, showing +3-4 elo. Due to the loss of speed, this didn't carry over to timed matches that I could see.

The current version of the modification for Stockfish is below. I really like that Marco has posted Stockfish on github! Forking and playing around with the code is so easy. I should note that the branch of the fork is available here: https://github.com/glinscott/Stockfish/tree/undefended_pieces.

Code:

const Score UndefendedPenalty[] = {
  S(0, 0), S(3, 0), S(12, 2), S(12, 2), S(25, 6), S(45, 15)
};

// Enemy pieces not defended by a pawn
Bitboard weakEnemies =  pos.pieces(Them)
                  & ~ei.attackedBy[Them][PAWN];

Bitboard undefended = weakEnemies & ~ei.attackedBy[Them][0] & ~(Rank1BB | Rank8BB);
if (undefended)
{
  const int multipliers[] = { 0, 1, 3, 6, 12, 22, 36, 36, 36, 36, 36, 36, 36, 36, 36 };

  int undefendedCount = 0;
  while (undefended)
  {
    Square s = pop_1st_bit(&undefended);
    PieceType pt = type_of(pos.piece_on(s));
    if (pt != KING)
    {
      score += UndefendedPenalty[pt];
      if (pt != PAWN)
        undefendedCount++;
    }
  }
  score = (multipliers[undefendedCount] * score) / 32;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Subject Author Date/Time
Undefended pieces Gary Mon Mar 05, 2012 11:20 pm
      Re: Undefended pieces Marco Costalba Tue Mar 06, 2012 7:04 am
      Re: Undefended pieces Joona Kiiski Tue Mar 06, 2012 4:31 pm
            Re: Undefended pieces Gary Wed Mar 07, 2012 1:59 am
                  Re: Undefended pieces Marco Costalba Wed Mar 07, 2012 6:20 am
                  Re: Undefended pieces Gary Mon Mar 19, 2012 1:55 am
                        Re: Undefended pieces Marco Costalba Mon Mar 19, 2012 8:47 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
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




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads