0

I am implementing a chess engine, and my move ordering scheme works as follows

  1. Use pvmove

  2. Use most valuable victim least valuable attacker

  3. Use killer heuristics

Though I don't get why I should be storing only 2 or 3 moves per depth, when I can store a whole list ?

Gaurav Pant
  • 962
  • 10
  • 30

1 Answers1

2

Because you try to store possible future moves. Therefore you need to store all possible moves for the future. Assuming you have 32 chess pieces and every piece has 4 possible moves it can do you would need to store :

1 Moves: 128                 Possibilities
2 Moves: 16384               Possibilities
3 Moves: 2097152             Possibilities
4 Moves: 268435456           Possibilities
5 Moves: 34359738368         Possibilities
6 Moves: 4398046511104       Possibilities
7 Moves: 562949953421312     Possibilities
8 Moves: 72057594037927936   Possibilities
9 Moves: 9223372036854775808 Possibilities

Thats just a simple assumption of the number of pieces and possible moves, but you see that even for 3 moves ahead you need to save around 2 Million possibilities, which is a lot if you have limited time for each turn.

For sure you could make optimizations and stuff but to answer your question: Because you neither have the CPU-speed, nor the HDD-space to save a whole list of possible moves.

Florian H
  • 3,052
  • 2
  • 14
  • 25
  • But cant we store at least a few MBs for them so they are prioritised higher than the regular moves ? Why only choose 2 or 3 moves each time ? – Gaurav Pant Jan 07 '20 at 10:53
  • Also just wanted to verify if I understand killer heuristics completely - They are the moves that have a score greater than beta ? – Gaurav Pant Jan 07 '20 at 10:55
  • I'm not that deep in killer heuristics but just from a mathematical point of view its a tradeoff between depth and width. E.g. saving 2 moves per depth you'll end at around 1000 saved moves at a depth of 10. Saving 10 moves per depth you'll end at around 10 trillion moves at a depth of 10. (2^10 = 1024 vs 10 ^10 = 10.000.000.000) – Florian H Jan 07 '20 at 12:19