I'm on Windows, I've heard of valgrind but it does not support windows
Any other alternatives?
Can't use Visual Studio because it does not support C99, with Dev-C++ for debug is fine, in fact it has a CPU window that show where it was the error but in assembler and I'm not good in assembler
Well I found the problem, it was the rank() and file() functions, the engine that I'm modifying is derived from Vice and it uses an 120 array board, I had to convert it to 64 square
Now I have another problem... the kpk_ok() funtion returns:
illegal = 29360 and it must return: 30932
win = 155244 and it must return: 111282
Even I copied the kdist() function from DiscoCheck source, but the problem is still there, now I have to check the bitboards attacks from king and pawns
What could be the problem? My head cant think right now...
If you don't see it, a little debugging should help. Finding out for which argument values lead to the erroneous negative value would be the first step. This is easy even without a debugger: just add some checks.
The debug helped me alot finding the problem, as I said it was the RANK() function, but after the solution, the kpk_ok() function does not returns the correct illegals and wins positions and I just give up trying this, I have not changed anything in the code, just replacing some functions with my functions
But I'm having problems again, I have to debug, debug and debug...
I think I just want the things just works without errors and fast as possible, sometimes I don't have patience, and for that I have not released the engine
tttony wrote:The debug helped me alot finding the problem, as I said it was the RANK() function, but after the solution, the kpk_ok() function does not returns the correct illegals and wins positions and I just give up trying this, I have not changed anything in the code, just replacing some functions with my functions
But I'm having problems again, I have to debug, debug and debug...
I think I just want the things just works without errors and fast as possible, sometimes I don't have patience, and for that I have not released the engine
Why don't you just:
modify DiscoCheck to make it spit out the KPK bitbase in a file
Load the file at the startup of your engine
Generating the KPK bitbase on the fly is just more elegant. But it is not necessary if you're looking for the minimum effort solution.
If you're interested in portability, beware of Little Endian vs. Big Endian...
PS: The binary file with the KPK bitbase is not copyrightable material, so you can use it however you want (even in a commercial and closed source engine). It's the code of DiscoCheck that is GPL, and would force you to release your entire source code under GPL (if you ever do release).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.