Hi,
Regarding the MVV/LVA sorting.
The chess wiki speaks about the victim and the attacker-type.
So the sorting-function for qsort() does
int a = (victimValueA << 16) | (32767 - attackerValueA);
int b = (victimValueB << 16) | (32767 - attackerValueB);
return b - a;
This works.
The values for each type used are:
const int ChessPiece::evalVal[] = { 100, 325, 325, 500, 975, 10000 };
Now my question is: how do I include promotions in this?
I could for example set the lsb to either 1 or 0 but that does not include the type to which it promoted.
Any suggestions?
regards
MVV/LVA
Moderators: hgm, Rebel, chrisw
-
- Posts: 893
- Joined: Mon Jan 15, 2007 11:23 am
- Location: Warsza
Re: MVV/LVA
simple promotion without capture is scored as "I gain a queen (or whatever piece is promoted), but I lose a pawn". Promoting with capture, just add the value of promoted piece to victimValue.
Pawel Koziol
http://www.pkoziol.cal24.pl/rodent/rodent.htm
http://www.pkoziol.cal24.pl/rodent/rodent.htm
-
- Posts: 27809
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: MVV/LVA
I guess it is a bit more subtle than that. If you attack a Rook on the 8th rank that is protected by Knight with a Pawn and a Rook, it would come out much better when you play RxR, NxR, PxN=Q then when you play PxR=Q, NxQ, RxN. The NxR deserves to be captured before the PxR. You would be left with a Queen rather than a Knight. So promoting does not just increase the gain you get on the capture, but also your exposure. Basically you should score it like the attacker is a Queen (or whatever you promote to), not a Pawn.
You should also take into account that a 7th-rank Pawn is worth 2.5-3, not 1. So a non-capture promoting to Queen is like you capture a piece worth 6 with a Queen. That is, it is a HxL capture, and should really not be attempted if the target square is protected. (I.e. you should reduce the victim value to the SEE value of the exchange, like with all HxL captures.)
You should also take into account that a 7th-rank Pawn is worth 2.5-3, not 1. So a non-capture promoting to Queen is like you capture a piece worth 6 with a Queen. That is, it is a HxL capture, and should really not be attempted if the target square is protected. (I.e. you should reduce the victim value to the SEE value of the exchange, like with all HxL captures.)