SEE and en passant

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: SEE and en passant

Post by brianr »

bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: SEE and en passant

Post by Don »

BubbaTough wrote:
bob wrote:
BubbaTough wrote:
Do not discard any pawn captures/promotions; just try them all without bothering with a SEE score.

How can a pawn capture can ever be losing, and at worst not even (under SEE)?
Hi Brian,

When I tried a superset of this (don't do SEE when capturing a piece >= the capturer) it did not seem to help (in fact it hurt results slightly) assumably due to move ordering in the Q search. Has your finding been different?

-Sam
I suspect he doesn't use that score for ordering, just for inclusion/exclusion. Most are using MVV/LVA to order the captures that pass the inclusion / exclusion test, so the above is just an efficiency issue for me. No reason to use Swap() to evaluate a capture if it is pxanything, as it can't possibly be a SEE loser. And since we don't need the SEE score if we know it doesn't lose material, it passes the inclusion test and we resort to MVV/LVA which doesn't change at all so long as you don't exclude moves you would have previously included.

I found that his test simply made crafty slightly faster, no change in total nodes searched whatsoever.
Ahh. It is unintuitive to me that MVV/LVA is better than see order. It seems to me if you are going to go through the bother of doing SEE, you might as well use the superior information. Alas, intuition is not always right. If you are going to skip SEE for pawn captures, why not skip SEE for the superset of cases I described: capturer <= captured. I suspect it will very minorly speed up your very minor crafty speedup :).

-Sam
There have been a ton of discussions on this, but the bottom line is that there is definitely value in capturing the highest values piece first unless it is actually losing. Put the losers late in the list, but everything else you might as well use MVV/LVA. There is a very minor reduction in nodes searched when done this way - hardly noticeably but many program authors have noticed it.

But you can also do optimizations on see() if all you want to know is whether a move is losing. So you might get a very minor reduction in nodes, and in addition a minor speedup - you can get your cake and eat it too!

I agree that it is unintuitive why a winning capture could be better than an even capture - for instance QxQ is better than PxN even if neither is losing. But the answer seems to be two-fold:

1. By capturing the queen first, you reduce the tree - no queen running around now.

2. Delaying PxN is not the same as throwing it away - it will still be possible on the next move as the opponent must respond to QxQ. So little real damage has been done.

It's probably the case that in many positions PxN will have the greatest benefit to tree size, but statistical evidence seems to indicate that on average QxQ is still best, even if the Queen is subject to recapture. Probably because if you don't take the queen now, the queen can stir up more tactics, captures, etc. The trick is to reduce the tree as soon as possible by getting rid of the big pieces and everything else is very quickly played out.

Does that make more sense now?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: SEE and en passant

Post by bob »

brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: SEE and en passant

Post by Don »

bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Your forum post had almost the same content as a post I just made a few minutes ago! Anyway, I included in my post some information about why QxQ might be better than PxN even though PxN is an obvious win of material and QxQ may not be.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: SEE and en passant

Post by bob »

Don wrote:
bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Your forum post had almost the same content as a post I just made a few minutes ago! Anyway, I included in my post some information about why QxQ might be better than PxN even though PxN is an obvious win of material and QxQ may not be.
I think the idea makes sense, but requires a bit of thought to really follow. Any time you play QxQ your opponent has a pretty forced response, leaving PxN still playable most of the time. The worst-case is those queen-foraging positions where the queens invade and eat pawns and stuff left and right blowing up the q-search.

It is also another example of why logic doesn't always lead to the best solution. These trees we search are quite unusual in their size and shape, and quite often logic doesn't fit at all.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: SEE and en passant

Post by Don »

bob wrote:
Don wrote:
bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Your forum post had almost the same content as a post I just made a few minutes ago! Anyway, I included in my post some information about why QxQ might be better than PxN even though PxN is an obvious win of material and QxQ may not be.
I think the idea makes sense, but requires a bit of thought to really follow. Any time you play QxQ your opponent has a pretty forced response, leaving PxN still playable most of the time. The worst-case is those queen-foraging positions where the queens invade and eat pawns and stuff left and right blowing up the q-search.
Yes, I made that exact point that PxN does not go away - it's still usually playable.

It is also another example of why logic doesn't always lead to the best solution. These trees we search are quite unusual in their size and shape, and quite often logic doesn't fit at all.
Logic always fits, but it has to be correct logic that takes everything relevant into consideration and that is where us puny humans fall short!

It's sort of like the moon conspiracy people, who say the moon landings of 40 years ago were faked. They back all of this up with logic, but the logic is seriously flawed and does not consider all the actual facts.
Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: SEE and en passant

Post by Pablo Vazquez »

bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Another way of doing it is sorting them by mvv/lva and while you are trying them, if the captured piece is less valuable than the capturing piece, try SEE, and if it is a losing capture, push it to the bad captures list and go to the next capture.

