toSan

open fun toSan(language: String = "english", pieces: Array<String>? = null): String

Converts a move to Standard Algebraic Notation (SAN).

This function acts as a convenience wrapper to generate notation adapted to different languages. If the move is null, it returns an empty string. If the specified language is not predefined, a custom array of piece initials must be provided.

Supported internal languages: "english", "spanish", "dutch", "french", "german", and "italian".

Return

A string representation of the move in SAN format (e.g., "Nf3", "exd5", "O-O").

Since

1.0.0-beta.6

Parameters

language

The desired language for piece initials (defaults to "english").

pieces

An optional array of 12 strings for custom initials (e.g., ["", "N", "B", "R", "Q", "K", "", "N", "B", "R", "Q", "K"]).

Throws

If the language is unknown and a valid 12-element pieces array is not provided.