katrain icon indicating copy to clipboard operation
katrain copied to clipboard

Feature Request: Allow freely editing the board to set up positions

Open e00E opened this issue 3 years ago • 9 comments

As far as I can tell the only way to reach a specific board state is to input moves by both players one after another as if playing a real game. This is inefficient in terms of my time when I don't care how the game reached this state and only want to look at a specific position. What I would like to do is freely edit the board as I please. This would also help when I am in a specific position and want to see analysis of a slightly different board state where I would like to a change a stone has been played a long time ago.

e00E avatar Sep 10 '20 19:09 e00E

Just load a sgf

simonguoxm avatar Sep 10 '20 23:09 simonguoxm

I've heard s similar request for the purpose of being able to compare how an exchange would affect analysis, on the basis of history-free analyses. It's a pretty big feature though, and unlikely to happen soon without outside contributions. For now, SGF is probably the most suitable way to do this.

sanderland avatar Sep 11 '20 07:09 sanderland

Somewhat helped by 'insert mode' in 1.7

sanderland avatar Dec 11 '20 17:12 sanderland

I have just implemented a stopgap, quick and dirty "solution". User can select black or white stones to be inserted and appropriate "pass" moves are inserted into the game tree so that the whole structure remains consistent. The "editor" supports only to put stones (no stone removal, color change, etc.), however it is working for the most common use case - simple setup of a position. Drawback is that the game tree is full with "pass" moves.

See Merge request and my katrain fork katrainse (clone stopgap-editor branch to test it).

ljubo106 avatar Feb 26 '23 20:02 ljubo106

Hey @ljubo106 thanks for your pr. A proper editor would be great. However, I don't think the PR adds sufficient functionality (essentially just pressing 'p' for the user) to take up such prominent screen space.

I think an editor would need:

on the engine side

  • Support for the AE command in sgfs.
    • This is likely to collapse the entire board state into some kind of initial_stones based position from the last occurrence of an AB/AW/AE

in the ui

  • Some kind of expansion of the 'insert moves' UI into an 'edit' mode
    • similar replacement of the right panel UI elements as analysis vs play does.
    • black, white, remove options, mapping to AB/AW/AE, and whatever convenience options we want.
    • At this point an "Edit" or "✏️" could be added to the top bar if it fits.

If you can find the time to work on the latter let me know. Complex UI changes such as this are hard though, and I understand if you don't have the time.

sanderland avatar Feb 27 '23 13:02 sanderland

Hey @ljubo106 thanks for your pr. A proper editor would be great. However, I don't think the PR adds sufficient functionality (essentially just pressing 'p' for the user) to take up such prominent screen space.

At least for me, it is significantly accelerating entering a position, but, of course, it is not a full editor. Concerning screen space - well, this is a bit tradeoff between usability and screen real estate, and it is also a question of taste and personal preferences.

If you can find the time to work on the latter let me know. Complex UI changes such as this are hard though, and I understand if you don't have the time.

Getting familiar with the whole code base and properly implementing a real editor is quite "heavy lifting" and would require quite a lot of time as you are suggesting too.

I understand if you don't want to merge this change as it is not "the real thing" - I will keep the fork as it is, solving the problem for me and depending on time will maybe dig a bit further. Merging that few lines of code will be easy also for future releases - so, I'm good.

Edit: Removing my comment about building deliverables - with "pyinstaller spec/katrain.spec" I was able to build running katrain.exe and other deliverables.

Edit2: I have closed the pull request. If somebody wants to try the discussed stopgap solution, the download is available here: katrainse

@sanderland , thanks for the great work you are doing - katrain is really a very useful tool

ljubo106 avatar Feb 27 '23 20:02 ljubo106

I came across this issue while looking for the documentation on how to create/edit a position in katrain. I, too, would welcome the ability to edit a position within katrain, rather than having to use a separate tool (like Sabaki) to create and save an SGF, then open it in katrain. Just saying. :-)

I tried the workaround of using 'i' (insert) in combination with 'p' (pass) to keep inserting stones of the same color, but found the workaround to be quite limited. For example, I don't know how to remove an existing stone from a position when you have already inserted ten additional stones. The only solution I am aware of is going back eleven steps, and re-insert the stones again at the right location. This works only for situations where there aren't that many stones on the board, and becomes increasingly cumbersome the more stones you have to place.

Thanks for creating katrain, it's a wonderful tool!

miguno avatar Apr 18 '23 17:04 miguno

@miguno - you could try katrainse. As discussed above, it is not a real editor, possibility to remove stones is missing, etc. However, it is making adding stones really easy (pass move is inserted automatically).

ljubo106 avatar Apr 18 '23 19:04 ljubo106

Hey @ljubo106 thanks for your pr. A proper editor would be great. However, I don't think the PR adds sufficient functionality (essentially just pressing 'p' for the user) to take up such prominent screen space.

I think an editor would need:

on the engine side

  • Support for the AE command in sgfs.

    • This is likely to collapse the entire board state into some kind of initial_stones based position from the last occurrence of an AB/AW/AE

in the ui

  • Some kind of expansion of the 'insert moves' UI into an 'edit' mode

    • similar replacement of the right panel UI elements as analysis vs play does.
    • black, white, remove options, mapping to AB/AW/AE, and whatever convenience options we want.
    • At this point an "Edit" or "✏️" could be added to the top bar if it fits.

If you can find the time to work on the latter let me know. Complex UI changes such as this are hard though, and I understand if you don't have the time.

When in this edit mode ,I would recommend use mouse Left to add Black stone and mouse Right to add the White Stone , click on existed stone to remove it.

xiaoyifang avatar Jan 14 '24 09:01 xiaoyifang