I understand how the killer moves heuristic functions. But I do not know how to properly implement it in search. The main problem I'm having isn't scoring them but is how to update the heuristic during a beta-cutoff. Help would be greatly appreciated and so would some code examples on how to do so.
Thanks.
Questions on Updating the Killer Moves Heuristic
Moderator: Ras
-
- Posts: 18
- Joined: Fri Dec 24, 2021 5:48 pm
- Full name: Andrew Zhuo
-
- Posts: 325
- Joined: Tue Aug 31, 2021 10:32 pm
- Full name: tcusr
Re: Questions on Updating the Killer Moves Heuristic
update your table with the current move before returning beta.StackFish5 wrote: ↑Wed Sep 14, 2022 6:19 pm I understand how the killer moves heuristic functions. But I do not know how to properly implement it in search. The main problem I'm having isn't scoring them but is how to update the heuristic during a beta-cutoff. Help would be greatly appreciated and so would some code examples on how to do so.
Thanks.
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Questions on Updating the Killer Moves Heuristic
If(move != killer1[ply]) { killer2[ply] = killer1[ply]; killer1[ply] = move; }
-
- Posts: 18
- Joined: Fri Dec 24, 2021 5:48 pm
- Full name: Andrew Zhuo
-
- Posts: 915
- Joined: Sun Dec 27, 2020 2:40 am
- Location: Bremen, Germany
- Full name: Thomas Jahn
Re: Questions on Updating the Killer Moves Heuristic
Yes. You can also defer generating the quiet moves and just check the killers for legality and play them. Maybe you get a cutoff and save generating the quiet moves entirely. Then you will never have to score them for sortingStackFish5 wrote: ↑Thu Sep 15, 2022 12:42 amKiller1 would be scored higher compared to killer2 right?
-
- Posts: 18
- Joined: Fri Dec 24, 2021 5:48 pm
- Full name: Andrew Zhuo
Re: Questions on Updating the Killer Moves Heuristic
Thank you all for the advice on how to update the killer move heuristic. It really helped me a lot.
-
- Posts: 263
- Joined: Wed Jun 16, 2021 2:08 am
- Location: Berlin
- Full name: Jost Triller
Re: Questions on Updating the Killer Moves Heuristic
I also have, additionally to the two traditional killermoves, a third killer move for each color that is valid through all heights (opposed to the normal killermoves which are only used/updated on their specific tree height).
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Questions on Updating the Killer Moves Heuristic
How do you set that 3rd killer?
-
- Posts: 263
- Joined: Wed Jun 16, 2021 2:08 am
- Location: Berlin
- Full name: Jost Triller
Re: Questions on Updating the Killer Moves Heuristic
Basically always, whenever the normal killers are updated, too:
Code: Select all
struct KillerTable{
Move table[MAX_PLY][2];
Move goodMove[2];
void update(Ply height, Move move){
goodMove[height % 2] = move;
if(table[height][0] != move){
table[height][1] = table[height][0];
table[height][0] = move;
}
}
};