Added «Last Free Cell» strategy

This commit is contained in:
Kenneth John Odle 2025-04-20 15:05:18 -04:00
parent 2bb5d71b4a
commit e8b2b1fa00

View File

@ -41,7 +41,6 @@
\setlength{\belowcaptionskip}{4pt} % Adjust space between caption and figure
%\renewcommand*\contentsname{In This Issue…} % Change the name of the TOC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Document Setup%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{geometry}
@ -52,7 +51,7 @@
% a5paper % Comment out for half-letter paper
}
\addtolength{\topmargin}{10mm} % Adjust and bottom margin
\addtolength{\textheight}{-20mm} % Adjust the bottom margin
\addtolength{\textheight}{-15mm} % Adjust the bottom margin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -175,7 +174,7 @@
\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);}
\newcommand{\kfill}[3]{\draw [fill=gray#3, line width=0mm] ($(#1-1,#2-1)$) rectangle +(1,1);}
% Sudoku markers
\newcommand{\kfirst}[2]{\fill [red5] ($(#1 - 0.2,#2 - 0.2)$) circle (0.75pt);}
@ -285,5 +284,57 @@ Winning is simple: you win when you have filled in the entire 9x9 grid according
\chapter{Strategy}
There are a number of different strategies that you can employ to solve a sudoku puzzle.
\section{Last Free Cell}
This strategy is based on the rules that each 3x3 subgrid, row, and column, cannot contain duplicate numbers. Thus, if only one cell remains empty, you can use the process of elimination to figure out which one it is.
\begin{wrapfigure}[]{O}{0.5\textwidth}
\vspace{-1\baselineskip}
\centering
\begin{tikzpicture}[x=5mm,y=5mm]
\kfill{9}{9}{9}
\kfill{3}{7}{9}
\kfill{1}{1}{9}
\kgridl
\knode{1}{9}{1}
\knode{2}{9}{2}
\knode{3}{9}{3}
\knode{4}{9}{4}
\knode{5}{9}{5}
\knode{6}{9}{6}
\knode{7}{9}{7}
\knode{8}{9}{8}
\knode{1}{8}{4}
\knode{2}{8}{5}
\knode{3}{8}{6}
\knode{1}{7}{7}
\knode{2}{7}{8}
\knode{1}{6}{2}
\knode{1}{5}{3}
\knode{1}{4}{6}
\knode{1}{3}{5}
\knode{1}{2}{8}
\end{tikzpicture}
\caption[]{The ``Last Free Cell'' strategy.}
\label{lastfreecell}
\vspace{-2\baselineskip}
\end{wrapfigure}
Here we see three variations of this strategy in action, reflecting the three different ways it can be implemented: in a subgrid, in a row, and in a column. See figure \ref{lastfreecell} as a reference.
The Northwest subgrid contains the numbers 1 through 8, with only a blank cell at C3R7. Because we have already used the numbers 1 through 8, the only number that can fit here is 9.
Row 9 already contains the numbers 1 through 8, with only a blank cell at C9R9. Again, this number must be 9.
Column 1 contains the numbers 1, 4, 7, 2, 3, 6, 5,and 8. That leaves only the number 9, so it must be 9 that fits into C1R1.
This is, perhaps, the simplest of strategies, but it easy to overlook once you are solving a difficult puzzle and looking for deeper, more complex strategies. (Ask me how I know!)
\section{Last Remaining Cell}
\section{Last Possible Number}
\end{document}