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 

Outpost evaluation
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Lucas Braesch



Joined: 31 May 2010
Posts: 1756

PostPost subject: Re: Outpost evaluation    Posted: Sat Apr 14, 2012 2:28 pm Reply to topic Reply with quote

Ferdy wrote:

Try this out for a start, basic knight not attacked by enemy pawn and knight protected by friendly pawn, note this is only for white, you take care for the black Smile .

Code:
case KNIGHT:
               score[LIGHT] += knight_pcsq[i];

               //knight outpost for white
               //consider only if it is located inside rank 4 to 6 and file b to g (std board)
               if(COL(i) >= 1 && COL(i) <= 6 && ROW(i) <= 4 && ROW(i) >= 2){
                  //if square i is not attacked by enemy pawn
                  if(piece[i-9] != PAWN || color[i-9] != DARK){
                     if(piece[i-7] != PAWN || color[i-7] != DARK){

                        //visual debug
                        //print_board();
                        //printf("square %d, is not attacked by enemy pawn\n", i);

                        score[LIGHT] += 4;

                        //add bonus if this knight is protected by friendly pawn
                        //left pawn
                        if(piece[i+7] == PAWN && color[i+7] == LIGHT){
                           score[LIGHT] += 2;
                           //visual debug
                        }
                        //right pawn
                        if(piece[i+9] == PAWN && color[i+9] == LIGHT){
                           score[LIGHT] += 2;
                           //visual debug
                        }
                     }
                  }
               }

               break;

Thank you Fernando. After so many failed attempts, I finally got a significant improvement with an implementation inspired by your code. Here's what I do in case anyone is interested:
1/ if a knight is in the outpost zone (File C->F, Rank 4->6), bonus +2 (centipawns)
2/ if a knight that verifies 1/ is also defended by a friendly pawn then I score an additional +3

And I did the same with bishops with +1 and +2 instead of +2 and +3, and that gave a further (small but significant).

My code is a bit more bitboard oriented and avoids loops:
Code:

   static const uint64_t OutPostZone[NB_COLOR] = {
      0x00003C3C3C000000ULL,   // Rank 4->6, File C->F
      0x0000003C3C3C0000ULL   // Rank 3->5, File C->F
   };
...
      /* Knight outposts */
      fss = B->b[us][Knight] & OutPostZone[us] & ~B->st->attacks[them][Pawn];
      if ((count = count_bit(fss))) {
         e->op[us] += count * 2;
         e->eg[us] += count * 2;
         
         if ((count = count_bit(fss & B->st->attacks[us][Pawn]))) {
            e->op[us] += count * 3;
            e->eg[us] += count * 3;
         }
      }

      /* Bishop outposts */
      fss = B->b[us][Bishop] & OutPostZone[us] & ~B->st->attacks[them][Pawn];
      if ((count = count_bit(fss))) {
         e->op[us] += count;
         e->eg[us] += count;
         
         if ((count = count_bit(fss & B->st->attacks[us][Pawn]))) {
            e->op[us] += count * 2;
            e->eg[us] += count * 2;
         }
      }
Back to top
View user's profile Send private message
Display posts from previous:   
Subject Author Date/Time
Outpost evaluation Lucas Braesch Sun Mar 18, 2012 10:42 am
      Re: Outpost evaluation Ed Schroder Sun Mar 18, 2012 12:15 pm
            Re: Outpost evaluation Lucas Braesch Sun Mar 18, 2012 1:47 pm
                  Re: Outpost evaluation Matthew R. Brades Sun Mar 18, 2012 4:27 pm
                        Re: Outpost evaluation John Merlino Sun Mar 18, 2012 4:44 pm
                              Re: Outpost evaluation Matthew R. Brades Sun Mar 18, 2012 5:54 pm
                                    Re: Outpost evaluation Charles Roberson Sun Mar 18, 2012 8:07 pm
                  Re: Outpost evaluation Pio Korinth Sun Mar 18, 2012 7:38 pm
                        Re: Outpost evaluation Michael Hoffmann Sun Mar 18, 2012 8:35 pm
                              Re: Outpost evaluation Pio Korinth Sun Mar 18, 2012 9:30 pm
                                    Re: Outpost evaluation Pawel Koziol Sun Mar 18, 2012 10:29 pm
                  Re: Outpost evaluation Ed Schroder Mon Mar 19, 2012 12:20 pm
                        Re: Outpost evaluation Robert Purves Tue Mar 20, 2012 7:14 am
                              Re: Outpost evaluation Gabriel LEPERLIER Fri Apr 13, 2012 8:00 pm
                                    Re: Outpost evaluation Ferdinand Mosca Sat Apr 14, 2012 1:34 am
                                          Re: Outpost evaluation Gabriel LEPERLIER Sat Apr 14, 2012 7:24 am
                                          Re: Outpost evaluation Lucas Braesch Sat Apr 14, 2012 2:28 pm
                                                Re: Outpost evaluation Ferdinand Mosca Sat Apr 14, 2012 4:34 pm
                  Re: Outpost evaluation Robert Hyatt Sat Apr 14, 2012 4:16 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