0

My program prints time spent on executing a function for doing/retracting move, and both take together an average of 00.0002 seconds. That means my engine can analyze at most 5000 positions per second, right? That doesn't seem to be good, given the branching factor of 30.

How bad is that, and what average/maximum speed could I expect with optimizations (on normal char[64] board) ?

6
  • 4
    Surely the answer depends in part on your hardware and what language you are using. Jul 25, 2020 at 13:07
  • 1
    To be fair those are very impressive figures for a Sinclair ZX81 Spectrum (amazon.co.uk/Original-Sinclair-ZX81-Spectrum-Programming/dp/…).
    – Brian Towers
    Jul 25, 2020 at 14:06
  • 2
    Download and run Stockfish, the strongest conventional program right now, and see how much nps Stockfish gets. That's a good number to compare against.
    – Allure
    Jul 25, 2020 at 22:27
  • 1
    it's not that much about number of positions analized, but aobut the quality of the analysis
    – David
    Jul 26, 2020 at 15:07
  • 1
    Disagree with that - depth 3 is 35^3 move sequences already. If a computer cannot minimax brute-force that in less than 1 second, I cannot hope for more than depth 6 (with optimalizations), including quisce search.
    – Ferazhu
    Jul 30, 2020 at 18:15

2 Answers 2

1

On my old laptop with an i5 processor, running on a single thread, a recent version of Stockfish (written in CPP) makes around 1 million nodes per second (1Mnps). You must take into account that these nodes are not just the move generator, but the engine is also using its evaluation, so Stockfish's move generator should be much faster than that

My very simple chess engine (written in C), whose move generator is not optimized can make around 4.5Mnps also on a single thread (with no evaluation, just the move generator working. This is what in chess programming is called a perft test).

So at first glance something like some thousands of positions per second seems like very poor performance.

Of course part of this poor performance can be due to the language you've chosen to write your engine, but unless you've made a really weird choice, it seems like there's something odd about your program. My educated guess is either the move generator is buggy or its design is (very) sub-optimal.

2
  • My educated guess is either the move generator is buggy or its design is (very) sub-optimal. xxxxx Where exactly can I find tips? The only one "general" things is that I found to put everything (regarding moves) into one class and to use long integers rather than arrays, but everything else about chess programming is kinda all over the place.
    – Ferazhu
    Jul 26, 2020 at 22:06
  • You asked about how much nps your program should make, and that was the content of my answer (by the way, would you consider to mark your post as answered?). I think if you want to ask a question about how to program a good move generator (which sounds like an interesting one) you should do it opening a new post.
    – emdio
    Aug 2, 2020 at 8:31
1

I benchmarked my home made chess engine. It can play 600 000 moves per second in debug mode. It can calculate 80 000 - 100 000 legal moves per second in debug mode (which means that it can calculate and then play around 70 000 legal moves per second in debug mode). However, when running my engine in release mode it is over 10 times faster than in debug mode, meaning that in release mode it can calculate and then play 700 000 legal moves per second. I made my engine in Rust (if you wrote your engine in Python maybe that's why it is slow), I store the chess position by having an array of chess pieces that store their position. When calculating legal moves I first create another representation of the chessboard, this time I make an 8 by 8 array where every number represents a chess square (this way I can check whether a piece is in the way of another piece in O(1) time instead of in O(n) time).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.