chess online
« TAP TO LOG IN
GameKnot related: Possible Bug - Alternate Solutions to Puzzles?
« Back to forum
FromMessage
sirissac
04-May-13, 11:12

Possible Bug - Alternate Solutions to Puzzles?
I recently posted a puzzle (puzzle #99320), and found someone had added a longer alternate solution.

Normally, if a position has mate in X, then trying to add a longer mate gives the message:
"Too many moves! This solution is not checkmate, so your solution cannot match or improve the existing one (mate in X)."
This also occurs even when the solution in question is shorter than the suggested mate, provide of course that Black has made some 'mistake' (where a shorter response is provided). For instance, if the puzzle was mate in 16 and the response to one black mistake was mate in 12, One could not normally enter a mate in 13 or longer.

However, this has been done in puzzle #99320, and I've double checked it. Here the move in question provides a longer mate but it reverts to part of an existing line, and so doesn't play out and trigger the error.

This behavior seems idiosyncratic to say the least, and probably different from the developers intentions. So I was wondering if it was a bug, or if not is there some formal criteria for an alternate solution?

P.S. In case my explanation is a little unclear, check
1. Bf8 axb2 2. Bb4+ Kd1 3. Ba4+ Kc1 4. Bd2+ Kb1 5. Ke2 e3 6. Bb4 Kc1 7. Ba3 Kb1
in the puzzle in question, where the move 8. Bc5 (#9) was added after 8. Kxe3 (#5).

kingdawar
04-May-13, 16:22

It's a bug that's been pending to be fixed for about five years.
Gameknot.com
04-May-13, 17:50

Yes, it's a known minor bug. Unfortunately the effort that is required to fix it greatly exceeds the frequency with which it happens. There are not that many chess puzzles that have a move tree complex enough for it to be applicable. We'll fix it eventually of course, it's just not very high on the priorities list.
kingdawar
04-May-13, 17:53

Funny you should say that, considering I am dealing with this bug about every single day of my life  
Gameknot.com
04-May-13, 18:01

kingdawar, can you post a list of puzzles that have this issue? So that we can make sure the bug is fixed when we work on it. A dozen should be plenty, with as few moves/branches as possible, please. Thanks!
sirissac
04-May-13, 21:57

Thanks for the timely replies.

I appreciate that programming chess trees, with their many transpositions, is considerably more involved than ordinary trees; but this seems to be an i/o issue. The length of the mate in a transposed position should be checked before allowing the move that causes the transposition. That does not sound like a great effort.

Well, I apologize if I've overlooked or oversimplified the matter, since I don't know how Gameknot structures it programs; but five years sounds like a very outstanding oversight.

kingdawar
05-May-13, 00:50

I have been reassured this length check requires a complete reprogramming of the entire puzzle application, which indeed isn't quite feasible.

is an easy setting, lacking any kind of complexity, showing how it works.
1. Kf5 Kf8 2. Ke6 Kg8 3. Kf6 Kh8 4. Kg6 Kg8 5. Ra8#
If 1. ... Kh8 2. Kg6 Kg8 3. Ra8#
However, after you've finished the solution, you can navigate to the position after 1. ... Kh8 and add 2. Ke6 there too, which transposes to the mainline after 2. ... Kg8.

I will have to think a little bit more to come up with a basic example which shows some of the more surprising effects of the bug
sirissac
05-May-13, 03:54

Thanks kingdawar, I think that really illustrates the problem more clearly. But this really makes me wonder how the transpositions are implemented in the first place, and why trying to enter the response
1. ... Kh8 2. Kg4 Kg8 3. Kf5 ...
after you already entered the solution doesn't transpose back to the original line?

I thought Gameknot's program might be using the move count in the FEN to distinguish the position; Because this example is "synchronized", in that when you transpose the preceding number of moves are the same. But in the puzzle, one of the transpositions (7. ... Kb1 8. Kxe3 Kc1 9. Kd3 ...) would result in a different move count, so that fact that it transposed is not just as surprising to me.



kingdawar
06-May-13, 10:21

OK, maybe the more curious effects mostly rear their ugly heads in problems where even the mainline has not been entered correctly, and the problem is deleted in any case (the extra alts due to the bug only make it more convenient to reach 10 alternatives). Just getting rid of the bug in the puzzle position posted above, through implementing an additional length check when transposing into a previous line should resolve most if not all of the transposition issues... but as GameKnot has already repeatedly indicated, it will require a lot of (re-)programming which also has to keep unharmed the 100,000 entries that are already there...

All problems are more "complex" than the first example, as they are not exclusively focused on highlighting the bug, there are in some cases many other lines; just open the "all moves graph" and look for the grayed-out bits (it seems as if at least the all moves graph understands something's going on)

puzzle #90573 shows the most curious effects which probably cause most headaches for the GameKnot mastermind trying to figure out what to do to fix it.
After 1. ... Ra5 2. Rf6+ Rf5 3. Kh3, black can play 3. ... g1=Q which mates in 3...
However, black can also play 3. ... Rxf6 after which white has two moves:
4. Kh2 transposes back to the line 1. ... Ra5 2. Rf6+ Rf5 3. Kg1 Rxf6 4. Kh2 so that line's accepted immediately. (if this transposition is verified though, it seems what happens in the other line wouldn't be an issue anymore)
4. Kh4 is white's second reply, which is not seen in any of the normal lines, but now it is possible to add 4. ... Rf5/g1=Q/g1=R all of which mate next move. Perhaps in some hypothetical case the other move(s) could even transpose back to some other longer lines too.
All is accepted by the application, even though 3. Kh3 Rxf6 is one move slower than 3. ... g1=Q...

puzzle #18425
puzzle #78458
puzzle #91837
puzzle #95538
puzzle #96547
puzzle #97479
puzzle #98284
puzzle #98612
Gameknot.com
06-May-13, 14:32

kingdawar, thank you! Your examples of the issue will be passed on to our dev team. The moves are grayed-out when they belong to branches that have been "pruned" (i.e. they are no longer part of the current solution because of alternatives entered later). The issue discussed here is due to the move tree losing its tree structure and turning into a linked graph (which can have loops). That small difference might seem insignificant, but any mathematician can attest that linked graphs are much more complex to deal/work with, compared to simple trees. The easiest solution would have been to not automatically link positions and keep the tree structure, but that would mean extra work for the puzzle creators. We figured we would much rather have an imperfection for a smaller subset of puzzles than to require puzzle creators do a lot of extra work for most of the puzzles.
sirissac
06-May-13, 15:30

I assume a 'linked graph' means the same as a 'directed graph', and while I was mistaken to call them trees, I have no difficultly understanding the computational problems which arise because of this. I just figured each node (or position) would contain data about the subsequent mates, including the length. If that data is not stored before an alternate solution is entered, then I concede it would be a significant effort to fix this issue, or check the length of each mate. All the same, I appreciate Gameknot's consideration on the issue.
kingdawar
08-May-13, 18:52

second basic example
It took me five days before it suddenly clicked, but here it is:


The solution lines to enter are straightforward enough: 1. Ke5 Ke8 2. Kd6 Kf8 3. Ke6 Kg8 4. Kf6 Kh8 5. Kg6 Kg8 6. Ra8#
If 1. ... Kg8 2. Kf6 Kh8 3. Kg6 Kg8 4. Ra8#
So far so good, except, check this out:
1) Navigate to 1. Ke5 Kg8, enter 2. Kd5 Kf8/Kh8 3. Ke6 and all is accepted!
2) Then navigate to 1. Ke5 Kg8, enter 2. Kd6 Kf8/Kh8 3. Ke6 and all is accepted!
3) Then navigate to 1. Ke5 Kg8, enter 2. Kf5 Kf8/Kh8 3. Ke6 and all is accepted!
4) Then navigate to 1. Ke5 Kg8 2. Kf5 Kh8, now enter 3. Kg6 too, and it's accepted too!

That's four alternative solutions created out of thin air 
kingdawar
09-May-13, 06:17

Actually steps 3 and 4 should be slightly different:
3) Then navigate to 1. Ke5 Kg8, enter 2. Kf5 Kf8 3. Ke6 and if 2. ... Kh8 3. Kg6
4) Then navigate to 1. Ke5 Kg8 2. Kf5 Kh8 and enter 3. Ke6

And there is one additional step:
5) Navigate to 1. Ke5 Kg8, then click on 2. ... Kh8 and enter 3. Kf5, 3. Ke5, 3. Ke6 or even 3. Rb7, all of which lead to "FATAL ERROR: Move number does not match! 4<>8"
Gameknot.com
09-May-13, 11:50

Thank you, kingdawar, once again! We'll try to get to it is as soon as we can.