FenUtils

object FenUtils

Utility object for parsing and generating FEN (Forsyth-Edwards Notation) strings. Provides methods to convert between FEN strings and board/game state objects.

Overview

  • Parsing: Converts FEN strings into Board and GameState objects.

  • Rendering: Converts Board and GameState objects into FEN strings.

  • Utility: Provides helper methods for FEN-related operations.

Parsing Methods

Rendering Methods

  • getFenFromBoardAndState: Generates a FEN string from a Board and GameState.

  • renderPiecePlacement: Converts the board's piece placement into FEN format.

  • renderCastlingRights: Converts castling availability into FEN format.

Utility Methods

  • pieceTypeFromFenChar: Maps FEN characters to PieceType.

Example Usage

val (board, gameState) = FenUtils.parseFen(FenUtils.DEFAULT_FEN)
val fen = FenUtils.getFenFromBoardAndState(board, gameState)

Properties

Link copied to clipboard
const val DEFAULT_FEN: String

The default FEN string for the standard chess starting position.

Functions

Link copied to clipboard

Generates a FEN string from the given board and gameState.

Link copied to clipboard

Parses a FEN string into a Board and GameState.