TeX - LaTeX Asked on January 31, 2021
A PSTricks solution only for fun purposes!
It is created with a trick stolen from this solution.
documentclass[pstricks,border=dimexpr355pt/113relax,12pt]{standalone}
usepackage{tikzducks}
newcommandobj{rput(.5,.5){tikz[scale=.35]duck;}}
begin{document}
letCUMULATIVEundefined
foreach k in {0/0,2/3,4/4,3/6,1/7,2/5,3/3,2/1}{
xdefCUMULATIVE{ifdefinedCUMULATIVE CUMULATIVE,fi k}
begin{pspicture}(8,8)
psframe[dimen=i,linewidth=dimexpr355pt/113relax,linecolor=brown](8,8)
multips(0,0)(0,2){4}{%
multips(0,0)(2,0){4}{%
multips(0,0)(1,1){2}{psframe*(1,1)}}}
pscustom[linecolor=red,linewidth=3pt,linejoin=1]{%
moveto(.5,.5)%
foreach i/j in CUMULATIVE {lineto(!ispace .5 add jspace .5 add)}}
foreach i/j in CUMULATIVE {rput(i,j){obj}}
end{pspicture}}
end{document}
Answered by Money Oriented Programmer on January 31, 2021
usepackage("skak");
unitsize(1cm);
void chessboard(int n=3, pen color1= currentpen, pen color2= white)
{
for (int i=0; i < n; ++i){
for (int j=0; j < n; ++j){
fill(shift(j,i)*unitsquare, (i%2 ==0 && j%2 == 0) ? color1 : color2);
if (i%2 !=0 && j%2 != 0) { fill(shift(j,i)*unitsquare, color1); }
}
}
}
chessboard(8,darkgreen,white);
pair pos(pair A){ return (A+(A-(1,1)))/2; }
path[] Lpath=texpath("$BlackKnightOnWhite$");
picture pic;
filldraw(pic,Lpath,white,black+0.3bp);
add(scale(1.5)*pic,pos((3,5)));
pair[] Pos={(8,8),(7,6),(6,8),(8,7),(7,5),(5,6),(4,8),(2,7),(1,5),(3,6),(2,8),(1,6)};
pair[] listofpostions;
for( pair A : Pos){ listofpostions.push(pos(A));}
draw(operator -- (... listofpostions),red+1.5bp);
for (int i=0; i < listofpostions.length ; ++i)
{
label(scale(2)*Label("$"+ (string) (i+1) +"$",gray),listofpostions[i]);
}
import animate;
usepackage("skak");
settings.tex="pdflatex";
settings.outformat="pdf";
animation Ani;
unitsize(1cm);
void chessboard(int n=3, pen color1= currentpen, pen color2= white)
{
for (int i=0; i < n; ++i){
for (int j=0; j < n; ++j){
fill(shift(j,i)*unitsquare, (i%2 ==0 && j%2 == 0) ? color1 : color2);
if (i%2 !=0 && j%2 != 0) { fill(shift(j,i)*unitsquare, color1); }
}
}
}
chessboard(8,darkgreen,white);
pair pos(pair A){ return (A+(A-(1,1)))/2; }
pair[] Pos={(8,8),(7,6),(6,8),(8,7),(7,5),(5,6),(4,8),(2,7),(1,5),(3,6),(2,8),(1,6)};
pair[] listofpostions;
for( pair A : Pos){ listofpostions.push(pos(A));}
path[] Lpath=texpath("$BlackKnightOnWhite$");
picture pic;
filldraw(pic,Lpath,white,black+0.3bp);
guide g;
for (int i=0; i < listofpostions.length ; ++i){
save();
g=g--listofpostions[i];
draw(g,(i != 0) ? red+1.5bp : invisible);
add(scale(1.5)*pic,listofpostions[i]);
Ani.add();
restore();
label(scale(2)*Label("$"+ (string) (i+1) +"$",gray),listofpostions[i]);
}
erase();
chessboard(8,darkgreen,white);
draw(g,red+1.5bp);
for (int i=0; i < listofpostions.length ; ++i){
label(scale(2)*Label("$"+ (string) (i+1) +"$",gray),listofpostions[i]);
}
add(scale(1.5)*pic,pos((3,5)));
Ani.add();
erase();
Ani.movie();
Answered by Nguyen Van Chi on January 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP