tensor_predictors/LaTeX/images/fen2tensor.tex

79 lines
2.4 KiB
TeX

\documentclass{standalone}
\usepackage[LSB, T1]{fontenc}
\usepackage{chessboard}
\usepackage{skak}
\usepackage{tikz, tikz-3dplot}
\usepackage{amsmath}
\usepackage{xcolor}
\newcommand{\z}{{\color{gray}0}}
\tdplotsetmaincoords{80}{135}
\setboardfontencoding{LSB}
\setchessboard{linewidth = 0.1em, showmover = false, smallboard}
\newcommand{\chessplane}[2]{
\begin{scope}[canvas is yz plane at x={-#1 * 0.8}, transform shape]
\node[fill = white, opacity = 0.7, outer sep=0pt, inner sep=2pt] (layer#1) at (0, 0) {
\chessboard[
margin=false,
pgfstyle=text,
text=\textbf{1},
markfields={#2},
label=false
]
};
\end{scope}
}
\begin{document}
\begin{tikzpicture}
\begin{scope}[tdplot_main_coords, scale = 1]
\chessplane{12}{e8};
\chessplane{11}{d8};
\chessplane{10}{a8, h8};
\chessplane{9}{c8, f8};
\chessplane{8}{b8, g8};
\chessplane{7}{a7, b7, c7, d7, e5, f7, g7, h7};
\chessplane{6}{e1};
\chessplane{5}{d1};
\chessplane{4}{a1, h1};
\chessplane{3}{c1, f1};
\chessplane{2}{c3, g1};
\chessplane{1}{a2, b2, c2, d2, e4, f2, g2, h2};
\begin{scope}[canvas is yz plane at x={-1}, transform shape]
\node[anchor = south, rotate = 90] at (layer1.west) {Ranks / Axis 1};
\node[anchor = north] at (layer1.south) {Files / Axis 2};
\end{scope}
\coordinate (offset) at (layer1.west);
\newdimen\xoffset
\pgfextractx{\xoffset}{\pgfpointanchor{offset}{center}}
\begin{scope}[canvas is xz plane at y=\xoffset, transform shape, xscale=-1]
\path (layer1.north west) -- (layer12.north west) node[
pos = 0.5, anchor = south
] {Pieces / Mixture Components};
\end{scope}
\end{scope}
\coordinate (tensor north) at (current bounding box.north);
\node[shift = {(0, 0)}, anchor = east] (pos) at (current bounding box.west) {{
\setchessboard{linewidth = 0.1em, showmover = false, smallboard}
\newgame
% The Vienna Game
\hidemoves{1. e4 e5 2.Nc3} % Like `\mainline` but does NOT show the PGN line
\chessboard{}
}};
\node[anchor = south] at (pos.center |- tensor north) {Position};
\node[anchor = south] at (tensor north) {Encoding};
\end{tikzpicture}
\end{document}