diff --git a/sudoku.tex b/sudoku.tex index c0d0f4b..b744081 100644 --- a/sudoku.tex +++ b/sudoku.tex @@ -17,31 +17,19 @@ % Delete any of the following that are not needed -\usepackage{amsmath} -\usepackage{amssymb} -\usepackage{makeidx} -\usepackage{graphicx} -\usepackage{array} -\usepackage{multirow} -\usepackage{gensymb} % Just for the degree symbol -\usepackage{ccicons} % Creative Commons icons; now we can delete an image \usepackage{lettrine} % Drop caps \usepackage{wrapfig} % Let's wrap some images -\usepackage{hanging} % For hanging indents in a script -\usepackage{fancyvrb} % Use line numbers with code samples -\usepackage{fvextra} % Break lines inside Verbatim environment: \usepackage{enumitem} % Control spacing in lists \usepackage{setspace} % Better control over line-spacing \usepackage{nicefrac} % Use nice fractions \usepackage[bottom]{footmisc} % Keep the footnotes at the bottom of the page -%\usepackage{tabto} % Use tab stops when we need to (especially in footnotes) \usepackage{microtype} % Make things neater. \usepackage{tabularray} % Easy tables \usepackage[]{footmisc} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{ninecolors} - +\usepackage{lipsum} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -63,7 +51,6 @@ margin=15mm, % a5paper % Comment out for half-letter paper } - \addtolength{\topmargin}{10mm} % Adjust and bottom margin \addtolength{\textheight}{-20mm} % Adjust the bottom margin @@ -103,12 +90,12 @@ % Make hrefs easier (must load package hyperref} \newcommand\kref[2]{\href{#1}{{\texttt{#2}}}} -% Rotate text in tables easier -% https://tex.stackexchange.com/questions/89115/how-to-rotate-text-in-multirow-table -\newcommand\krot[3]{\parbox[t]{#1}{\multirow{#2}{*}{\rotatebox[origin=c]{90}{#3}}}} -% Draw a sudoku grid -\newcommand{\kgrid}{ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Custom Macros %%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Draw a sudoku grid with labels +\newcommand{\kgridl}{ % Thick horizontal lines \draw [ultra thick](0,0)--(9,0); \draw [ultra thick](0,3)--(9,3); @@ -134,7 +121,7 @@ \draw (7,0)--(7,9); \draw (8,0)--(8,9); % Labels - \begin{scriptsize} + \begin{footnotesize} \node at (-0.5,0.5) {R1}; \node at (-0.5,1.5) {R2}; \node at (-0.5,2.5) {R3}; @@ -153,18 +140,47 @@ \node at (6.5,-0.5) {C7}; \node at (7.5,-0.5) {C8}; \node at (8.5,-0.5) {C9}; - \end{scriptsize} + \end{footnotesize} +} + +% Draw a sudoku grid without labels +\newcommand{\kgrid}{ +% Thick horizontal lines + \draw [ultra thick](0,0)--(9,0); + \draw [ultra thick](0,3)--(9,3); + \draw [ultra thick](0,6)--(9,6); + \draw [ultra thick](0,9)--(9,9); +% Thick vertical lines + \draw [ultra thick](0,0)--(0,9); + \draw [ultra thick](3,0)--(3,9); + \draw [ultra thick](6,0)--(6,9); + \draw [ultra thick](9,0)--(9,9); +% Thin horizontal lines + \draw (0,1)--(9,1); + \draw (0,2)--(9,2); + \draw (0,4)--(9,4); + \draw (0,5)--(9,5); + \draw (0,7)--(9,7); + \draw (0,8)--(9,8); +% Thin vertical lines + \draw (1,0)--(1,9); + \draw (2,0)--(2,9); + \draw (4,0)--(4,9); + \draw (5,0)--(5,9); + \draw (7,0)--(7,9); + \draw (8,0)--(8,9); } % Sudoku nodes -\newcommand{\knode}[3]{\node at (#1,#2) {#3};} +\newcommand{\knode}[3]{\node at ($(#1-0.5,#2-0.5)$) {#3};} % Sudoku fills \newcommand{\kfill}[3]{\draw [fill=gray#3, line width=0mm] (#1,#2) rectangle +(1,1);} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Just for Issue #006 %%%%%%%%%%%%%%%%%%%%%% +% Sudoku markers +\newcommand{\kfirst}[2]{\fill [red5] ($(#1 - 0.2,#2 - 0.2)$) circle (0.75pt);} +\newcommand{\ksecond}[2]{\fill [red5] ($(#1 - 0.2,#2 - 0.2)$) circle (0.75pt);\fill [red5] ($(#1 - 0.8,#2 - 0.2)$) circle (0.75pt);} +\newcommand{\kguess}[2]{\fill [red5] ($(#1 - 0.8,#2 - 0.8)$) circle (0.75pt);} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -211,62 +227,60 @@ If you want to donate financial support for the creation of this zine (and all t \chapter{What Is Sudoku?} -Tikz grid example: +\lettrine[loversize=0.5,nindent=-0.2mm]{S}{udoku} is a number-placement game played on a 9x9 grid for a total of 81 individual cells, with that main grid broken up into 9 subgrids of 9 cells each, as shown in figure \ref{subgrids}. The goal is to enter the numbers 1 through 9 into each cell such that each row, each column, and each subgrid contains each number only once. See figure \ref{fullgrid} for an example with rows and columns labeled. -\noindent{}\begin{tikzpicture}[x=5mm,y=5mm] -% Fills (must go first to put behind the grid) - \path [fill=gray8, line width=0mm] (6,7) -- (7,7) -- (7,8) -- (6,8); -% Thick horizontal lines - \draw [ultra thick](0,0)--(9,0); - \draw [ultra thick](0,3)--(9,3); - \draw [ultra thick](0,6)--(9,6); - \draw [ultra thick](0,9)--(9,9); -% Thick vertical lines - \draw [ultra thick](0,0)--(0,9); - \draw [ultra thick](3,0)--(3,9); - \draw [ultra thick](6,0)--(6,9); - \draw [ultra thick](9,0)--(9,9); -% Thin horizontal lines - \draw (0,1)--(9,1); - \draw (0,2)--(9,2); - \draw (0,4)--(9,4); - \draw (0,5)--(9,5); - \draw (0,7)--(9,7); - \draw (0,8)--(9,8); -% Thin vertical lines - \draw (1,0)--(1,9); - \draw (2,0)--(2,9); - \draw (4,0)--(4,9); - \draw (5,0)--(5,9); - \draw (7,0)--(7,9); - \draw (8,0)--(8,9); -% Nodes - \node at (0.5,7.5) {6}; - \node at (1.5,7.5) {1}; - \node at (4.5,7.5) {3}; - \node at (7.5,8.5) {9}; - \node at (8.5,8.5) {5}; - \node at (5.5,8.5) {2}; -\end{tikzpicture} - -\begin{wrapfigure}{R}{0.6\textwidth} +\begin{wrapfigure}{O}{0.45\textwidth} +\centering \begin{tikzpicture}[x=5mm,y=5mm] -\kfill{6}{7}{8} -\kgrid -\knode{0.5}{7.5}{6} -\knode{1.5}{7.5}{1} -\knode{4.5}{7.5}{3} -\knode{6.5}{1.5}{7} -\knode{6.5}{4.5}{4} -\knode{7.5}{8.5}{9} -\knode{8.5}{6.5}{2} -\knode{8.5}{8.5}{5} +% Thick horizontal lines + \draw [ultra thick](0,0)--(9,0); + \draw [ultra thick](0,3)--(9,3); + \draw [ultra thick](0,6)--(9,6); + \draw [ultra thick](0,9)--(9,9); +% Thick vertical lines + \draw [ultra thick](0,0)--(0,9); + \draw [ultra thick](3,0)--(3,9); + \draw [ultra thick](6,0)--(6,9); + \draw [ultra thick](9,0)--(9,9); \end{tikzpicture} -\caption{Grid A} +\caption[]{A sudoku grid showing only the subgrids.} +\label{subgrids} \end{wrapfigure} +Sudoku puzzles have anywhere from a few to many of the cells filled in with numbers. Those puzzles with more cells filled in are generally easier to complete than those with only a few cells filled in. + +Number puzzles of this type have been around for a long time, with one of the earliest appearing in 1892 in the French newspaper \textit{Le Siècle}, which was a partially completed 9x9 magic square\footnote{A square array of numbers in which the sum of numbers in each row, column, and both diagonals add up to the same number.} + +Despite the Japanese name (which translates roughly as ``digit-single'' or ``number-unique''), the modern sudoku puzzle is apparently an American invention, first appearing the May 1979 issue of \textit{Dell Pencil Puzzles \& Word Games} as ``Number Place''. It is apparently the work of a retired architect named Howard Garns, although the evidence is somewhat circumstantial: Garns appeared in the list of contributors in each issue that did contain a ``Number Place'' puzzle, but did not appear in the list of contributors in issues that did \textit{not} contain a ``Number Place'' puzzle.\footnote{See \kref{https://www.mathpuzzle.com/MAA/41-Sudoku Variations/mathgames_09_05_05.html}{https://www.mathpuzzle.com/MAA/41-Sudoku\%20Variations/mathgames\_09\\\_05\_05.html} for more information, which also contains more information on sudoku variations.} + +\begin{wrapfigure}{O}{0.5\textwidth} +\centering +\begin{tikzpicture}[x=5mm,y=5mm] +\kgridl +\end{tikzpicture} +\caption[]{A full 9x9 sudoku grid with columns and rows labeled.} +\label{fullgrid} +\end{wrapfigure} + +It was later imitated in the 1980's by the Japanese publisher Nikoli who introduced two small improvements: the number of clues was limited to 32, and the clues were distributed in a rotationally symmetric way, meaning that the clues were more evenly distributed across the grid. + +In 1997, Wayne Gould, a retired judge from New Zealand who had moved to Hong Kong spotted the puzzles in a Japanese bookshop and then spent the next six years developing a computer program to create sudoku puzzles, and started selling them local newspapers and eventually to the London \textit{Times}. He also publishes them from his own website at \kref{https://sudoku.com/}{https://sudoku.com/}.\footnote{See \kref{https://www.theguardian.com/media/2005/may/15/pressandpublishing.usnews}{https://www.theguardian.com/media/2005/may/15/pressandpublishing.u\\snews} for more information.} + + \chapter{The Rules of Sudoku} +\lettrine[loversize=0.5,nindent=-0.2mm]{T}{he} rules of sudoku are both few and simple: + +\begin{enumerate}[noitemsep] +\item Sudoku is played on a 9x9 grid. +\item You can only use the numbers 1 through 9. +\item Each vertical column can only contain the numbers 1 through 9, with no number being used more than once. +\item Each horizontal row can only contain the numbers 1 through 9, with no number being used more than once. +\item Each 3x3 subgrid can only contain the numbers 1 through 9, with no number being used more than once. +\end{enumerate} + +Winning is simple: you win when you have filled in the entire 9x9 grid according to the rules above. + \chapter{Troubleshooting}