You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

61 lines
2.8 KiB

\item \self Describe the Latin Square Puzzle using propositional logic.
In the Latin Square Puzzle one has to color cells in an (n×n) grid such that there is exactly one colored cell in each row and each column. Furthermore, colored cells must not be adjacent to each other (also not diagonally). Numbers contained in certain cells of the grid indicate the exact number of colored cells that have to be adjacent (including diagonally) to it. Numbered cells can contain the numbers {0, 1, 2} and cannot be colored.
\newcounter{rowl}
\newcounter{coll}
\newcommand\setrowlsp[5]{
\setcounter{coll}{1}
\foreach \n in {#1, #2, #3, #4, #5} {
\edef\x{\value{coll} - 0.5}
\edef\y{5.5 - \value{rowl}}
\node[anchor=center] at (\x, \y) {\n};
\stepcounter{coll}
}
\stepcounter{rowl}
}
\begin{center}
\begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt},scale=.5]
\begin{scope}
\draw (0, 0) grid (5, 5);
\setcounter{rowl}{1}
\setrowlsp { }{ }{ }{2}{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{1}{ }{ }{ }
\end{scope}
\begin{scope}[xshift=8cm]
\node[fill=lightgray] at (0.5,0.5) {};
\node[fill=lightgray] at (1.5,2.5) {};
\node[fill=lightgray] at (2.5,4.5) {};
\node[fill=lightgray] at (3.5,1.5) {};
\node[fill=lightgray] at (4.5,3.5) {};
\draw (0, 0) grid (5, 5);
\setcounter{rowl}{1}
\setrowlsp { }{ }{ }{2}{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{1}{ }{ }{ }
\node[anchor=center] at (-1.5, -1) {Example Latin Square Puzzle and its solution};
\end{scope}
\end{tikzpicture}
\end{center}
Find propositional formulas which describe the puzzle and which could be used to solve it. Focus on explaining the concept of the formulas. You do not have to explicitly list all formulas and you do not have to solve the puzzle.
\emph{Hints:} Use propositional atoms $c_{i,j}$, $c_{i,j,0}$, $c_{i,j,1}$,$c_{i,j,2}$ to represent each cell of the $(n \times n)$ game board. If $c_{i,j}$ has the value \emph{True}, the cell $i,j$ is colored, otherwise it is not colored. If $c_{i,j,x}$ has the value \emph{True}, the cell $i,j$ contains the number $x$.
Express the following constraints:
\begin{enumerate}
\item There is exactly one colored cell in row $i$.
\item No colored cells are adjacent to each other.
\item No numbered cells can be colored.
\item Numbered cells are adjacent to the indicated amount of colored cells.
\end{enumerate}