Thanks!syzygy wrote: It seems to be correct.
I have further simplified the opponent DTZ search loop
https://github.com/official-stockfish/S ... .cpp#L1487
It seems to work on my test cases, but I would be more confident if you could give it a look.
Moderator: Ras
Thanks!syzygy wrote: It seems to be correct.
This seems to go wrong for a winning position with at least one losing move. It will return a negative dtz. So don't update minDTZ if WDLScore > 0 and dtz < 0.mcostalba wrote:Thanks!syzygy wrote: It seems to be correct.
I have further simplified the opponent DTZ search loop
https://github.com/official-stockfish/S ... .cpp#L1487
It seems to work on my test cases, but I would be more confident if you could give it a look.
The problem is more serious.syzygy wrote:This seems to go wrong for a winning position with at least one losing move. It will return a negative dtz. So don't update minDTZ if WDLScore > 0 and dtz < 0.mcostalba wrote:Thanks!syzygy wrote: It seems to be correct.
I have further simplified the opponent DTZ search loop
https://github.com/official-stockfish/S ... .cpp#L1487
It seems to work on my test cases, but I would be more confident if you could give it a look.
You are right. This is my second attempt:syzygy wrote:The problem is more serious.
The first branch of this line makes little sense:mcostalba wrote:You are right. This is my second attempt:syzygy wrote:The problem is more serious.
https://github.com/official-stockfish/S ... .cpp#L1500
Code: Select all
dtz = isZeroingMove ? -zeroing_move_dtz(wdl) : -probe_dtz(pos, result);
Thanks!syzygy wrote:What if you initialise minDTZ to something big if wdl > 0 and to zeroing_move_dtz(wdl) + 1 if wdl < 0? Then you can skip probing all zeroing moves, I think...
Well, I think you have succeeded in reducing the number of lines by a lot, but figuring out *why* it works correctly (if it actually does work correctly) is now a LOT harder. The original code had a clear logical plan (first ignore en passant, then fix it only as the last step, etc.).mcostalba wrote:For me code should be easy to understand and to read
I am very sorry for this. I didn't mean to teach anything, I just wanted to explain why I choose one way instead of another.syzygy wrote:Well, I think you have succeeded in reducing the number of lines by a lot, but figuring out *why* it works correctly (if it actually does work correctly) is now a LOT harder. The original code had a clear logical plan (first ignore en passant, then fix it only as the last step, etc.).mcostalba wrote:For me code should be easy to understand and to read
And you have absolutely no need to teach me how to program. Really.
Now go figure it out yourself. I have had enough of correcting the bugs you are introducing even after I explain the errors that should be avoided.