Skip to content

Commit

Permalink
fix notation when starting with black
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed Nov 10, 2023
1 parent 2f96637 commit 1b5b3e6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/chess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
createNode,
defaultTree,
GameHeaders,
getColorFromFen,
getNodeAtPath,
headersToPGN,
TreeNode,
Expand Down Expand Up @@ -389,6 +390,9 @@ function innerParsePGN(
let root = tree.root;
let prevNode = root;
root.halfMoves = halfMoves;
if (halfMoves === 0 && getColorFromFen(fen) === "b") {
root.halfMoves += 1;
}

for (let i = 0; i < tokens.length; i++) {
const token = tokens[i];
Expand Down

0 comments on commit 1b5b3e6

Please sign in to comment.