summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hexgame/hexgame.tex
blob: 3e2088abf9dafa1c7698303bf5b6672371dbbc17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
\documentclass{article}
%
% Use the following packages ------------
\usepackage{hexgame}
% Paper definitions ---------------------
\setlength\paperheight {297mm}%
\setlength\paperwidth {210mm}%
\setlength\textwidth {165mm}%
\setlength\evensidemargin {-4mm}%
\setlength\oddsidemargin {-4mm}%
\setlength\topmargin {-12mm}%
\setlength\headheight {6mm}%
\setlength\headsep {4mm}%
\setlength\textheight {254mm}
\setlength\parindent {0mm}
\setlength\parskip {\baselineskip}
\setlength\unitlength {1mm}
\pagestyle{empty}
\begin{document}
\begin{center}
	\textbf{\Huge hexgame.sty} 

	Meron Brouwer \\
	(meron.brouwer@gmail.com)\\
	\today
\end{center}

\section{Introduction}
Hex is a mathematical game invented by the Danish mathematician Piet Hein and independently by the mathematician John Nash. This package defines a new
environment that enables the user to draw such a game in a trivial way. 

\section{Usage}
The package defines a new environment and two new commands. The environment is used to draw the board, the commands are used to color the hexagons or label them.

	\begin{minipage}{80mm}
		\verb+\begin{hexgame}{5}+ \\
		\verb+	\colorhex{2}{playerone}+ \\
		\verb+	\colorhex{4}{playertwo}+ \\
		\verb+	\colorhex{6}{playertwo}+ \\
		\verb+	\colorhex{25}{playerone}+ \\
		\verb+  \labelhex{23}{37}+\\
		\verb+\end{hexgame}+
	\end{minipage} 
	\begin{minipage}{85mm}
	\begin{hexgame}{5}
		\colorhex{2}{playerone}
		\colorhex{4}{playertwo}
		\colorhex{6}{playertwo}
		\colorhex{25}{playerone}
		\labelhex{23}{37}
	\end{hexgame}
	\end{minipage}

The hexagons are numbered from $1$ to $n^2$, starting at the bottom one. The argument after \verb+\begin{hexgame}+ gives $n$. When coloring a hexagon, the first argument gives which hexagon needs to be colored, the second argument defines the player that colored the hexagon. When labeling, the second argument will be printed in the hexagon.

\section{Variables to set}
Although everything is already defined the following variables can be reset by the user

\begin{itemize}
	\item \verb+ \setlength\hexgameboxwidth{0.45\textwidth}+ \\
		This length gives the width the hexgame. All games are scaled to this width.
	\item \verb+ \definecolor{playerone}{rgb}{0,0, .8}+	\\	
		playerone is a color, in this case set to blue. Use the same if you would like
		this player to be a different color. See the pstricks manual for more information.
	\item \verb+ \definecolor{playertwo}{rgb}{0.8,0,0}+	\\
		Same as playerone.
\end{itemize}

\begin{center}
\begin{hexgame}{3}
	\colorhex{2}{playerone}
	\colorhex{4}{playerone}
	\colorhex{6}{playertwo}
	\colorhex{9}{playertwo}
	\labelhex{8}{6}
	\labelhex{9}{7}
\end{hexgame}
\begin{hexgame}{16}
	\colorhex{2}{playerone}
	\colorhex{4}{playerone}
	\colorhex{6}{playerone}
	\colorhex{3}{playertwo}
	\colorhex{12}{playertwo}
	\colorhex{11}{playertwo}
	\colorhex{23}{playertwo}
	\colorhex{41}{playertwo}
	\colorhex{19}{playertwo}
	\colorhex{51}{playertwo}
	\labelhex{51}{4}
\end{hexgame}
\end{center}
\end{document}