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

9 months ago
  1. \item \self Describe the Latin Square Puzzle using propositional logic.
  2. 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.
  3. \newcounter{rowl}
  4. \newcounter{coll}
  5. \newcommand\setrowlsp[5]{
  6. \setcounter{coll}{1}
  7. \foreach \n in {#1, #2, #3, #4, #5} {
  8. \edef\x{\value{coll} - 0.5}
  9. \edef\y{5.5 - \value{rowl}}
  10. \node[anchor=center] at (\x, \y) {\n};
  11. \stepcounter{coll}
  12. }
  13. \stepcounter{rowl}
  14. }
  15. \begin{center}
  16. \begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt},scale=.5]
  17. \begin{scope}
  18. \draw (0, 0) grid (5, 5);
  19. \setcounter{rowl}{1}
  20. \setrowlsp { }{ }{ }{2}{ }
  21. \setrowlsp { }{ }{ }{ }{ }
  22. \setrowlsp { }{ }{ }{ }{ }
  23. \setrowlsp { }{ }{ }{ }{ }
  24. \setrowlsp { }{1}{ }{ }{ }
  25. \end{scope}
  26. \begin{scope}[xshift=8cm]
  27. \node[fill=lightgray] at (0.5,0.5) {};
  28. \node[fill=lightgray] at (1.5,2.5) {};
  29. \node[fill=lightgray] at (2.5,4.5) {};
  30. \node[fill=lightgray] at (3.5,1.5) {};
  31. \node[fill=lightgray] at (4.5,3.5) {};
  32. \draw (0, 0) grid (5, 5);
  33. \setcounter{rowl}{1}
  34. \setrowlsp { }{ }{ }{2}{ }
  35. \setrowlsp { }{ }{ }{ }{ }
  36. \setrowlsp { }{ }{ }{ }{ }
  37. \setrowlsp { }{ }{ }{ }{ }
  38. \setrowlsp { }{1}{ }{ }{ }
  39. \node[anchor=center] at (-1.5, -1) {Example Latin Square Puzzle and its solution};
  40. \end{scope}
  41. \end{tikzpicture}
  42. \end{center}
  43. 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.
  44. \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$.
  45. Express the following constraints:
  46. \begin{enumerate}
  47. \item There is exactly one colored cell in row $i$.
  48. \item No colored cells are adjacent to each other.
  49. \item No numbered cells can be colored.
  50. \item Numbered cells are adjacent to the indicated amount of colored cells.
  51. \end{enumerate}