Question Regarding Move Ordering

Discussion of chess software programming and technical issues.

Moderator: Ras

StackFish5
Posts: 18
Joined: Fri Dec 24, 2021 5:48 pm
Full name: Andrew Zhuo

Question Regarding Move Ordering

Post by StackFish5 »

Hello there, I have some inquiries regarding move ordering. Currently, I have MVV-LVA move ordering, move ordering based on the piece square tables, killer moves, and the history table. The hash move system has not been implemented but I still want to include it in my question. The question that I have is how would these methods be ranked in priority? For example, would MVV_LVA be more significant in determining the priority of a move being searched than killer moves? Thank you in advance for the advice.
KhepriChess
Posts: 93
Joined: Sun Aug 08, 2021 9:14 pm
Full name: Kurt Peters

Re: Question Regarding Move Ordering

Post by KhepriChess »

There's a lot that can be found about move order on this forum (and through the chess programming wiki on this topic).

But I believe, in general, it goes:

1. Hash move
2. Captures
3. Killer moves
4. History moves

Not all captures need to necessarily be sorted all in #2. Bad/losing captures can be sorted after killer moves or after history moves, but whether that works depends on your engine. For me, sorting bad captures after killer moves didn't work until I had late move pruning (which coincidentally I've just been testing today).
Puffin: Github
KhepriChess: Github
alvinypeng
Posts: 36
Joined: Thu Mar 03, 2022 7:29 am
Full name: Alvin Peng

Re: Question Regarding Move Ordering

Post by alvinypeng »

Strong engines usually do something like this:

1. Play hash move
2. Generate captures and score them based on capture history and/or MVV-LVA. Capture history is usually much more important than MVV-LVA
3. Loop through captures from best to worst score. If a capture is a "good" capture (has a positive SEE), play it
4. Killer moves
5. Generate quiet moves and score them based on quiet history
6. Play quiet moves in best-to-worst score order. Just make sure not to play the hash move or killer moves twice
7. Play remaining "bad" captures
User avatar
lithander
Posts: 915
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Question Regarding Move Ordering

Post by lithander »

alvinypeng wrote: Fri Feb 17, 2023 5:59 am 2. Generate captures and score them based on capture history and/or MVV-LVA. Capture history is usually much more important than MVV-LVA
I have never heard about Capture history before. Can you elaborate?
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
alvinypeng
Posts: 36
Joined: Thu Mar 03, 2022 7:29 am
Full name: Alvin Peng

Re: Question Regarding Move Ordering

Post by alvinypeng »

lithander wrote: Fri Feb 17, 2023 12:08 pm
alvinypeng wrote: Fri Feb 17, 2023 5:59 am 2. Generate captures and score them based on capture history and/or MVV-LVA. Capture history is usually much more important than MVV-LVA
I have never heard about Capture history before. Can you elaborate?
Capture history is history heuristic for captures. Quiet history is indexed by something like [piece][to], whereas capture history is indexed by something like [piece][to][captured piece type].