Sign in to follow this  
patishi

Killer moves heuristic question

Recommended Posts

patishi    212

My killer moves implementation is usually consists of 2 killers for each depth.  whenever a new move cause a cut off, i check if it is != from the main killer move, and if it is ,I switch the main and secondary killer and than place the new move instead of the main killer.  

The code is like this: 

 

void insertKiller(int depth,int killer){
    if(killersTable[depth][0] == -2){     //The killers table is initiated with -2..indicates that no moves yet inserted.   here i check if the main killer move  
        killersTable[depth][0] = killer;    // is occupied, and if not i just insert the move to the first position. 
    }
    else{     // if there is already a move in that certain depth, i check if it is different from the one in the first position, and if it is, i do the switching 
        if(killer != killersTable[depth][0]){
            killersTable[depth][1] = killersTable[depth][0];
            killersTable[depth][0] = killer;
        }
    }
}
 
 
My question is ,when i try to play the second killer in a certain position, and it causes a cut off,  do i need to replace it with the first killer (the main killer)   or should i just keep it placed in it's original position (the second position)  
I hope my question is clear,  my english is not the best :)

Share this post


Link to post
Share on other sites
alvaro    21246
My first thought is that yes, you should promote the second killer to first killer if it produces a beta cutoff. But the correct answer to this type of question is always "test it both ways".

Share this post


Link to post
Share on other sites
alvaro    21246
By the way, couldn't you simplify your code like this?
void insertKiller(int depth,int killer){
    if(killer != killersTable[depth][0]){
        killersTable[depth][1] = killersTable[depth][0];
        killersTable[depth][0] = killer;
    }
}
I think that takes care of every case...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this