correct way to score promotions using MVV-LVA

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 10:54 pm

correct way to score promotions using MVV-LVA

Post by MahmoudUthman » Thu Jun 06, 2019 4:28 pm

Stockfish used to do this for captures:

Code: Select all

 for (auto& m : *this)
      if (type_of(m) == ENPASSANT)
          m.value = PieceValue[MG][PAWN] - Value(PAWN);

      else if (type_of(m) == PROMOTION)
          m.value =  PieceValue[MG][pos.piece_on(to_sq(m))] - Value(PAWN)
                   + PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN];
      else
          m.value =  PieceValue[MG][pos.piece_on(to_sq(m))]
                   - Value(type_of(pos.moved_piece(m)));
resulting in the following order for captures & promotions:

Code: Select all

From/Pr	To
Queen   Queen   Promotion
Rook    Queen   Promotion
Queen   Rook    Promotion
Bishop  Queen   Promotion
Queen   Bishop  Promotion
Knight  Queen   Promotion
Queen   Knight  Promotion
Pawn    Queen   
Queen   Pawn    Promotion
Knight  Queen   
Bishop  Queen   
Rook    Queen   
Queen   Queen   
King    Queen   
Rook    Rook    Promotion
Queen   Null    Promotion
Bishop  Rook    Promotion
Rook    Bishop  Promotion
Knight  Rook    Promotion
Rook    Knight  Promotion
Bishop  Bishop  Promotion
Knight  Bishop  Promotion
Bishop  Knight  Promotion
Knight  Knight  Promotion
Pawn    Rook    
Rook    Pawn    Promotion
Knight  Rook    
Bishop  Rook    
Rook    Rook    
Queen   Rook    
King    Rook    
Rook    Null    Promotion
Pawn    Bishop  
Bishop  Pawn    Promotion
Knight  Bishop  
Bishop  Bishop  
Rook    Bishop  
Queen   Bishop  
King    Bishop  
Pawn    Knight  
Knight  Pawn    Promotion
Knight  Knight  
Bishop  Knight  
Rook    Knight  
Queen   Knight  
King    Knight  
Bishop  Null    Promotion
Knight  Null    Promotion
Pawn    Pawn    
Knight  Pawn    
Bishop  Pawn    
Rook    Pawn    
Queen   Pawn    
King    Pawn
but searching this forum I found multiple posts with different ordering schemes, some of which place all promotions after all non losing captures to reduce the search tree size,...etc.
which one is better in general & do you use different schemes in the main search than in Qsearch ?

Ras
Posts: 1162
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: correct way to score promotions using MVV-LVA

Post by Ras » Thu Jun 06, 2019 6:43 pm

MahmoudUthman wrote:
Thu Jun 06, 2019 4:28 pm
do you use different schemes in the main search than in Qsearch ?
You can drop underpromotion from quiescence.
Rasmus Althoff
https://www.ct800.net

Dann Corbit
Posts: 10207
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: correct way to score promotions using MVV-LVA

Post by Dann Corbit » Thu Jun 06, 2019 10:37 pm

Ras wrote:
Thu Jun 06, 2019 6:43 pm
MahmoudUthman wrote:
Thu Jun 06, 2019 4:28 pm
do you use different schemes in the main search than in Qsearch ?
You can drop underpromotion from quiescence.
Including underpromotion to knight?
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

Ras
Posts: 1162
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: correct way to score promotions using MVV-LVA

Post by Ras » Fri Jun 07, 2019 12:51 pm

Dann Corbit wrote:
Thu Jun 06, 2019 10:37 pm
Including underpromotion to knight?
Yes, it's not worth the effort in QS. In main search however, underpromotions should be searched.
Rasmus Althoff
https://www.ct800.net

Joost Buijs
Posts: 991
Joined: Thu Jul 16, 2009 8:47 am
Location: Almere, The Netherlands

Re: correct way to score promotions using MVV-LVA

Post by Joost Buijs » Fri Jun 07, 2019 1:48 pm

Ras wrote:
Fri Jun 07, 2019 12:51 pm
Dann Corbit wrote:
Thu Jun 06, 2019 10:37 pm
Including underpromotion to knight?
Yes, it's not worth the effort in QS. In main search however, underpromotions should be searched.
Even in main search you can omit under-promotions to bishop, at least I've never seen a game where under-promotion to bishop led to anything useful.

elpapa
Posts: 203
Joined: Sun Jan 18, 2009 10:27 pm
Location: Sweden
Full name: Patrik Karlsson

Re: correct way to score promotions using MVV-LVA

Post by elpapa » Fri Jun 07, 2019 3:01 pm

Joost Buijs wrote:
Fri Jun 07, 2019 1:48 pm
Ras wrote:
Fri Jun 07, 2019 12:51 pm
Dann Corbit wrote:
Thu Jun 06, 2019 10:37 pm
Including underpromotion to knight?
Yes, it's not worth the effort in QS. In main search however, underpromotions should be searched.
Even in main search you can omit under-promotions to bishop, at least I've never seen a game where under-promotion to bishop led to anything useful.
It happens once in 33,000 games according to Wikipedia.

Dann Corbit
Posts: 10207
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: correct way to score promotions using MVV-LVA

Post by Dann Corbit » Fri Jun 07, 2019 3:07 pm

Joost Buijs wrote:
Fri Jun 07, 2019 1:48 pm
Ras wrote:
Fri Jun 07, 2019 12:51 pm
Dann Corbit wrote:
Thu Jun 06, 2019 10:37 pm
Including underpromotion to knight?
Yes, it's not worth the effort in QS. In main search however, underpromotions should be searched.
Even in main search you can omit under-promotions to bishop, at least I've never seen a game where under-promotion to bishop led to anything useful.
It happens quite a bit in chess puzzles because it gets deliberately designed into some problems.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

Post Reply