czbar / ChessForge

Chess Forge application
MIT License
12 stars 2 forks source link

Handling of Identical Positions #522

Closed eradecka closed 1 year ago

eradecka commented 1 year ago

To manage identical position in multiple places in the Workbook the following functionality could be useful:

WHEN USER ADDS NEW MOVE IN THE STUDY

Explanation is using the following example.

We have Chapter 1 as below (note the position after 3...Bc5):

image

We also have a game which after 3...Bc5 has identical position:

image

We enter chapter 2 and after 3...Nc6 get the position identical to the one above:

image

System discovers that we just made a move that leads to the identical position that the one already in the Workbook somewhere else and display a message about the existence of such identical positions:

There are identical positions in the Workbook. Would you like to view them?

image

WHEN USER WANTS TO CLEAN UP THE WORKBOOK

User will go to a specific position in a Workbook and through right click menu will run Find Identical Position function. This will open modal window as detailed above with Copy Moves button, Tooltips and Hovering chessboards.

COPY MOVES FUNCTION SPECS

When Copy Moves function is run (from either of the above 2 scenarios) system checks if the original position we started from has any moves afterwards or not:

There are already existing moves in XXX. Do you want to:
* Overwrite them
* Append to them

where XXX is the original place where we started to deal with identical position (e.g. Chapter 1 Study, or Chapter 1 Game 1)

Overwrite option above deletes the moves after identical position in the original place and copy the moves from selected identical position there including any sub variations Append option above copies the moves from selected identical position without deleting the existing ones

Exception for the Game. If Find Identical Position function was run from a Game and user in modal window uses Copy Moves function, the dialog box that pops up provides only one option for appending (we do not want to overwrite a game with some variations and lose the game as such). So dialog box will look as per below:

There are already existing moves in XXX. Do you want to append to them?

where XXX is the original place where we started to deal with identical position (e.g. Chapter 1 Game 1)

If confirmed, system copies the moves from selected identical position and sub variations, leaving the existing ones as they are.

Links between identical positions. When Copy Moves function is finished system inserts a special sign in every place where identical position is ( say an arrow pointing into upper right corner (or right arrow). In our example inserted arrow will:

eradecka commented 1 year ago

I have 3 identical position exactly as per my specs (I am emailing workbook Identical position again):

When I run find identical positions function from Chapter 2 it works fine and I can see Chapter 1 Study and Chapter 1 Game listed:

image

Also the functions Copy Main Line... and Copy Tree... seems to work fine.

However, when I run Find identical position function from the same position in Chapter 1 Study (or from Chapter 1 Game) nothing happens:

image

Maybe the previously existing mark causes this issue (orange arrow above).

eradecka commented 1 year ago

One more thing. When writing Copy I was thinking about Chess Forge pasting it into the place I opened Identical Position function. As of now it copies it into the Clipboard but then I had to run paste to get what I want. So effectively I wanted to have an option that copies and also pastes straight away with one click.

eradecka commented 1 year ago

Label Copy and Paste is great now.

I also can see Identical positions from both chapters now.

Small issue I notice however is that when you use Copy and Paste Variation Tree then any sub variations on the first move are skipped (only Main Line is copied) but any sub variations from 2nd move onward are copied.

czbar commented 1 year ago

Fixed the last issue.

eradecka commented 1 year ago

2 issues that prevent me from further testing Copy and Paste: I do the following: a) run find identical positions in Chapter 2 Study as per below b) system finds the position in Chapter 2 Study as per below c) I run Copy and Paste Main Line after 3...Bc5 from Game (red below)

image

system writes up the main line moves from the game into Chapter 2 Study (green below):

image

However 2 issues now I have are:

1) when I try to click on Game Tab system freezes for a bit and then crushes and closes down without saving the moves I added 2) when I now run Close Chess Forge and reopen it again the moves were not saved