Page 1 of 1

correct way to score promotions using MVV-LVA

Posted: Thu Jun 06, 2019 4:28 pm
by MahmoudUthman
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 ?

Re: correct way to score promotions using MVV-LVA

Posted: Thu Jun 06, 2019 6:43 pm
by Ras
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.

Re: correct way to score promotions using MVV-LVA

Posted: Thu Jun 06, 2019 10:37 pm
by Dann Corbit
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?

Re: correct way to score promotions using MVV-LVA

Posted: Fri Jun 07, 2019 12:51 pm
by Ras
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.

Re: correct way to score promotions using MVV-LVA

Posted: Fri Jun 07, 2019 1:48 pm
by Joost Buijs
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.

Re: correct way to score promotions using MVV-LVA

Posted: Fri Jun 07, 2019 3:01 pm
by elpapa
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.

Re: correct way to score promotions using MVV-LVA

Posted: Fri Jun 07, 2019 3:07 pm
by Dann Corbit
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.