Evaluate the pieces mobility

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Evaluate the pieces mobility

Post by Daniel Anulliero »

Hi all
Last week I put some evaluation of mobility in Isa . Very primitive scheme :
"every empty squares are ok " :?
Ihave four array , for each piece (Knight , bishop , rook , queen) :

Code: Select all

Knight table :
int p_mob[9] = {-10, -8, -6, -4, 0, 6, 8, 12, 15};

Bishop table : 
int p_mob[14] = {-10, -9, -8, -7, -5, -2, 0, 2, 4, 6, 8, 10, 12, 15};

Rook table:
int p_mob[15] = {-10, -9, -8, -7, -6, -5, -4, 0, 2, 4, 6, 8, 10, 12, 12};

Queen table : 
int p_mob[28] = {-10, -10, -9, -9, -8, -8, -7, -7, -6, -6, -5, -5, -4, -2,0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 12};
What do you think about these value ?
I don't know if I can have the same values for each pièces (from -10 to 12/15)

give me your advice about my scheme
Thanks !
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Evaluate the pieces mobility

Post by yurikvelo »

Stockfish 7

Code: Select all

  // MobilityBonus[PieceType][attacked] contains bonuses for middle and end
  // game, indexed by piece type and number of attacked squares in the MobilityArea.
  const Score MobilityBonus[][32] = {
    {}, {},
    { S(-75,-76), S(-56,-54), S(- 9,-26), S( -2,-10), S(  6,  5), S( 15, 11), // Knights
      S( 22, 26), S( 30, 28), S( 36, 29) },
    { S(-48,-58), S(-21,-19), S( 16, -2), S( 26, 12), S( 37, 22), S( 51, 42), // Bishops
      S( 54, 54), S( 63, 58), S( 65, 63), S( 71, 70), S( 79, 74), S( 81, 86),
      S( 92, 90), S( 97, 94) },
    { S(-56,-78), S(-25,-18), S(-11, 26), S( -5, 55), S( -4, 70), S( -1, 81), // Rooks
      S(  8,109), S( 14,120), S( 21,128), S( 23,143), S( 31,154), S( 32,160),
      S( 43,165), S( 49,168), S( 59,169) },
    { S(-40,-35), S(-25,-12), S(  2,  7), S(  4, 19), S( 14, 37), S( 24, 55), // Queens
      S( 25, 62), S( 40, 76), S( 43, 79), S( 47, 87), S( 54, 94), S( 56,102),
      S( 60,111), S( 70,116), S( 72,118), S( 73,122), S( 75,128), S( 77,130),
      S( 85,133), S( 94,136), S( 99,140), S(108,157), S(112,158), S(113,161),
      S(118,174), S(119,177), S(123,191), S(128,199) }
  };

....

        int mob = popcount<Pt == QUEEN ? Full &#58; Max15>&#40;b & mobilityArea&#91;Us&#93;);

        mobility&#91;Us&#93; += MobilityBonus&#91;Pt&#93;&#91;mob&#93;;

  // Do not include in mobility area squares protected by enemy pawns, or occupied
  // by our blocked pawns or king.
  Bitboard mobilityArea&#91;&#93; = &#123;
    ~&#40;ei.attackedBy&#91;BLACK&#93;&#91;PAWN&#93; | blockedPawns&#91;WHITE&#93; | pos.square<KING>&#40;WHITE&#41;),
    ~&#40;ei.attackedBy&#91;WHITE&#93;&#91;PAWN&#93; | blockedPawns&#91;BLACK&#93; | pos.square<KING>&#40;BLACK&#41;)
  &#125;;


  // Evaluate all pieces but king and pawns
  score += evaluate_pieces<DoTrace>&#40;pos, ei, mobility, mobilityArea&#41;;
  score += mobility&#91;WHITE&#93; - mobility&#91;BLACK&#93;;

Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Evaluate the pieces mobility

Post by Henk »

LISTEN to the experts and start CLONING Stockfish NOW. No need to reinvent the wheel.
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Evaluate the pieces mobility

