I am trying to make a Chutes and Ladders style game. I have managed to piece together a board, but I plan to change the location of squares, ladders, and slides for future boards. The ladder is a particularly ugly hack that was adjusted by trial and error. I would be grateful for any advice on building such a board. Specifically I would like to make a command that draws each ladder by specifying the beginning and ending coordinates. I haven't been able to find any decorations that would help in drawing a ladder.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1.5]
%board
\draw (0,0) grid (6,1) (5,0)grid (6,3) (0,2)grid (6,3)
(0,2) grid (1,5) (0,4) grid (6,5)(5,5) grid (6,9)
(0,8) grid (6,9) (0,6) grid (1,8) (1,6) grid (4,7);
%ladders
\draw[scale=.5,xshift=2.5cm,yshift=1.5cm,rotate=-45] (0,-.5) grid ++(1,6);
\draw[scale=.5,xshift=6.5cm,yshift=9.5cm,rotate=-45] (0,-.5) grid ++(1,6);
\draw[scale=.5,xshift=.5cm,yshift=9.5cm,rotate=0] (0,-.5) grid ++(1,4);
% slides
\draw (1.75,2.5) sin ++(1,-1) cos ++(1,-1);
\draw (1.25,2.5) sin ++(1,-1) cos ++(1,-1);
\draw (5.75,4.5) sin ++(-.5,-1) cos ++(-.5,-1);
\draw (5.25,4.5) sin ++(-.5,-1) cos ++(-.5,-1);
\draw (3.5,6.5) node{$\star$};
\end{tikzpicture}
\end{document}
Best Answer
(there are four successive versions.)
1- Semi-Automatic Version
Here is a first attempt via
markings
. Board and ladders are drawing using integer coordinates of cells. But you have to find/specify manually the correct number of bars of each ladder.2- Automatic Version
Here is a second attempt with automatic calculation (via a
to
path) of number of bars for each ladder... The two images show the result with different values of\ladderstep
(1.5mm on the left and 3mm on the right).1.5mm 3mm
3- Complete Automatic Version
Here is a third attempt. I added the chutes (always via a
to
path).4- Complete Automatic Version with Styles, Scale and Variants
Here is a fourth attempt with scale feature as requested... but without
scale
option. Changes:You can choose the global size via
\cellsize
: each... auto
style takes into account the\cellsize
distance and changes the coordinate system to keep integer coordinates at center of cells.There are three new styles to choose drawing and filling options:
cell
,ladder
andchute
.There is a new
ladder auto bis
style to draw horizontal bars on ladders.