SHARE
TWEET

Neunerschiebepuzzle Latex

a guest Jun 17th, 2019 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \usepackage{tikz}
  2.  
  3. % Nicht schön, aber funktioniert
  4. \newcommand{\puzzle}[9]{
  5.    \begin{tikzpicture}[scale=0.8]
  6.    \draw (0,0) rectangle (3,3);
  7.    \ifnum#1>0
  8.    \filldraw[black!30!white,draw=black] (0+.1,0+.1) rectangle (0+1-.1,0+1-.1);
  9.    \draw (\intcalcMod{0}{3}+.5,\intcalcDiv{0}{3}+.5) node{#7};
  10.    \fi
  11.    \ifnum#2>0
  12.    \filldraw[black!30!white,draw=black] (1+.1,0+.1) rectangle (1+1-.1,0+1-.1);
  13.    \draw (\intcalcMod{1}{3}+.5,\intcalcDiv{1}{3}+.5) node{#8};
  14.    \fi
  15.    \ifnum#3>0
  16.    \filldraw[black!30!white,draw=black] (2+.1,0+.1) rectangle (2+1-.1,0+1-.1);
  17.    \draw (\intcalcMod{2}{3}+.5,\intcalcDiv{2}{3}+.5) node{#9};
  18.    \fi
  19.    \ifnum#4>0
  20.    \filldraw[black!30!white,draw=black] (0+.1,1+.1) rectangle (0+1-.1,1+1-.1);
  21.    \draw (\intcalcMod{3}{3}+.5,\intcalcDiv{3}{3}+.5) node{#4};
  22.    \fi
  23.    \ifnum#5>0
  24.    \filldraw[black!30!white,draw=black] (1+.1,1+.1) rectangle (1+1-.1,1+1-.1);
  25.    \draw (\intcalcMod{4}{3}+.5,\intcalcDiv{4}{3}+.5) node{#5};
  26.    \fi
  27.    \ifnum#6>0
  28.    \filldraw[black!30!white,draw=black] (2+.1,1+.1) rectangle (2+1-.1,1+1-.1);
  29.    \draw (\intcalcMod{5}{3}+.5,\intcalcDiv{5}{3}+.5) node{#6};
  30.    \fi
  31.    \ifnum#7>0
  32.    \filldraw[black!30!white,draw=black] (0+.1,2+.1) rectangle (0+1-.1,2+1-.1);
  33.    \draw (\intcalcMod{6}{3}+.5,\intcalcDiv{6}{3}+.5) node{#1};
  34.    \fi
  35.    \ifnum#8>0
  36.    \filldraw[black!30!white,draw=black] (1+.1,2+.1) rectangle (1+1-.1,2+1-.1);
  37.    \draw (\intcalcMod{7}{3}+.5,\intcalcDiv{7}{3}+.5) node{#2};
  38.    \fi
  39.    \ifnum#9>0
  40.    \filldraw[black!30!white,draw=black] (2+.1,2+.1) rectangle (2+1-.1,2+1-.1);
  41.    \draw (\intcalcMod{8}{3}+.5,\intcalcDiv{8}{3}+.5) node{#3};
  42.    \fi
  43.    
  44.   \end{tikzpicture}
  45. }
  46.  
  47. % 1 2 3
  48. % 4 5 6
  49. % 7 8 9
  50. % In das leere Feld 0 eintragen
  51. \puzzle{1}{2}{3}{0}{4}{5}{7}{8}{6}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top