sudoku-zine/sudoku.tex

288 lines
11 KiB
TeX

\documentclass[twoside]{report}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{float}
\raggedbottom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Choose either kpfonts or fourier
% \usepackage[nott]{kpfonts}
% \usepackage{fourier}
\usepackage{lmodern}
% Delete any of the following that are not needed
\usepackage{lettrine} % Drop caps
\usepackage{wrapfig} % Let's wrap some images
\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{microtype} % Make things neater.
\usepackage{tabularray} % Easy tables
\usepackage[]{footmisc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{ninecolors}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\graphicspath{{images/}} % Where are our images?
\usepackage{multicol} % Include two- or three-column sections
\counterwithout{footnote}{chapter} % Stop resetting the footnote count after each chapter
%\NumTabs{18} % Define 18 tab stops (at 1/4" intervals) [tabto package]
\raggedbottom % Don't force text to fill page
\setlength{\belowcaptionskip}{4pt} % Adjust space between caption and figure
%\renewcommand*\contentsname{In This Issue…} % Change the name of the TOC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Document Setup%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{geometry}
\geometry{
paperheight=8.5in,
paperwidth=5.5in,
margin=15mm,
% a5paper % Comment out for half-letter paper
}
\addtolength{\topmargin}{10mm} % Adjust and bottom margin
\addtolength{\textheight}{-20mm} % Adjust the bottom margin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Page Headers%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Adjust the TITLE as necessary
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\textit{Sudoku}}
\fancyhead[RE,LO]{Issue \#006}
\cfoot{Page \thepage}
\renewcommand{\footrulewidth}{0.5pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Chapter Title Spacing %%%%%%%%%%%%%%%%%%%%
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{\chaptertitlename\ \thechapter}
{20pt}
{\Huge}
\titlespacing*{\chapter}{0pt}{0pt}{40pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Custom Macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make a nice border and box for the tops of our examples
\newcommand\klab[3]{\vspace{#1}\noindent{}\hrulefill\fbox{\texttt{~#2~}}\hrulefill\vspace{#3}}
% Add an \hrule with space above and below
\newcommand\krule[2]{\vspace{#1}\hrule\vspace{#2}}
% Make hrefs easier (must load package hyperref}
\newcommand\kref[2]{\href{#1}{{\texttt{#2}}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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);
\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);
% Labels
\begin{footnotesize}
\node at (-0.5,0.5) {R1};
\node at (-0.5,1.5) {R2};
\node at (-0.5,2.5) {R3};
\node at (-0.5,3.5) {R4};
\node at (-0.5,4.5) {R5};
\node at (-0.5,5.5) {R6};
\node at (-0.5,6.5) {R7};
\node at (-0.5,7.5) {R8};
\node at (-0.5,8.5) {R9};
\node at (0.5,-0.5) {C1};
\node at (1.5,-0.5) {C2};
\node at (2.5,-0.5) {C3};
\node at (3.5,-0.5) {C4};
\node at (4.5,-0.5) {C5};
\node at (5.5,-0.5) {C6};
\node at (6.5,-0.5) {C7};
\node at (7.5,-0.5) {C8};
\node at (8.5,-0.5) {C9};
\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-0.5,#2-0.5)$) {#3};}
% Sudoku fills
\newcommand{\kfill}[3]{\draw [fill=gray#3, line width=0mm] (#1,#2) rectangle +(1,1);}
% 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);}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Include URLS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Be sure to load this package last
\usepackage[hidelinks]{hyperref} % Inlcude URLs, but load this package last
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Document Information %%%%%%%%%%%%%%%%%%%%%
%% Adjust the TITLE and SUBTITLE as necessary
\author{Kenneth John Odle}
\title{
{\Huge Sudoku} \\
\bigskip
{\footnotesize How to Play \\ How to Win \\
\bigskip
Typeset in \LaTeX{} \\
% Issue \#006
}
}
\date{\begin{small}\the\year\end{small}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Let's get it started %%%%%%%%%%%%%%%%%%%%%
\begin{document}
\maketitle
\section*{Impressum}
All contents \copyright{}2025 Kenneth John Odle
FYI, this is made in \LaTeX \,using the report document class. It then gets exported to a letterhalf (5.5 in x 8.5 in) pdf, which then gets made into a booklet using PDF Booklet, which you can find at
\kref{https://pdfbooklet.sourceforge.io/wordpress/}{https://pdfbooklet.sourceforge.io/wordpress/}
If you want to donate financial support for the creation of this zine (and all the hours of research that go into it), you can do so at
\kref{https://paypal.me/kjodle}{https://paypal.me/kjodle} (Thanks!)
\tableofcontents
\chapter{What Is Sudoku?}
\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.
\begin{wrapfigure}{O}{0.45\textwidth}
\centering
\begin{tikzpicture}[x=5mm,y=5mm]
% 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[]{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}
\end{document}