You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for this great python library!
My problem is simple: I would like to extract a subgame between the $i$-th move and the $j$-th move.
For example, if the PGN is: 1. e4 e5 2. Nf3 (2. Nc3 d6) 2... d5 3. a4 a5 4. b4 b5, I want to extract a slice between the second move for White (2. Nf3) and the third move for Black (3... a5), so to obtain 2. Nf3 (2. Nc3 d6) 2... d5 3. a4 a5.
I was able to print all the moves in between with a subclass of Visitor (*) but I don't know how to preserve the right numbering? I'm trying to use visit_board and board.fullmove_number but I suppose I need to restore the board as mentioned in the doc:
The board state must be restored before the traversal continues.
How can I fix it?
(*) Actually the code below is not completely satisfying since we could have repeated moves... that's why I'm actually looking for all the moves between two nodes in the main line.
Hello,
First of all, thank you for this great python library!
My problem is simple: I would like to extract a subgame between the$i$ -th move and the $j$ -th move.
For example, if the PGN is:
1. e4 e5 2. Nf3 (2. Nc3 d6) 2... d5 3. a4 a5 4. b4 b5
, I want to extract a slice between the second move for White (2. Nf3) and the third move for Black (3... a5), so to obtain2. Nf3 (2. Nc3 d6) 2... d5 3. a4 a5
.I was able to print all the moves in between with a subclass of
Visitor
(*) but I don't know how to preserve the right numbering? I'm trying to usevisit_board
andboard.fullmove_number
but I suppose I need to restore the board as mentioned in the doc:How can I fix it?
(*) Actually the code below is not completely satisfying since we could have repeated moves... that's why I'm actually looking for all the moves between two nodes in the main line.
Output:
1. Nf3 ( 2. Nc3 2. d6 ) 3. d5 3. a4 3. a5
Otherwise I found a way to visit recursively the nodes as follows:
The structure is OK but I have also a problem with the numbering...
The text was updated successfully, but these errors were encountered: