Killer moves?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

petero2
Posts: 688
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Killer moves?

Post by petero2 »

Has anyone tried the idea to update killers when you get a hash hit that gives a beta cut off? Doing this seems logical to me, but it seems like neither crafty nor stockfish does this.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Killer moves?

Post by michiguel »

petero2 wrote:Has anyone tried the idea to update killers when you get a hash hit that gives a beta cut off? Doing this seems logical to me, but it seems like neither crafty nor stockfish does this.
Yes, it makes sense if it is not a capture, but it did not work for me. I tried it actually a couple of weeks ago inspired by some of the threads. Possibly, it may give a 0.1 elo improvement that the noise hid.

Miguel
Uri Blass
Posts: 10297
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Killer moves?

Post by Uri Blass »

I think that there should be many cases when it is better not to try killers first even when there is no good captures or hash moves.

For example suppose that the null move killer move is Bb4 but the last move of white was a3 and you have not a good capture and no move in the hash.
It seems stupid to try Bb4 first.
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Killer moves?

Post by PK »

in Glass, Edmund implemented using killer moves only if their static exchange evaluation was not too bad, which excluded moving a bishop on a square protected by a pawn. It helped indeed.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Killer moves?

Post by mcostalba »

Uri Blass wrote:I think that there should be many cases when it is better not to try killers first even when there is no good captures or hash moves.

For example suppose that the null move killer move is Bb4 but the last move of white was a3 and you have not a good capture and no move in the hash.
It seems stupid to try Bb4 first.
This is a special case of the more general pruning/reducing step.

Form the point of view of code modularity it is important to disjoint:

1) Move generation

2) Move ordering

3) Move pruning/reduction

Killer moves ordering is done in step 2, while reducing/pruning a move if it is considered bad (for instance if SEE score is negative) is done in step 3.

When developing an engine it is important to have clear in mind what is the sequence of (largely independent) steps that from move generation arrive at making a move. Otherwise if you have a mess in your mind also the resulting engine will be a mess.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Killer moves?

Post by bob »

petero2 wrote:Has anyone tried the idea to update killers when you get a hash hit that gives a beta cut off? Doing this seems logical to me, but it seems like neither crafty nor stockfish does this.
Have not, but will, since it is easy enough to test...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Killer moves?

Post by bob »

bob wrote:
petero2 wrote:Has anyone tried the idea to update killers when you get a hash hit that gives a beta cut off? Doing this seems logical to me, but it seems like neither crafty nor stockfish does this.
Have not, but will, since it is easy enough to test...
OK, tested this SEE limit on killers. -25 Elo, tested twice at 30K games.

Very simple change, but it doesn't seem to work...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Killer moves?

Post by bob »

Don wrote:
mike_bike_kite wrote:It's working nicely now and the improvement is noticeable. I'm still not where I want it to be but I'm moving in the right direction.
Take care not to have the same killer twice.

Here is the code I use where "mv" is the move that produced a beta (fail hi) cutoff and it's not a capture move:

Code: Select all

    
if (mv != ka[ply])  {
  kb[ply] = ka[ply];
  ka[ply] = mv;
}
Just for the record, that's not a very good way to do this. That makes kb[ply] and ka[ply] separated by sizeof(ka). Which pretty much guarantees that each killer will be in a different cache line. Much better is to put em in a structure, that is subscripted. Something like killer[ply].a and killer[ply].b so that the two killers for a single ply are in consecutive memory addresses. And generally in the same cache line.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Killer moves?

Post by hgm »

Indeed. I use Move_t killer[MAXPLY][2]; for the same reason.
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: Killer moves?

Post by jwes »

bob wrote:
Don wrote:
mike_bike_kite wrote:It's working nicely now and the improvement is noticeable. I'm still not where I want it to be but I'm moving in the right direction.
Take care not to have the same killer twice.

Here is the code I use where "mv" is the move that produced a beta (fail hi) cutoff and it's not a capture move:

Code: Select all

    
if (mv != ka[ply])  {
  kb[ply] = ka[ply];
  ka[ply] = mv;
}
Just for the record, that's not a very good way to do this. That makes kb[ply] and ka[ply] separated by sizeof(ka). Which pretty much guarantees that each killer will be in a different cache line. Much better is to put em in a structure, that is subscripted. Something like killer[ply].a and killer[ply].b so that the two killers for a single ply are in consecutive memory addresses. And generally in the same cache line.
Speaking of this, I noticed that struct tree in crafty contains 8 arrays[MAXPLY] and 3 [MAXPLY+2] . Wouldn't it be better to combine these into structs?