That way, you save some SEE calls in case you get a cutoff.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: SEE and en passant

Post by bob »

Don wrote:
bob wrote:
Don wrote:
bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Your forum post had almost the same content as a post I just made a few minutes ago! Anyway, I included in my post some information about why QxQ might be better than PxN even though PxN is an obvious win of material and QxQ may not be.
I think the idea makes sense, but requires a bit of thought to really follow. Any time you play QxQ your opponent has a pretty forced response, leaving PxN still playable most of the time. The worst-case is those queen-foraging positions where the queens invade and eat pawns and stuff left and right blowing up the q-search.
Yes, I made that exact point that PxN does not go away - it's still usually playable.

It is also another example of why logic doesn't always lead to the best solution. These trees we search are quite unusual in their size and shape, and quite often logic doesn't fit at all.
Logic always fits, but it has to be correct logic that takes everything relevant into consideration and that is where us puny humans fall short!

It's sort of like the moon conspiracy people, who say the moon landings of 40 years ago were faked. They back all of this up with logic, but the logic is seriously flawed and does not consider all the actual facts.
There I disagree completely. That isn't logic, that is stupidity. The moon landings occurred, and the technology fall-out is still influencing our lives today.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: SEE and en passant

Post by bob »

Pablo Vazquez wrote:
bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Another way of doing it is sorting them by mvv/lva and while you are trying them, if the captured piece is less valuable than the capturing piece, try SEE, and if it is a losing capture, push it to the bad captures list and go to the next capture.

That way, you save some SEE calls in case you get a cutoff.
Not a bad idea at all, I'll certainly give it a try.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: SEE and en passant

Post by Don »

bob wrote:
Don wrote:
bob wrote:
Don wrote:
bob wrote:
brianr wrote:
bob wrote: Let me add one bit of clarification to my comments. MVV/LVA without any SEE at all is definitely worse than just using SEE. The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search. Just pure MVV/LVA is on the order of 10% worse than pure SEE, in terms of tree size. If you can get your SEE fast enough, you win. Else you lose or break-even. But if you screen the moves and then search in MVV/LVA order, it is a definite win.
Engines are different, and as Bob often says your mileage may vary.
In Tinker, MVV/LVA without SEE in the full width search is better.

Bob, please clarify this
The MVV/LVA benefit shows up when applied to moves that have been pre-screened so that you do not look at losing captures early in the search.
What is meant by "pre-screened"?
MVV/LVA does not show if a capture is losing or not.
So, is pre-screening just V >= A or also using SEE?
This is from the discussion here last year (CCC). I do the following to choose captures to search at the beginning of any ply.

1. If this is a small x big capture, it is always included. PxN, RxQ, etc. In addition, if it is an exchange (minor x minor, PxP, etc) it is also included automatically.

2. If this is a big x small capture, it is riskier and has to pass the SEE test to be sure it doesn't lose material (QxN where N is undefended is good, QxR where rook is defended might be bad, etc).

For any moves that pass either of the above, they are collected and then ordered by MVV/LVA, so that the most valuable piece that doesn't lose material is captured first, even though it might not appear to be the biggest material gain. For example we would try QxQ (expected gain = 0 as queen is defended) before we try NxP where P is undefended...

Hope that is clear. I tried several variations last year when this MVV/LVA discussion came up and I found this was actually a small Elo improvement over pure SEE. Not a big one, but 4-5 as I recall... You can probably find the discussion. It was within the past 12 months...
Your forum post had almost the same content as a post I just made a few minutes ago! Anyway, I included in my post some information about why QxQ might be better than PxN even though PxN is an obvious win of material and QxQ may not be.
I think the idea makes sense, but requires a bit of thought to really follow. Any time you play QxQ your opponent has a pretty forced response, leaving PxN still playable most of the time. The worst-case is those queen-foraging positions where the queens invade and eat pawns and stuff left and right blowing up the q-search.
Yes, I made that exact point that PxN does not go away - it's still usually playable.

It is also another example of why logic doesn't always lead to the best solution. These trees we search are quite unusual in their size and shape, and quite often logic doesn't fit at all.
Logic always fits, but it has to be correct logic that takes everything relevant into consideration and that is where us puny humans fall short!

It's sort of like the moon conspiracy people, who say the moon landings of 40 years ago were faked. They back all of this up with logic, but the logic is seriously flawed and does not consider all the actual facts.
There I disagree completely. That isn't logic, that is stupidity. The moon landings occurred, and the technology fall-out is still influencing our lives today.
It's logic in the same sense as what you said, that logic does always lead to the best solution. If it doesn't lead to the best solution, it's because something is flawed about your premise. With these moon crazies the logic is often sound, but the premise isn't.