diff options
author | Karl Berry <karl@freefriends.org> | 2023-07-22 20:18:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-07-22 20:18:30 +0000 |
commit | 2c38621296bf9859266da2433f18e924e40b2cc9 (patch) | |
tree | d86e7dc5f70c19d07e7cfe68e00228a553b1d06f /Master | |
parent | 4ee3602292fd9eae760ab088ab8f5462e6398683 (diff) |
mpchess (22jul23)
git-svn-id: svn://tug.org/texlive/trunk@67704 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf | bin | 862646 -> 1000703 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex | 109 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf | bin | 867272 -> 1005336 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex | 103 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/fonts/truetype/public/mpchess/mpchessfont.ttf | bin | 38292 -> 38292 bytes | |||
-rw-r--r-- | Master/texmf-dist/metapost/mpchess/mpchess-pieces.mp | 18 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/mpchess/mpchess.mp | 82 |
8 files changed, 272 insertions, 42 deletions
diff --git a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf Binary files differindex 421fa6b0608..741544029ed 100644 --- a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf +++ b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.pdf diff --git a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex index bcc74e5003f..5ad5abdb1a6 100644 --- a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex +++ b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-en.tex @@ -68,7 +68,7 @@ } \vfill \begin{center} - Version 0.6, 2023, April, 26th \\ + Version 0.7, 2023, July, 20th \\ \url{https://plmlab.math.cnrs.fr/mchupin/mpchess} \end{center} %% == Page de garde ==================================================== @@ -293,12 +293,15 @@ command: \item[\meta{string}] can be: \begin{itemize} \item \lstinline+"BlueLichess"+ (default); -\item \lstinline+"BrownLichess"+ ; +\item \lstinline+"BrownLichess"+; +\item \lstinline+"GreenLichess"+; +\item \lstinline+"PinkPyramidalLichess"+; +\item \lstinline+"Wood"+; \item or \lstinline+"Classical"+. \end{itemize} \end{description} -The following examples show the results obtained from each theme: +The following example shows the results obtained from \lstinline+"BrownLichess"+: \begin{ExempleMP} input mpchess beginfig(0); @@ -307,21 +310,65 @@ init_backboard; draw backboard; endfig; \end{ExempleMP} -\begin{ExempleMP} -input mpchess -beginfig(0); -set_color_theme("Classical"); -init_backboard; -draw backboard; -endfig; -\end{ExempleMP} -The two color themes provided borrow the colors of the Lichess themes. +The table~\ref{tab:color} shows the different results of the different themes. + +\begin{table} + \centering +\begin{tabular}{cc} + +\lstinline+"GreenLichess"+ theme&\lstinline+"Classical"+ theme\\ +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("GreenLichess"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode} +&\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("Classical"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}\\ +\lstinline+"PinkPyramidalLichess"+ theme& \lstinline+"Wood"+ theme\\ +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("PinkPyramidalLichess"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}& +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("Wood"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}\\ +\end{tabular} +\caption{The different color themes provided by \mpchess.}\label{tab:color} +\end{table} + \subsubsection{Configuring a Personal Color Theme} -A color theme is really just the definition of two colors. +\paragraph{Colors.} +A color theme is the definition of two colors. These can be defined with the following commands\footnote{Attention, in version 0.6, \lstinline+set_white_color+ became \lstinline+set_white_squares_color+ and \lstinline+set_black_color+ became @@ -341,6 +388,40 @@ init_backboard; draw backboard; endfig; \end{ExempleMP} + +\paragraph{Color Types.} + +To choose a type, you can use the following command: + +\commande|set_board_type(«string»)|\index{set_board_type@\lstinline+set_board_type+}\smallskip + + +Three types of coloring are available: + +\begin{description} + \item[\meta{string}] can be: +\begin{itemize} +\item \lstinline+"flat"+, simple flat coloring (default); +\item \lstinline+"pyramidal"+, Lichess \emph{pyramidal} coloring; +\item \lstinline+"wood"+, wood imitation. +\end{itemize} +\end{description} + +Here is an example coupling color and type definitions. + +\begin{ExempleMP} +input mpchess +beginfig(0); +set_white_squares_color((0.9,0.8,0.8)); +set_black_squares_color((0.7,0.6,0.6)); +set_board_type("wood"); +init_backboard; +draw backboard; +endfig; +\end{ExempleMP} + + + \subsection{Display Coordinates} You may have noticed in the various examples that by default, the coordinates are, as on the Lichess site, written in small letters inside the boxes. @@ -1367,6 +1448,8 @@ endfig; \section{History} \begin{description} +\item[v0.7, juillet 2023:] Black knight adjustment, adding color board themes (\lstinline+GreenLichess+, \lstinline+PinkPyramidalLichess+, +\lstinline+Wood+ with color type (\lstinline+set_board_type+). \item[v0.6, April 26, 2023:] Fixed bugs concerning castling management, and moves ambiguities in \textsc{pgn} format. Changed \lstinline+set_white_color+ to diff --git a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf Binary files differindex fd467b65954..bcca5a85f97 100644 --- a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf +++ b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.pdf diff --git a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex index 2ee8714da40..db6a5f8b866 100644 --- a/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex +++ b/Master/texmf-dist/doc/metapost/mpchess/mpchess-doc-fr.tex @@ -71,7 +71,7 @@ } \vfill \begin{center} - Version 0.6, 26 avril 2023 \\ + Version 0.7, 20 juillet 2023 \\ \url{https://plmlab.math.cnrs.fr/mchupin/mpchess} \end{center} %% == Page de garde ==================================================== @@ -289,6 +289,9 @@ Plusieurs thèmes de couleurs sont accessibles. Pour choisir un thème de couleu \begin{itemize} \item \lstinline+"BlueLichess"+ (thème par défaut); \item \lstinline+"BrownLichess"+ ; +\item \lstinline+"GreenLichess"+; +\item \lstinline+"PinkPyramidalLichess"+; +\item \lstinline+"Wood"+; \item ou \lstinline+"Classical"+. \end{itemize} \end{description} @@ -302,20 +305,64 @@ init_backboard; draw backboard; endfig; \end{ExempleMP} -\begin{ExempleMP} -input mpchess -beginfig(0); -set_color_theme("Classical"); -init_backboard; -draw backboard; -endfig; -\end{ExempleMP} -Les deux thèmes colorés fournis empruntent les couleurs des thèmes de Lichess. +Le tableau~\ref{tab:color} montre les résultats des différents thèmes fournis +par \mpchess. + +\begin{table} + \centering +\begin{tabular}{cc} + +Thème \lstinline+"GreenLichess"+&Thème \lstinline+"Classical"+\\ +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("GreenLichess"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode} +&\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("Classical"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}\\ +Thème \lstinline+"PinkPyramidalLichess"+&Thème \lstinline+"Wood"+\\ +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("PinkPyramidalLichess"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}& +\begin{mplibcode} + input mpchess + beginfig(0); + init_chessboard; + set_backboard_width(4cm); + set_color_theme("Wood"); + init_backboard; + draw backboard; + endfig; +\end{mplibcode}\\ +\end{tabular} +\caption{Les différents thèmes de couleur fournis par \mpchess.}\label{tab:color} +\end{table} \subsubsection{Configuration d’un thème personnel} -Un thème de couleur est en réalité simplement la définition de deux couleurs. +\paragraph{Couleurs.} +Un thème de couleur conciste en la définition de deux couleurs. Celles-ci peuvent se définir avec les commandes suivantes \footnote{Attention, lors du passage à la version 0.6, \lstinline+set_white_color+ est devenu \lstinline+set_white_squares_color+ et \lstinline+set_black_color+ est devenu @@ -335,6 +382,37 @@ init_backboard; draw backboard; endfig; \end{ExempleMP} + +\paragraph{Type de coloriage.} + + +On peut choisir un type de coloriage avec la commande suivante: + +\commande|set_board_type(«string»)|\index{set_board_type@\lstinline+set_board_type+}\smallskip + +Les trois types de coloriage fournis par \mpchess{} se choisissent avec +\begin{description} + \item[\meta{string}] qui peut valoir: +\begin{itemize} +\item \lstinline+"flat"+, coloriage à plat (défaut); +\item \lstinline+"pyramidal"+, coloriage \emph{pyramidal} à la Lichess; +\item \lstinline+"wood"+, imitation bois. +\end{itemize} +\end{description} + +Voici un exemple de paramétrage de couleur et de type de coloriage. + +\begin{ExempleMP} +input mpchess +beginfig(0); +set_white_squares_color((0.9,0.8,0.8)); +set_black_squares_color((0.7,0.6,0.6)); +set_board_type("wood"); +init_backboard; +draw backboard; +endfig; +\end{ExempleMP} + \subsection{Affichage des coordonnées} Vous avez pu constater dans les divers exemples que par défaut, les coordonnées @@ -1346,6 +1424,9 @@ endfig; \section{Historique} \begin{description} +\item[v0.7, juillet 2023:] Ajustement du cavalier noir, ajout de thèmes +d'échiquier (\lstinline+GreenLichess+, \lstinline+PinkPyramidalLichess+, +\lstinline+Wood+ avec des types de coloriage (\lstinline+set_board_type+). \item[v0.6, avril 2023:] Corrections de bugs concernant la gestion des roques, et des ambiguïtés de pièces pour les déplacements sous format \textsc{pgn}. Changement de \lstinline+set_white_color+ en diff --git a/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex b/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex index 62e5ad24132..6a7f11d747a 100644 --- a/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex +++ b/Master/texmf-dist/doc/metapost/mpchess/mpchess-preamble.tex @@ -97,7 +97,7 @@ set_no_coords,set_white_view,set_black_view, set_white_player,set_black_player,set_pieces_theme,set_players_side,init_chessboard,set_empty_chessboard,add_white_pieces,add_black_pieces,clear_areas,clear_files,clear_ranks,clear_squares,build_chessboard_from_fen,build_chessboards_from_pgn,clear_chessboard, color_square,draw_arrows,draw_circles,draw_comment,draw_crosses,get_halfmove_number,get_totalmove_number, - reset_mpchess,set_black_to_move,set_last_move_color,set_comment_color,set_white_to_move,set_whos_to_move,show_last_move,unset_whos_to_move,set_arrow_width,clip_chessboard,build_chessboard_from_fen_file,build_chessboard_from_pgn_file,draw_black_main_lines,draw_black_main_lines_step,draw_white_main_lines,draw_white_main_lines_step,set_main_lines_color,set_possible_moves_color,show_possible_moves,show_possible_moves_step,hide_coordinates,hide_whos_to_move,set_black_squares_color,set_coordinates_font,set_coordinates_position,set_white_squares_color,show_coordinates,show_whos_to_move}, + reset_mpchess,set_black_to_move,set_last_move_color,set_comment_color,set_white_to_move,set_whos_to_move,show_last_move,unset_whos_to_move,set_arrow_width,clip_chessboard,build_chessboard_from_fen_file,build_chessboard_from_pgn_file,draw_black_main_lines,draw_black_main_lines_step,draw_white_main_lines,draw_white_main_lines_step,set_main_lines_color,set_possible_moves_color,show_possible_moves,show_possible_moves_step,hide_coordinates,hide_whos_to_move,set_black_squares_color,set_coordinates_font,set_coordinates_position,set_white_squares_color,show_coordinates,show_whos_to_move,set_board_type}, keywordstyle=\color{darkred}, classoffset=2,% frame=tb morekeywords={backboard,chessboard,chessboard_step}, diff --git a/Master/texmf-dist/fonts/truetype/public/mpchess/mpchessfont.ttf b/Master/texmf-dist/fonts/truetype/public/mpchess/mpchessfont.ttf Binary files differindex 11f0bef6929..000d7414307 100644 --- a/Master/texmf-dist/fonts/truetype/public/mpchess/mpchessfont.ttf +++ b/Master/texmf-dist/fonts/truetype/public/mpchess/mpchessfont.ttf diff --git a/Master/texmf-dist/metapost/mpchess/mpchess-pieces.mp b/Master/texmf-dist/metapost/mpchess/mpchess-pieces.mp index 0d6aa5ea248..7a5de31b95f 100644 --- a/Master/texmf-dist/metapost/mpchess/mpchess-pieces.mp +++ b/Master/texmf-dist/metapost/mpchess/mpchess-pieces.mp @@ -51,14 +51,14 @@ linejoin := mitered; fill (19.250000,7.917970)..controls (22.527300,7.917970) and (22.671900,5.488280)..(22.671900,3.679690) --(5.632810,3.679690)..controls (5.632810,5.519530) and (5.777340,7.917970)..(9.054690,7.917970) --cycle; -fill (19.257799,9.101560)--(9.082030,9.101560)..controls (9.218750,12.449200) and (13.515600,14.226600)..(13.710900,15.843800) - ..controls (13.906300,17.457001) and (13.031300,17.875000)..(13.031300,17.875000) - ..controls (13.031300,17.875000) and (12.433600,15.933600)..(11.668000,15.535200) - ..controls (10.902300,15.136700) and (9.125000,14.765600)..(9.125000,14.765600) - ..controls (9.125000,14.765600) and (7.875000,13.789100)..(7.140630,13.855500) - ..controls (6.406250,13.925800) and (5.773440,15.449200)..(5.773440,15.449200) - --(8.273440,18.898399)--(9.539060,21.347700)--(10.734400,22.476601) - --(11.246100,24.136700)--(12.683600,22.675800)..controls (20.597700,22.675800) and (22.316401,13.824200)..(19.257799,9.101560) +fill (18.890600,9.101560)--(9.410160,9.101560)..controls (9.539060,12.566400) and (13.539100,14.410200)..(13.722700,16.085899) + ..controls (13.906300,17.757799) and (13.089800,18.187500)..(13.089800,18.187500) + ..controls (13.089800,18.187500) and (12.531300,16.175800)..(11.820300,15.765600) + ..controls (11.109400,15.355500) and (9.449220,14.968800)..(9.449220,14.968800) + ..controls (9.449220,14.968800) and (8.289060,13.957000)..(7.601560,14.027300) + ..controls (6.917970,14.097700) and (6.332030,15.675800)..(6.332030,15.675800) + --(8.656250,19.253901)--(9.835940,21.785200)--(10.949200,22.957001) + --(11.425800,24.675800)--(12.765600,23.164101)..controls (20.140600,23.164101) and (21.738300,13.992200)..(18.890600,9.101560) --cycle; ); @@ -363,4 +363,4 @@ draw (19.609400,21.625000)--(17.171900,22.253901)--(16.644501,21.011700) --(8.683590,21.382799)..controls (8.683590,21.382799) and (8.660160,17.046900)..(9.914060,17.070299) --(18.378901,17.070299)..controls (19.628901,17.070299) and (19.609400,21.625000)..(19.609400,21.625000) --cycle; -);
\ No newline at end of file +); diff --git a/Master/texmf-dist/metapost/mpchess/mpchess.mp b/Master/texmf-dist/metapost/mpchess/mpchess.mp index d16c8214934..3883ca0bc34 100644 --- a/Master/texmf-dist/metapost/mpchess/mpchess.mp +++ b/Master/texmf-dist/metapost/mpchess/mpchess.mp @@ -1,8 +1,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% mpchess.mp %% %% draw chessboards with metapost %% -%% chupin@ceremade.dauphine.fr %% -%% Version 0.6 (avril 2023) %% +%% notezik@gmail.com %% +%% Version 0.7 (juillet 2023) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This work may be distributed and/or modified under the conditions of @@ -21,6 +21,7 @@ input mpchess-skak; % piece of skak package input mpchess-chessboard; input mpchess-pgn; input mpchess-fen; +input fiziko; if not known mplib: input latexmp fi; @@ -198,13 +199,54 @@ picture _blackSquarePic, _whiteSquarePic; picture _blackSquareColoredPic, _whiteSquareColoredPic; picture _blackSquareClassicalPic, _whiteSquareClassicalPic; +def _wood_draw(expr N,d,p,c,_SquareUnit)= + save _up_wood,_down_wood; + path _up_wood,_down_wood; + fill unitsquare scaled _SquareUnit withcolor c; + for i=1 upto N-1: + _up_wood:=(i/N+uniformdeviate(d),0.0+0.5p/_SquareUnit)*_SquareUnit--(i/N,0.0+0.5p/_SquareUnit)*_SquareUnit--(i/N,0.5)*_SquareUnit--(i/N+uniformdeviate(d),0.7+uniformdeviate(.3)-p/_SquareUnit)*_SquareUnit--cycle; + fill _up_wood withcolor ((0.9+uniformdeviate + .25)[white,c]); + _down_wood:=((i-1)/N+uniformdeviate(d)+0.5/N,1.0-0.5p/_SquareUnit)*_SquareUnit--((i-1)/N+0.5/N,1.0-0.5p/_SquareUnit)*_SquareUnit--((i-1)/N+0.5/N,0.5)*_SquareUnit--((i-1)/N+uniformdeviate(d)+0.5/N,0.3-uniformdeviate(.3)+p/_SquareUnit)*_SquareUnit--cycle; + fill _down_wood withcolor ((0.9+uniformdeviate + .25)[white,c]); + endfor; +enddef; + def _buildColoredSquare(expr _SquareUnit,_BlackColor,_WhiteColor)= - _blackSquarePic:=image( - fill unitsquare scaled _SquareUnit withcolor _BlackColor; - ); - _whiteSquarePic:=image( - fill unitsquare scaled _SquareUnit withcolor _WhiteColor; - ); + if(_chess_board_type="flat"): + _blackSquarePic:=image( + fill unitsquare scaled _SquareUnit withcolor _BlackColor; + ); + _whiteSquarePic:=image( + fill unitsquare scaled _SquareUnit withcolor _WhiteColor; + ); + elseif(_chess_board_type="pyramidal"): + _blackSquarePic:=image( + fill unitsquare scaled _SquareUnit withcolor _BlackColor; + fill (1,0)--(1,1)--(0.5,0.5)--cycle scaled _SquareUnit withcolor + 0.97[black,_BlackColor]; + fill (0,1)--(0,0)--(0.5,0.5)--cycle scaled _SquareUnit withcolor + 0.97[white,_BlackColor]; + ); + _whiteSquarePic:=image( + fill unitsquare scaled _SquareUnit withcolor _WhiteColor; + fill (1,0)--(1,1)--(0.5,0.5)--cycle scaled _SquareUnit withcolor + 0.97[black,_WhiteColor]; + fill (0,1)--(0,0)--(0.5,0.5)--cycle scaled _SquareUnit withcolor + 0.97[white,_WhiteColor]; + ); + elseif(_chess_board_type="wood"): + _N_wood:=20; + _deviate_wood:=0.02; + _pencile_wood:=0.7pt; + path _up_wood,_down_wood,_q,_p; + _blackSquarePic:=image( + _wood_draw(_N_wood,_deviate_wood,_pencile_wood,_BlackColor,_SquareUnit); + ); + _whiteSquarePic:=image(_wood_draw(_N_wood,_deviate_wood,_pencile_wood,_WhiteColor,_SquareUnit); + ); + fi enddef; def _buildClassicalSquare(expr _SquareUnit)= @@ -223,11 +265,25 @@ _whiteSquarePic:=_whiteSquareColoredPic; def set_color_theme(expr t)= _chessTheme := t; if(t="BlueLichess"): + _chess_board_type:="flat"; _blackColorSquare:=(0.549,0.6353,0.6784); _whiteColorSquare:=(0.8706,0.8912,0.902); elseif(t="BrownLichess"): + _chess_board_type:="flat"; _blackColorSquare:=(0.709803922,0.5333,0.3882); _whiteColorSquare:=(0.941176471,0.850980392,0.709803922); + elseif(t="GreenLichess"): + _chess_board_type:="flat"; + _blackColorSquare:=(0.5255,0.651,0.4); + _whiteColorSquare:=(1.0,1.0,0.8666); + elseif(t="PinkPyramidalLichess"): + _chess_board_type:="pyramidal"; + _blackColorSquare:=(0.949,0.451,0.451); + _whiteColorSquare:=(0.9294,0.9333,0.73333); + elseif(t="Wood"): + _chess_board_type:="wood"; + _blackColorSquare:=(0.4902,0.3569,0.2118); + _whiteColorSquare:=(0.8039,0.7843,0.7725); elseif(t="Classical"): _blackColorSquare:=black; _whiteColorSquare:=black; @@ -490,6 +546,16 @@ enddef; picture backboard; +string _chess_board_type; % define flat color or "pyramidal" like lichess + +% default value flat +_chess_board_type:="flat"; + +vardef set_board_type(expr s) = + _chess_board_type:=s; +enddef; + + def init_backboard = _chessSquareU:=_chessWidth/_chessSize; _init_piece(_chessSquareU); |