q5Go icon indicating copy to clipboard operation
q5Go copied to clipboard

Jump to a specific node from command line?

Open jcguu95 opened this issue 2 years ago • 6 comments

Question

Is it possible to jump to a specific node of an sgf file from command line. Of course, a domain specific language for specifying a node is required, or we may use regex matching to find the nodes with comments. For example,

$> q5go --load "game.sgf" --node "E5[1]"

Usage

This will be useful because people can then take notes for GO easily. For example, in org-mode (a la emacs) one can custimize link protocols as follows.

* Lesson 1: Vital points

A Vital Point is an important shape point for both players, e.g.

+ [[go:~/game.sgf:E5[1]]]

The [[..]] would be turned into a link, which is then bound to the command (non-existent?) above.

Related

  • https://github.com/SabakiHQ/Sabaki/issues/872

jcguu95 avatar May 23 '22 10:05 jcguu95

Hmm. The obvious problem is that there might be more than one move at E5, either because of captures or in variations. A simple solution might be to allow a "jump to move N in the main line" option.

On the other hand, the idea of having an SGF editor is to edit Go positions and diagrams directly rather than using emacs. It might be more productive to discuss what you feel is missing and why you'd want to go into emacs instead.

bernds avatar May 26 '22 11:05 bernds

A more sophisticated domain specific language can resolve the first issue.. e.g. E5[1] means the first node where E5 occurs, and E5[G7][1] could mean the first occurence of E5 in the branch spit from G7.. etc.

I used emacs just as an example. In general, we can drop some links as comments in sgf files, and ask the links to bring us to certain nodes while being clicked. Of course, we don't want to be limited within the single editor, and a way to resolve it is to have the editors be able to be controlled through command lines (e.g. treating the running sgf editors as servers).

jcguu95 avatar May 26 '22 11:05 jcguu95

So the idea is to link to other nodes in the same sgf file? I think it would be best if multiple sgf editors would just support that in the same way. The idea of doing this with command lines sounds really clunky to me.

bernds avatar May 26 '22 14:05 bernds

OP has a good idea (I am also an emacs and org-mode user) but I think "jump to move N in main line" is probably the simpler, most straightforward option to ask q5go to implement (e.g. OGS has something similar, follow this link to get to the ear-reddening move: https://online-go.com/game/33720239/127 )

The idea of treating SGF editors as servers and clicking on links to follow them to specific nodes is interesting but unfortunately the SGF standard doesn't make a ton of room for this as-is; it might be worth bringing this up to the SGF format maintainers / people working on SGF version 5.

In general, anything that one editor does, specific to that editor, is bad for the go community -- e.g. OGS does not handle "adding stones" the correct way, so it can't parse some SGF files correctly, and as of the time of writing it doesn't handle the X marking correctly either... And its freeform drawing is very nice but it can't be stored effectively in SGF because other editors can't handle this, either.

So, if we want to improve the SGF standard, we should do that :D

Trevoke avatar May 30 '22 23:05 Trevoke

Thanks @Trevoke for your idea. However, I think the data in sgf is enough for us to specify a certain node already, so this can be done without asking the upstream of sgf development. And I'm pretty sure q5go has the ability to jump to a specific node. I just need to know how to do it via commands, not GUI interactions.

jcguu95 avatar May 31 '22 09:05 jcguu95

As a last note before I'm quiet on the topic, if you are using org mode, there are org sgf dynamic blocks you could use to actually show a board right in emacs.

--

Aldric. Sent from a mobile device.

On Tue, May 31, 2022, 05:11 Jin @.***> wrote:

Thanks @Trevoke https://github.com/Trevoke for your idea. However, I think the data in sgf is enough for us to specify a certain node already, so this can be done without asking the upstream of sgf development. And I'm pretty sure q5go has the ability to jump to a specific node. I just need to know how to do it via commands, not GUI interactions.

— Reply to this email directly, view it on GitHub https://github.com/bernds/q5Go/issues/63#issuecomment-1141877765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQSSKCQTZGUH6L5574KNDVMXJUHANCNFSM5WVNKWQA . You are receiving this because you were mentioned.Message ID: @.***>

Trevoke avatar May 31 '22 11:05 Trevoke