obvious/easy move

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
CRoberson
Posts: 1985
Joined: Mon Mar 13, 2006 1:31 am
Location: North Carolina, USA
Contact:

obvious/easy move

Post by CRoberson » Wed Mar 12, 2008 5:58 pm

Does it really work?

I mean if you don't quick exit on the "easy" move, it seems you
increase the probability of a ponder hit on the next move. If you make
the "easy" move, you reduce the ponder hit chances on the next move,
so it balances out. Or does it?

Making the "easy" move has risks:
1) I think it is likely to cut the chances of a ponder hit on next move
2) Sometimes the obvious move isn't so when given enough search time.

Who has data on this?

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

Re: obvious/easy move

Post by sje » Wed Mar 12, 2008 6:15 pm

The obvious move time saving heuristic is merely the flip side of the use-more-time-when-the-score-is-dropping heuristic. It works for machines as it does for human players.

Symbolic has a snap reply heuristic that shortens the think time even further if a good enough move with decent analysis draft is available from the ponder search when the opponent moves. If the ponder matches, then the program replies instantly. This probably works better against human opponents than programs; programs are less susceptible to psychological rattling.

Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 8:19 pm
Location: Oslo, Norway

Re: obvious/easy move

Post by Tord Romstad » Wed Mar 12, 2008 7:28 pm

CRoberson wrote:Does it really work?

I mean if you don't quick exit on the "easy" move, it seems you
increase the probability of a ponder hit on the next move. If you make
the "easy" move, you reduce the ponder hit chances on the next move,
so it balances out. Or does it?
You also have to consider the probability of a ponder hit for the opponent. In an "easy move" situation, your opponent will almost certainly get a ponder hit after your easy move. You are right that spending more time analysing the easy move will increase the chances of a ponder hit for yourself at the next move, but this ponder hit is likely to be worthless, because your opponent will probably move instantly. Making sure that the opponent's ponder hit will be worthless seems like a better bet in most cases.
Making the "easy" move has risks:
1) I think it is likely to cut the chances of a ponder hit on next move
I don't think this is important, for the reasons explained above.
2) Sometimes the obvious move isn't so when given enough search time.
This is a more serious problem.

Tord

bob
Posts: 20358
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: obvious/easy move

Post by bob » Wed Mar 12, 2008 9:50 pm

CRoberson wrote:Does it really work?

I mean if you don't quick exit on the "easy" move, it seems you
increase the probability of a ponder hit on the next move. If you make
the "easy" move, you reduce the ponder hit chances on the next move,
so it balances out. Or does it?

Making the "easy" move has risks:
1) I think it is likely to cut the chances of a ponder hit on next move
2) Sometimes the obvious move isn't so when given enough search time.

Who has data on this?
I've used it for a long time. But the specifics are pretty constrained. The main move to worry about is where you opponent captures a piece, and you have justs one way to recapture, and if you don't you end up down in material. There are other things you can use to turn "easy" off, such as if you change to a different best move, then it is not so "easy" and you ought to do a normal search.

As to your other question, if you think about the math, you can quickly confirm that easy moves are better. Say you use 1/3 the normal time. On an easy move, you save 2/3 instantly. If you search for the whole time, you might get a ponder hit (usually around 50% are good) so you save only 50%. since 66% is > 50%, I take the 66%. :)

CThinker
Posts: 388
Joined: Wed Mar 08, 2006 9:08 pm
Contact:

Re: obvious/easy move

Post by CThinker » Thu Mar 13, 2008 5:47 pm

Let's take the trivial easy case - that is, you have a single reply. Should you still do a search just so you can populate your PV and have something to ponder on?

I think that one should not do a search in this case. Instead, on the opponents time, do a search to find a move to ponder on, then do the ponder.

We can extend the idea to the general easy case. Make the move and save time, then on the opponents time, do any ponder-related operations.

bob
Posts: 20358
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: obvious/easy move

Post by bob » Sat Mar 15, 2008 3:52 am

CThinker wrote:Let's take the trivial easy case - that is, you have a single reply. Should you still do a search just so you can populate your PV and have something to ponder on?

I think that one should not do a search in this case. Instead, on the opponents time, do a search to find a move to ponder on, then do the ponder.

We can extend the idea to the general easy case. Make the move and save time, then on the opponents time, do any ponder-related operations.
agreed...

JBNielsen
Posts: 250
Joined: Thu Jul 07, 2011 8:31 pm
Location: Denmark
Contact:

Re: obvious/easy move

Post by JBNielsen » Wed Jan 23, 2013 5:04 pm

bob wrote:
CThinker wrote:Let's take the trivial easy case - that is, you have a single reply. Should you still do a search just so you can populate your PV and have something to ponder on?

