Aller au contenu

PgnNotation

neo-chess-board


Defined in: src/core/PgnNotation.ts:38

Constructors

Constructor

new PgnNotation(rulesAdapter?): PgnNotation

Defined in: src/core/PgnNotation.ts:159

Parameters

rulesAdapter?

RulesAdapter

Returns

PgnNotation

Methods

addMove()

addMove(moveNumber, whiteMove?, blackMove?, whiteComment?, blackComment?): void

Defined in: src/core/PgnNotation.ts:199

Add a move to the game

Parameters

moveNumber

number

whiteMove?

string

blackMove?

string

whiteComment?

string

blackComment?

string

Returns

void


addMoveAnnotations()

addMoveAnnotations(moveNumber, isWhite, annotations): void

Defined in: src/core/PgnNotation.ts:607

Add visual annotations to a move

Parameters

moveNumber

number

isWhite

boolean

annotations

PgnMoveAnnotations

Returns

void


clear()

clear(): void

Defined in: src/core/PgnNotation.ts:393

Clear all moves and reset

Returns

void


downloadPgn()

downloadPgn(filename): void

Defined in: src/core/PgnNotation.ts:590

Download PGN as file (browser only)

Parameters

filename

string = 'game.pgn'

Returns

void


getMetadata()

getMetadata(): PgnMetadata

Defined in: src/core/PgnNotation.ts:192

Returns

PgnMetadata


getMoveAnnotations()

getMoveAnnotations(moveNumber, isWhite): PgnMoveAnnotations | undefined

Defined in: src/core/PgnNotation.ts:959

Get annotations for a specific move

Parameters

moveNumber

number

isWhite

boolean

Returns

PgnMoveAnnotations | undefined


getMoveCount()

getMoveCount(): number

Defined in: src/core/PgnNotation.ts:559

Get move count

Returns

number


getMovesWithAnnotations()

getMovesWithAnnotations(): PgnMove[]

Defined in: src/core/PgnNotation.ts:971

Get all moves with their annotations

Returns

PgnMove[]


getParseIssues()

getParseIssues(): PgnParseError[]

Defined in: src/core/PgnNotation.ts:650

Returns

PgnParseError[]


getResult()

getResult(): string

Defined in: src/core/PgnNotation.ts:566

Get current result

Returns

string


importFromChessJs()

importFromChessJs(chess): void

Defined in: src/core/PgnNotation.ts:245

Import moves from a chess.js game

Parameters

chess

ChessLike

Returns

void


loadPgnWithAnnotations()

loadPgnWithAnnotations(pgnString): void

Defined in: src/core/PgnNotation.ts:625

Parse a PGN string with comments containing visual annotations

Parameters

pgnString

string

Returns

void


setMetadata()

setMetadata(metadata): void

Defined in: src/core/PgnNotation.ts:178

Set the game metadata (headers)

Parameters

metadata

Partial\<PgnMetadata>

Returns

void


setResult()

setResult(result): void

Defined in: src/core/PgnNotation.ts:237

Set the game result

Parameters

result

string

Returns

void


toPgn()

toPgn(includeHeaders): string

Defined in: src/core/PgnNotation.ts:357

Generate the complete PGN string

Parameters

includeHeaders

boolean = true

Returns

string


toPgnWithAnnotations()

toPgnWithAnnotations(): string

Defined in: src/core/PgnNotation.ts:945

Generate PGN with visual annotations embedded in comments

Returns

string


fromMoveList()

static fromMoveList(moves, metadata?): string

Defined in: src/core/PgnNotation.ts:573

Create a PGN from a simple move list

Parameters

moves

string[]

metadata?

Partial\<PgnMetadata>

Returns

string