Saving killer moves...

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MOBMAT
Posts: 385
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Saving killer moves...

Post by MOBMAT »

when (score >= beta), the literature says to only save quiet moves, but i saw in at least one code example where the save was not done when also in check (quiet or in-check).

is this typical, and if so, why doesn't the basic literature on killers mention it?

I could have missed it, of course.
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
tomitank
Posts: 276
Joined: Sat Mar 04, 2017 12:24 pm
Location: Hungary

Re: Saving killer moves...

Post by tomitank »

MOBMAT wrote:when (score >= beta), the literature says to only save quiet moves, but i saw in at least one code example where the save was not done when also in check (quiet or in-check).

is this typical, and if so, why doesn't the basic literature on killers mention it?

I could have missed it, of course.
.. and dont save the promotion move.

This depends of move ordering (score of moves), prunings, reductions, extensions, etc.

You need to find the best variation..

Tamás
AndrewGrant
Posts: 1750
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: Saving killer moves...

Post by AndrewGrant »

I only store quiets. Whether I am in check or not.

I have not seen this in any source, but If you have it is either because

1) The author made a mistake
2) The author determined it to be worth elo
3) With or without incheck is worth 0 elo, and they prefer one way over the other.

I'm going to test this now for my engine, and see what it is worth.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
MOBMAT
Posts: 385
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Re: Saving killer moves...

Post by MOBMAT »

Rodent III does it.

but you are correct, there might be another reason for doing so.
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Saving killer moves...

Post by hgm »

Killers are moves that you want to try against other preceding moves of the opponent. If you are in check, you must resolve the check. It is very unlikely that any other moves of the opponent would also deliver check. An it is also unlikely that the best move to resolve a check would be a good move to try when not in check. (It might be a move with your King!) An if another move woul put you in check, it s unlikely you woul want to resolve it in the same way. (The check may come from a different direction, so you will have to interpose on another ray.) So saving evasions as killers can be expected to be bad. Likewise, trying killers to evade check also makes little sense; they might not even be legal.
tomitank
Posts: 276
Joined: Sat Mar 04, 2017 12:24 pm
Location: Hungary

Re: Saving killer moves...

Post by tomitank »

MOBMAT wrote:Rodent III does it.

but you are correct, there might be another reason for doing so.
Stockfish was the first as far as I know. Then Senpai 1.0, Rodent etc.. and tomitankChess does it as well.
Volker Annuss
Posts: 180
Joined: Mon Sep 03, 2007 9:15 am

Re: Saving killer moves...

Post by Volker Annuss »

Captures can become killers in Arminius to have these capture moves searched before others.

There is one important exception. Moves that capture the last moved piece never become killers.
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: Saving killer moves...

Post by jwes »

Volker Annuss wrote:Captures can become killers in Arminius to have these capture moves searched before others.

There is one important exception. Moves that capture the last moved piece never become killers.
Do you also check if the move is still a capture?
Volker Annuss
Posts: 180
Joined: Mon Sep 03, 2007 9:15 am

Re: Saving killer moves...

Post by Volker Annuss »

No, any move that is not en passant, underpromotion and not moving to the same square as the move one ply before is a killer move. When ordering moves they get a bonus that makes killers more important than quiet moves and captures more important than most other captures.
AndrewGrant
Posts: 1750
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: Saving killer moves...

Post by AndrewGrant »

Went ahead and tried the logic from your post.

While Intuitive, it seems to be not worth any elo...

Test 1) Don't store into the killer table when we are in check

SPRT @ 5.0+0.05s Threads=1 Hash=8MB
LLR: -2.24 (-2.20, 2.20) [0.00, 5.00]
Games: 5475 W: 1324 L: 1398 D: 2753

Test 2) Don't store or read the killer table when we are in check

SPRT @ 3.0+0.03s Threads=1 Hash=2MB
LLR: 2.21 (-2.20, 2.20) [0.00, 5.00]
Games: 8225 W: 2270 L: 2119 D: 3836

SPRT @ 15.0+0.15s Threads=1 Hash=32MB
LLR: -0.79 (-2.20, 2.20) [0.00, 5.00]
Games: 5375 W: 1137 L: 1146 D: 3092

I'll give the longer test some more time, as the error bars are still decently large. The gain (if any) might just be the slight speedboost from not trying to make the killer moves which, as you said, are likely illegal when in check anyway.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )