SabakiHQ / Sabaki

An elegant Go board and SGF editor for a more civilized age.
https://sabaki.yichuanshen.de/
MIT License
2.4k stars 376 forks source link

Sabaki spoils the final position in game preview when opening some tsumego collections #315

Open ikirill opened 6 years ago

ikirill commented 6 years ago

I have a tsumego collection sgf file (xxqj.sgf from https://www.u-go.net/classic/) that has solutions in it, and Sabaki's preview looks like this: https://imgur.com/DyoQfHq

This isn't necessarily a bug, but I'm not sure this is expected behaviour either: as you can see in the screenshot, showing the final position in the sgf file means that the whole solution is shown, spoiling the problems, and I can't see a way to turn this behaviour off.

yishn commented 6 years ago

For the preview, Sabaki takes the first 30 moves into the game and displays its board arrangement. For most games the initial arrangement doesn't contain a lot of information, but I agree that spoiling the solutions to tsumego should be avoided. I'm open to suggestions.

ikirill commented 6 years ago

Maybe detect whether the initial position is empty or not (ignoring handicap stones)? It seems like an awkward special case, I could be missing something there.

yishn commented 6 years ago

Yes, my thoughts exactly 😁 Maybe we could take the first 30 nodes into the game, but stop at the penultimate node if the game contains fewer than 30 nodes? Okay, actually, that won't solve anything...

The problem is, there is no real way to determine whether the initial position only has handicap stones or not. We could determine if the initial position only contains black stones. But this check would fail for tsumegos which store their problems in multiple variations rather than multiple games.

FelixBrendel commented 6 years ago

Is it possible to put a comment in the sgf file, that is ignored by sgf viewers, but can be used to store this kind of metadata?

wctgit commented 6 years ago

It seems there's a difference between SGF files created by the user playing their own games within Sabaki, and SGF files that are imported from some other source.

If that is the correct distinction, then perhaps you could use some of the SGF properties (http://www.red-bean.com/sgf/properties.html) to detect a difference between a user-game-play-generated SGF file and a setup-example-generated SGF file. For example, one starting point would be to check the AP property, which defines the APplication and version number of the app which created the file. (And Sabaki should obviously include this property in any SGF files it creates.)

Another possibly useful property is the ST (style) property which

        Defines how variations should be shown (this is needed to
        synchronize the comments with the variations). If ST is omitted
        viewers should offer the possibility to change the mode online.
        Basically most programs show variations in two ways:
        as markup on the board (if the variation contains a move)
        and/or as a list (in a separate window).
        The style number consists two options.
        1) show variations of successor node (children) (value: 0)
           show variations of current node   (siblings) (value: 1)
           affects markup & list
        2) do board markup         (value: 0)
           no (auto-) board markup (value: 2)
           affects markup only.
           Using no board markup could be used in problem collections
           or if variations are marked by subsequent properties.
           Viewers should take care, that the automatic variation
           board markup DOESN'T overwrite any markup of other
           properties.
        The  final number is calculated by adding the values of each
        option. Example: 3 = no board markup/variations of current node
                 1 = board markup/variations of current node

I'm not sure if that's exactly the right property to check, but my point is simply that there are a lot of different SGF properties that could be used to help distinguish how game previews should be displayed. Perhaps if @ikirill could give a specific SGF file, we could look at its SGF properties to see what distinguishes it from a typical Sabaki-generated file.

yishn commented 6 years ago

@wctgit I don't think there's any distinction between those two.

psygo commented 6 years ago

I'm having the same problem here (I'm transcribing a tsumego collection) and I would suggest Sabaki to use the "manage games" feature for a wider variety of tasks, which would make the program richer and more useful. There could be a button to switch the preview to showing only the initial position of the board; it's not a super elegant solution, but since tsumego collections are kind of common, it wouldn't bother anyone I believe. Another feature I would suggest - besides a shortcut for the "add new game" button inside the "manage games" section T.T - this section to have is a title for each game, which again could be in toggle mode.