-
Notifications
You must be signed in to change notification settings - Fork 16
Description
There's an issue with "exact"
The fundamental problem seems to be that it is incorrectly assumed that the goal is game-ending. This is obviously true for # and =, but for others like +, ~ & ser-z it is not.
This is actually a practical obstacle in composition. I give two very different examples:
(1) identifying all legal positions 1.5 ply ahead.
BeginProblem
Stipulation exact-h~1.5
Option Variation NoBoard NoBk
Pieces
black Kc1
white Ka1
EndProblem
Number of solutions found: zero.
This is because when the solution is achieved after 1. ... Ka2, the goal is believed to be achieved, and there is no more searching for a solution.
If I omit the "exact" then it only gives me 1 solution: 1. ... Ka2. I still don't get to see anything of length 1.5.
I can mimic the desired result with
sstipulation white 1h[1h[1h[~]h]h]h
which gives the correct answer:
1.Ka1-a2 Kc1-d2 2.Ka2-b1
1.Ka1-a2 Kc1-d2 2.Ka2-b3
1.Ka1-a2 Kc1-d2 2.Ka2-a1
1.Ka1-a2 Kc1-d2 2.Ka2-a3
1.Ka1-a2 Kc1-d2 2.Ka2-b2
1.Ka1-a2 Kc1-c2 2.Ka2-a1
1.Ka1-a2 Kc1-c2 2.Ka2-a3
1.Ka1-a2 Kc1-d1 2.Ka2-b1
1.Ka1-a2 Kc1-d1 2.Ka2-b3
1.Ka1-a2 Kc1-d1 2.Ka2-a1
1.Ka1-a2 Kc1-d1 2.Ka2-a3
1.Ka1-a2 Kc1-d1 2.Ka2-b2
However this mechanism is obviously fiddly, fragile and hard to scale. Want ~ to be handled correctly with exact as non-game-ending.
I often want to run such exploratory queries as part of compositions, and this is how I stumbled across the bug.
(2) path enumeration
BeginProblem
Stipulation exact-ser-zh89
Option Variation NoBoard NoBk
Pieces
white Ka1
EndProblem
There should be 1309 solutions. See https://pdb.dieschwalbe.de/P1243393 and https://oeis.org/A025597. Popeye gives 1306. The correct number is 1309. See Jacobi with
forsyth K7/8/8/8/8/8/8/8
stipulation ser-a=>b9 forsyth 8/8/8/8/8/8/8/7K
The discrepancy comes because there is a short solution in 7 moves, and then 3 ways for the last 2 moves. However for path enumerations, short solutions are irrelevant, and would be painful to account for. "Exact" should allow me to avoid precisely this question, but it is not working properly for non-game-ending stipulations.
Even avoiding "exact" doesn't work:
BeginProblem
Stipulation -ser-zh89
Option Variation NoBoard NoBk
Pieces
white Ka1
EndProblem
Gives me 1 solution for 7 moves (correct), 56 solutions for 8 moves (correct) but only 1306 solutions for 9 moves (wrong). It would be quite hard to figure out the correct number by hand.
The default for all path enumerations is that we don't worry if we hit the final position early. This is mathematically simplest, and then there is a formula involving generating functions which allows us to get the "first hit number" (here 1306) from the general number (here 1309).
Thank you for all your work, I would really appreciate if you can tackle this issue.
(Thanks also to Dmitri Turevski for discussions on this interesting Popeye behaviour.)