by alexpotato · 3y ago · 0 comments
I remember reading how Dropbox and other file sharing sites used hashing to create single instances of popular files and then just used pointers from accounts with that file to save disk space.
I would imagine a LOT of chess games probably start out the same and you can therefore store a pointer to where the game is on a subset of potential game starts and then write the difference as you branch out.
I may be underestimating the possible start conditions and/or the metadata storage cost (e.g. time in the game of each move doesn't go away).
Maybe you could store all the moves in an array of 2 byte ints. I doubt you can have more than 32k moves in a chess game.
Assume 10kb per game in memory. You can run 1 million games on 10gb.
Store the moves in the end, run your analysis, etc.
Or am I missing something?
Potentially some SIMD optimisations could be done in this direction
The game gets even more compact in that not all source and destination squares are possible at every move, etc. But, you're dead on in your estimate.
SCID uses 1 byte per move which is close to optimal (it splits it into 2^4 for piece and 2^4 for direction, with some edge cases).
SCID vs PC is a fantastic tool for chess players, I maintain a massive database of master games using it.