fen.1 - chess-puzzles - chess puzzle book generator
HTML git clone git://git.codemadness.org/chess-puzzles
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
fen.1 (2904B)
---
1 .Dd March 4, 2026
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 | describe | 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 describe
57 Describe piece positions as text for the board.
58 .It fen
59 FEN of the board state after playing the moves.
60 .It pgn
61 PGN output of the moves for the board.
62 .It speak
63 Write each move per line as text to stdout.
64 Intended to be piped to speech applications.
65 .It svg
66 SVG image of the board.
67 .It tty
68 Text representation of the board suitable for a terminal.
69 The terminal requires UTF-8 support for chess symbols and it uses truecolor for
70 the board theme.
71 .El
72 .It Fl s
73 Show an indicator on the board which side it is to move (svg and tty), default
74 is on.
75 .It Fl S
76 Do not show an indicator on the board which side it is to move (svg and tty).
77 .It Fl t Ar theme
78 Use a colour theme for certain output formats, supported are the names: brown
79 (default), green, grey.
80 .El
81 .Sh ENVIRONMENT VARIABLES
82 .Bl -tag -width Ds
83 .It Ev QUERY_STRING
84 If this option is set
85 .Nm
86 will run in "CGI" mode suitable for a web server / HTTP daemon.
87 This accepts the parameters: fen, moves, output, flip, coords and theme,
88 similar to the command-line flags.
89 It will serve a SVG of the chess board and moves.
90 .El
91 .Sh EXIT STATUS
92 .Ex -std
93 .Sh EXAMPLES
94 .Bd -literal
95 fen -o tty startpos e2e4
96
97 fen startpos e2e4 > board.svg
98 .Ed
99 .Sh AUTHORS
100 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
101 .Sh CAVEATS
102 .Nm
103 supports classical chess and chess960 only.
104 Input moves are not validated, they are assumed to be legal.
105 .Sh BUGS
106 I hope it covers the case of taking en passant during a blood moon while a leap
107 second ellapses.
108 If it does not, please report it.