Post by Daniel Anulliero »

HENK : your answer are just like always : very useful , kind and clever lol
Personally I dont want to clone anything , I listen experts advices , not you , that's why your engine is what it is ..
Better you Concentrate your efforts to make Skipper à chess player instead of writing silly things

Sorry for that , mister admin , but this guy make me nervous. ...
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Evaluate the pieces mobility

Post by yurikvelo »

Henk wrote:LISTEN to the experts and start CLONING Stockfish NOW. No need to reinvent the wheel.
Why cloning. Saving time to understand mistakes.

"every empty squares are ok " missing very important thing "do not count squares protected by enemy pawns, or occupied by our blocked pawns or king"

If he is not going to implement this counter, it will break the whole Mobility idea.
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Evaluate the pieces mobility

Post by Daniel Anulliero »

yurikvelo wrote:
Henk wrote:LISTEN to the experts and start CLONING Stockfish NOW. No need to reinvent the wheel.
Why cloning. Saving time to understand mistakes.

"every empty squares are ok " missing very important thing "do not count squares protected by enemy pawns, or occupied by our blocked pawns or king"

If he is not going to implement this counter, it will break the whole Mobility idea.
Yes I know what you mean , but my engine is in developement , and so weak , I add things gradualy to see the improvement ... if there is an improvment :)

just adding this primitive mobility eval , improve Isa by 25 elo (ok , just 60 games played +25 elo with +-72 error bar lol)
playing 600 games right now


last thing : no answer to henk's posts , he is just a troll :wink:
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: Evaluate the pieces mobility

Post by F. Bluemers »

Daniel Anulliero wrote:Hi all
Last week I put some evaluation of mobility in Isa . Very primitive scheme :
"every empty squares are ok " :?
Ihave four array , for each piece (Knight , bishop , rook , queen) :

Code: Select all

Knight table &#58;
int p_mob&#91;9&#93; = &#123;-10, -8, -6, -4, 0, 6, 8, 12, 15&#125;;

Bishop table &#58; 
int p_mob&#91;14&#93; = &#123;-10, -9, -8, -7, -5, -2, 0, 2, 4, 6, 8, 10, 12, 15&#125;;

Rook table&#58;
int p_mob&#91;15&#93; = &#123;-10, -9, -8, -7, -6, -5, -4, 0, 2, 4, 6, 8, 10, 12, 12&#125;;

Queen table &#58; 
int p_mob&#91;28&#93; = &#123;-10, -10, -9, -9, -8, -8, -7, -7, -6, -6, -5, -5, -4, -2,0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 12&#125;;
What do you think about these value ?
I don't know if I can have the same values for each pièces (from -10 to 12/15)

give me your advice about my scheme
Thanks !
for queenmob Dirty only used to count squares not attacked by enemy pawns,
It does this now for all pieces,but for the other pieces it seems a wash.
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: Evaluate the pieces mobility

Post by F. Bluemers »

Henk wrote:LISTEN to the experts and start CLONING Stockfish NOW. No need to reinvent the wheel.
Who are these experts?
Any names?
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Evaluate the pieces mobility

Post by Henk »

Daniel Anulliero wrote:HENK : your answer are just like always : very useful , kind and clever lol
Personally I dont want to clone anything , I listen experts advices , not you , that's why your engine is what it is ..
Better you Concentrate your efforts to make Skipper à chess player instead of writing silly things

Sorry for that , mister admin , but this guy make me nervous. ...
Chess market is saturated every minute you spent on it is a waste.
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: Evaluate the pieces mobility

Post by F. Bluemers »

Henk wrote:
Daniel Anulliero wrote:HENK : your answer are just like always : very useful , kind and clever lol
Personally I dont want to clone anything , I listen experts advices , not you , that's why your engine is what it is ..
Better you Concentrate your efforts to make Skipper à chess player instead of writing silly things

Sorry for that , mister admin , but this guy make me nervous. ...
Chess market is saturated every minute you spent on it is a waste.
Still no excuse to T**LL others