correct way to score promotions using MVV-LVA

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

correct way to score promotions using MVV-LVA

Post 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 ?
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: correct way to score promotions using MVV-LVA

Post by Ras »

MahmoudUthman wrote: Thu Jun 06, 2019 6:28 pmdo 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: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: correct way to score promotions using MVV-LVA

Post by Dann Corbit »

Ras wrote: Thu Jun 06, 2019 8:43 pm
MahmoudUthman wrote: Thu Jun 06, 2019 6:28 pmdo 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: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: correct way to score promotions using MVV-LVA

Post by Ras »

Dann Corbit wrote: Fri Jun 07, 2019 12:37 amIncluding 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: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: correct way to score promotions using MVV-LVA

Post by Joost Buijs »

Ras wrote: Fri Jun 07, 2019 2:51 pm
Dann Corbit wrote: Fri Jun 07, 2019 12:37 amIncluding 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: 211
Joined: Sun Jan 18, 2009 11:27 pm
Location: Sweden
Full name: Patrik Karlsson

Re: correct way to score promotions using MVV-LVA

Post by elpapa »

Joost Buijs wrote: Fri Jun 07, 2019 3:48 pm
Ras wrote: Fri Jun 07, 2019 2:51 pm
Dann Corbit wrote: Fri Jun 07, 2019 12:37 amIncluding 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: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: correct way to score promotions using MVV-LVA

Post by Dann Corbit »

Joost Buijs wrote: Fri Jun 07, 2019 3:48 pm
Ras wrote: Fri Jun 07, 2019 2:51 pm
Dann Corbit wrote: Fri Jun 07, 2019 12:37 amIncluding 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.