fen.1 - chess-puzzles - chess puzzle book generator
 (HTM) git clone git://git.codemadness.org/chess-puzzles
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       fen.1 (2832B)
       ---
            1 .Dd July 22, 2025
            2 .Dt FEN 1
            3 .Os
            4 .Sh NAME
            5 .Nm fen
            6 .Nd parses chess FEN, plays moves and writes output
            7 .Sh SYNOPSIS
            8 .Nm
            9 .Op Fl cCfFhH
           10 .Op Fl l
           11 .Op Fl m mapping
           12 .Op Fl o Ar ascii | fen | pgn | speak | svg | tty
           13 .Op Fl sS
           14 .Op Fl t theme
           15 .Op Ar FEN
           16 .Op Ar moves
           17 .Sh DESCRIPTION
           18 .Nm
           19 parses the Forsyth-Edwards Notation (FEN) to setup the chess board.
           20 It then plays some
           21 .Ar moves
           22 and writes the output to a chosen format.
           23 The
           24 .Ar moves
           25 are in the Universal Chess Interface (UCI) format.
           26 For example "e2e4" or "e7e8q" (promotion to queen).
           27 .Pp
           28 The options are as follows:
           29 .Bl -tag -width Ds
           30 .It Fl c
           31 Enable board coordinates, default is on.
           32 .It Fl C
           33 Disable board coordinates.
           34 .It Fl f
           35 Flip the board, default is off.
           36 .It Fl F
           37 Do not flip the board.
           38 .It Fl h
           39 Highlight the last played move and checks or checkmates.
           40 .It Fl H
           41 Do not highlight the last played move and checks or checkmates.
           42 .It Fl l
           43 For PGN and speak mode only output the last move.
           44 For PGN this will not prefix the move number.
           45 .It Fl m Ar mapping
           46 Specify a mapping to remap the piece letters to a localized PGN format.
           47 For example for dutch: (K)oning, (D)ame, (T)oren, (L)oper, (P)aard it could be:
           48 "KDTLP".
           49 The default is: "KQRBN".
           50 .It Fl o Ar format
           51 Output format to one of the following format:
           52 .Bl -tag -width Ds
           53 .It ascii
           54 ASCII text representation of the board.
           55 FEN of the board state after playing the moves.
           56 .It fen
           57 FEN of the board state after playing the moves.
           58 .It pgn
           59 PGN output of the moves for the board.
           60 .It speak
           61 Write each move per line as text to stdout.
           62 Intended to be piped to speech applications.
           63 .It svg
           64 SVG image of the board.
           65 .It tty
           66 Text representation of the board suitable for a terminal.
           67 The terminal requires UTF-8 support for chess symbols and it uses truecolor for
           68 the board theme.
           69 .El
           70 .It Fl s
           71 Show an indicator on the board which side it is to move (svg and tty), default
           72 is on.
           73 .It Fl S
           74 Do not show an indicator on the board which side it is to move (svg and tty).
           75 .It Fl t Ar theme
           76 Use a colour theme for certain output formats, supported are the names: brown
           77 (default), green, grey.
           78 .El
           79 .Sh ENVIRONMENT VARIABLES
           80 .Bl -tag -width Ds
           81 .It Ev QUERY_STRING
           82 If this option is set
           83 .Nm
           84 will run in "CGI" mode suitable for a web server / HTTP daemon.
           85 This accepts the parameters: fen, moves, output, flip, coords and theme,
           86 similar to the command-line flags.
           87 It will serve a SVG of the chess board and moves.
           88 .El
           89 .Sh EXIT STATUS
           90 .Ex -std
           91 .Sh EXAMPLES
           92 .Bd -literal
           93 fen -o tty startpos e2e4
           94 
           95 fen startpos e2e4 > board.svg
           96 .Ed
           97 .Sh AUTHORS
           98 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
           99 .Sh CAVEATS
          100 .Nm
          101 supports classical chess and chess960 only.
          102 Input moves are not validated, they are assumed to be legal.
          103 .Sh BUGS
          104 I hope it covers the case of taking en passant during a blood moon while a leap
          105 second ellapses.
          106 If it does not, please report it.