Thx for the information. I'm recently converted to C# from VB.Net. I just wanted to learn C# and figured I would write a chess engine in C#. Now, I'm addicted so to speak.pedrojdm2021 wrote: ↑Tue Sep 14, 2021 1:37 am In my C# engine i use only pseudo legal move generation with make/undo and i am getting ~700.000 NPS in my CPU.
if you want know an simple approarch to detect checks and attacks to a square, go to "chessprogramming.org" and search for "Square attacked by"
it seems to be faster than a doing a lot of conditions, but not so fast
Most of the fasest C# chess engine seems to do something like black magic IMO. if you want to keep a clear code without so many tricks and hacks, i'd recommend to translate the engine to C/C++ code and you will gain at least 2x performance boost for free.
Also, C/C++ is easier to optimize because you don't have to deal with all the trash that the C# puts into your assembly if you are not careful even doing simple things such as reading an array database
I have been dealing with the C# performance for quiet a bit, and i haven't seen any super fast C# that does not do so many tricks to reach a good performance.
That's just my humble recommendation if you don't want to smash your head over the keyboard
I would shuffle to C++, however, I love that editor in C#. Is C++ available with a free editor as good as C#. I really need speed and focused on minimum moves to checkmate, I could care less about ELO right now. I have an optimizing program for checkmate only and found only 3 significant metrics: 1) history by ply; 2) check; 3) material balance. My engine is slow compared to most, however, I think I make up for that with my optimized evaluation function. I doesn't prune, but, the time to solution goes up almost linearly with resect ply level.
Also, are you sure about the 2x speed difference between C# and C++?