I need to draw up a Hex board, and am having problems with it. I need to draw it in its conventional form and also in John Nash's form.
I did find the hexgame package that simplifies the drawing in its conventional form. However, when I try using it there is just a huge red box with a black outline. Perhaps because this is from 2006? I also found a code sample here.
Code: Select all
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[
hexa/.style={
shape=regular polygon,
regular polygon sides=6,
minimum size=1cm,
draw,
inner sep=0,
anchor=south,
fill=lightgray!85!blue,
rotate=30
}
]
\foreach \j in {0,...,5}{%
\pgfmathsetmacro\end{5+\j}
\foreach \i in {0,...,\end}{%
\node[hexa] (h\i;\j) at ({(\i-\j/2)*sin(60)},{\j*0.75}) {};
}
}
\foreach \j in {0,...,4}{%
\pgfmathsetmacro\end{9-\j}
\foreach \i in {0,...,\end}{%
\pgfmathtruncatemacro\k{\j+6}
\node[hexa] (h\i;\k) at ({(\i+\j/2-2)*sin(60)},{4.5+\j*0.75}) {};
}
}
\foreach \k in {0,...,10} {%
\node[circle,red,minimum size=1cm] at (h3;\k) {3;\k};
}
\foreach \k in {0,...,10} {%
\node[circle,blue,minimum size=1cm] at (h1;\k) {1;\k};
}
\end{tikzpicture}
\end{document}
I would also like to draw a Hex game like John Nash played it. This is basically just a grid. Little dots to mark vertices where the grids cut each other, and lines (edges) between all vertices lying on the same y=x line.
Is there a pre-existing way, or rather an easy way to do this? If not, could someone point me to documentation on how to do this?
Thanks!