I think that one should not do a search in this case. Instead, on the opponents time, do a search to find a move to ponder on, then do the ponder.

We can extend the idea to the general easy case. Make the move and save time, then on the opponents time, do any ponder-related operations.
agreed...
Even if the engine skips the last iteration, it will probably have reached the usual depth because the recapture score will give a lot of cut-offs when the other moves are examined.

What if there are two recapture moves? Do we have to spend all the time to choose between two moves, when we normally have to choose among 40 moves?
I would like to save some time here, too.

AlvaroBegue
Posts: 913
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: obvious/easy move

Post by AlvaroBegue » Wed Jan 23, 2013 6:40 pm

My engine Ruy-López has always had an obvious-move heuristic, and it has always worked very well. I don't think it has a measurable ELO effect, but my perception is that it's more pleasant to play against an engine that has this feature, and that's why we have it.

The details go something like this. When we begin searching the root, I do a depth-one search of every move with infinite alpha-beta window, so I have true scores (I also use this information to have an initial ordering of the moves at the root). I consider three categories of obviousness:
(1) No move is better than the best move minus 100 centipawns.
(2) No move is better than the best move minus 250 centipawns.
(3) No move is better than the best move minus 450 centipawns.
(4) Only the best move has a score better than being mated.

Of course I use the highest number applicable. Then I quit the search if:
(1) At least depth 10 has been searched and I have spent at least half of my target time for this move.
(2) At least depth 10 has been searched and I have spent at least one fourth of my target time for this move.
(3) At least depth 9 has been searched and I have spent at least one sixteenth of my target time for this move.
(4) Immediately.

The search proceeds normally, but if I ever change my mind as to what the best move is, I clear the notion that this move is obvious and disable the rules of early search termination above.

The depth constraints of course depend on what 1 ply means for your engine (i.e., how much you extend and prune), and we set them 15 years ago: These days I would probably have chosen larger numbers.

bob
Posts: 20358
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: obvious/easy move

Post by bob » Wed Jan 23, 2013 6:52 pm

CRoberson wrote:Does it really work?

I mean if you don't quick exit on the "easy" move, it seems you
increase the probability of a ponder hit on the next move. If you make
the "easy" move, you reduce the ponder hit chances on the next move,
so it balances out. Or does it?

Making the "easy" move has risks:
1) I think it is likely to cut the chances of a ponder hit on next move
2) Sometimes the obvious move isn't so when given enough search time.

Who has data on this?
It works, and always has. If you notice, an "easy move" generally goes deeper anyway, because the one move is the only real choice.

There are generally "hints" about an easy move that can let you know that you ought to search it normally. For example, ANY fail-low during the search of the move ought to instantly terminate "easy mode" and force a normal search. You could probably (I don't any longer) look at the node counts for the ply-1 moves and if one (or more) is slowly creeping upward faster than the rest, that might serve notice. My easy move code is pretty restrictive.


If the first move is significantly better than the second and beyond, which in Crafty is 2.0 pawns, then I can trigger "easy move" in one of two ways:

(1) recapture, which means to capture the piece moved by the opponent on his last move; or

(2) the score for the first move is NOT winning material (but it is still +2 better than the second). Which is the case where (say) you have a piece attacked, it is not sufficiently defended, and you only have one move that saves it.

That has worked well for me for years. I might try a cluster test with it turned off to see what it is worth. I'll report on this maybe tonight. Will start the test shortly, just so there is a number to discuss...

test is running now...

bob
Posts: 20358
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: obvious/easy move

Post by bob » Wed Jan 23, 2013 6:55 pm

JBNielsen wrote:
bob wrote:
CThinker wrote:Let's take the trivial easy case - that is, you have a single reply. Should you still do a search just so you can populate your PV and have something to ponder on?

I think that one should not do a search in this case. Instead, on the opponents time, do a search to find a move to ponder on, then do the ponder.

We can extend the idea to the general easy case. Make the move and save time, then on the opponents time, do any ponder-related operations.
agreed...
Even if the engine skips the last iteration, it will probably have reached the usual depth because the recapture score will give a lot of cut-offs when the other moves are examined.

What if there are two recapture moves? Do we have to spend all the time to choose between two moves, when we normally have to choose among 40 moves?
I would like to save some time here, too.
Harder question. Which one is the better way to recapture? There I think you need a normal search, although I suppose you could always keep up with your nominal search depth move by move, and whenever you reach that depth quickly, in such a 2-move scenario, you could stop early. That seems more risky. Why are we searching so fast? Because we have two obvious choices out of 40? Or because we THINK we have two obvious choices, but we are missing some key tactical point that more depth would spot?

Post Reply