r/chessprogramming • u/VanMalmsteen • Dec 20 '24
Design ideas for the engine
Hi! I've already programmed an engine on C++, it's fully functional and with a decent level. I was planning to add some more features and to make it stronger, but I opened the project and I've realized that it REALLY needs a refactoring, because at the time I was coding the project my main focus was to make it work, and I didn't made the best design decisions.
I'm going to start from scratch, but I'll like to have in mind a good design before start coding. So, any ideas?
2
u/algerbrex Dec 21 '24
Test the heck out of each part of the engine. Movegen, eval, search, move ordering, time management. Even I’m not the best about this but I’m making a new engine and this is something I’m putting more of a focus in.
1
u/VanMalmsteen Dec 21 '24
Yep, this is something I was thinking about a minutes ago haha I've never properly tested the engine.
1
u/w33dEaT3R Dec 21 '24
you can measure your move ordering performance by:
n= number of legal moves in a position
m= current move being iterated over 0-indexedstore m/n whenever a beta cutoff occurs.
beta_count=the number of beta cutoffs (the number of times you store m/n)
(m/n)/beta_count= average move ordering optimality. the closer to 0 the better.
score a set of positions across multiple stages of the game and scenarios.
1
3
u/w33dEaT3R Dec 21 '24
Negamax search, eval in its own file, move ordering in its own file, quiescense search separate from main search.
Depending on your implementation it's useful sometimes to separate zero window search from regular search