%%
%% Copyright (C) 2013 by:
%% Josef Kleber
%% <josef.kleber@gmx.de>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of LaTeX version
%% 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "author-maintained".
%%
%% The Current Maintainer of this work is Josef Kleber.
%%
%% This work consists of all files listed in manifest.txt.
%%
%
\ProvidesPackage{lpenv}[2013/06/06 lpenv.sty v2.4 - Josef Kleber (C) 2013]%
%
% battleship environment and options
%
\newcommand*\LP@BS@init@prefix{LP@BS}%
\newcommand*\LP@BS@init@package{battleship}%
%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{rows}{5}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{columns}{5}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{shipcolor}{green}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{scale}{1}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{counterstyle}{none}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{bgcolor}{}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{width}{6cm}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{title}{}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{titleindent}{0.75cm}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{titlewidth}{5.15cm}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{sbindent}{0.75cm}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{sbwidth}{5.15cm}%
\LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{sbshipscale}{1}%
\LP@define@choicekey@fontsize{\LP@BS@init@prefix}{\LP@BS@init@package}{{Large}}%
%
\gdef\LP@BS@shipbox{}%
\tikzstyle{island} = [fill=yellow!30,draw, decorate, decoration={random steps,segment length=2.7pt,amplitude=1.7pt}]%
%
\newcommand*\Ship{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor] (0,0) circle (1);}%
\newcommand*\ShipC{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor] (0,0)--(0,2)--(2,2)--(2,0)--cycle;}%
\newcommand*\ShipT{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor](2,1)--(2,0)--(0,0)--(0,1) arc (180:0:1);}%
\newcommand*\ShipB{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor](2,1)--(2,2)--(0,2)--(0,1) arc (180:360:1);}%
\newcommand*\ShipL{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor](1,2)--(2,2)--(2,0)--(1,0) arc (270:90:1);}%
\newcommand*\ShipR{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor](1,2)--(0,2)--(0,0)--(1,0) arc (270:450:1);}%
\newcommand*\Island{\tikz[scale=\LP@BS@scale]\draw[scale=.36,island] (0,0) rectangle (2,2);}%
\newcommand*\Water{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill,blue!40] (1,1) circle (0.2);}%
% versions for \shipbox without second scale
\newcommand*\@Ship{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor] (0,0) circle (1);}%
\newcommand*\@ShipC{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor] (0,0)--(0,2)--(2,2)--(2,0)--cycle;}%
\newcommand*\@ShipT{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](2,1)--(2,0)--(0,0)--(0,1) arc (180:0:1);}%
\newcommand*\@ShipB{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](2,1)--(2,2)--(0,2)--(0,1) arc (180:360:1);}%
\newcommand*\@ShipL{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](1,2)--(2,2)--(2,0)--(1,0) arc (270:90:1);}%
\newcommand*\@ShipR{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](1,2)--(0,2)--(0,0)--(1,0) arc (270:450:1);}%
%
\newcommand*\LP@BS@printship[1]%
{%
  \ifthenelse{\equal{#1}{1}}{\scalebox{\LP@BS@sbshipscale}{\@Ship}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{2}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{3}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{4}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{5}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{6}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{7}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{8}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{9}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
  \ifthenelse{\equal{#1}{10}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
}%
%
\newcommand*\LP@BS@printshipbox[1]%
{% \expandafters needed because csv list is stored in macro
  \expandafter\forcsvlist\expandafter\LP@BS@printship\expandafter{#1}%
}%
%
\newcommand*\shipH[1]%
{%
  \LP@setrowcontents{#1}{1}{\value{LP@rows}}%
}%
%
\newcommand*\shipV[1]%
{%
  \LP@setcolumncontents{#1}{0}{1}%
}%
%
\newcommand*\placesegment[3]%
{%
  \LP@ingrid{#1}{#2}{\LP@BS@columns}{\LP@BS@rows}{battleship}%
  \LP@setcellcontent{#1}{#2}{#3}%
}%
%
\let\ship\placesegment%
%
\newcommand*\placeisland[2]%
{%
  \LP@ingrid{#1}{#2}{\LP@BS@columns}{\LP@BS@rows}{battleship}%
  \LP@setcellcontent{#1}{#2}{\Island}%
}%
%
\newcommand*\placewater[2]%
{%
  \LP@ingrid{#1}{#2}{\LP@BS@columns}{\LP@BS@rows}{battleship}%
  \LP@setcellcontent{#1}{#2}{\Water}%
}%
%
\newcommand*\shipbox[2][]%
{%
  \setkeys{shipbox}{#1}%
  \gdef\LP@BS@shipbox{#2}%
}%
%
\newcommand*\placeship[4]%
{%
  \setcounter{LP@counti}{#4}% length
  \ifnum\value{LP@counti}<1%
    \PackageError{battleship}%
                 {ship length < 1}%
                 {The length of your ship should be at least 1}%
  \fi%
  \ifnum\value{LP@counti}>10%
    \PackageError{battleship}%
                 {ship length > 10}%
                 {The supported max length of ships is 10!}%
  \fi%
  \ifnum\value{LP@counti}=1%
    \placesegment{#2}{#3}{\Ship}%
  \else%
    \setcounter{LP@whiledo@i}{\value{LP@counti}}%
    \addtocounter{LP@whiledo@i}{-2}% length of middle ship
    \ifthenelse{\equal{#1}{V}}%
    {%
      \placesegment{#2}{#3}{\ShipB}%
      \setcounter{LP@countii}{#3}%
      \whiledo{\value{LP@whiledo@i}>0}%
      {%
        \addtocounter{LP@whiledo@i}{-1}%
        \stepcounter{LP@countii}%
        \placesegment{#2}{\theLP@countii}{\ShipC}%
      }%
      \stepcounter{LP@countii}%
      \placesegment{#2}{\theLP@countii}{\ShipT}%
    }%
    {%
      \ifthenelse{\equal{#1}{H}}%
      {%
        \placesegment{#2}{#3}{\ShipL}%
        \setcounter{LP@counti}{#2}%
        \whiledo{\value{LP@whiledo@i}>0}%
        {%
          \addtocounter{LP@whiledo@i}{-1}%
          \stepcounter{LP@counti}%
          \placesegment{\theLP@counti}{#3}{\ShipC}%
        }%
        \stepcounter{LP@counti}%
        \placesegment{\theLP@counti}{#3}{\ShipR}%
      }%
      {\PackageError{battleship}%
                    {invalid direction (H/V)}%
                    {You can place your ship only\MessageBreak%
                     horizontally (H) or vertically (V)!}%
      }%
    }%
  \fi%
}%
%
\newcommand*\battleshipsetup[1]%
{%
  \setkeys{battleship.sty}{#1}%
}%
%
\newcommand{\classicgame}[1]%
{%
  \begin{center}%
    \begin{battleship}[rows=10,columns=10,width=6.5cm,title=Me,sbindent=0.65cm,titleindent=0.55cm,titlewidth=5.7cm,sbwidth=5.7cm,scale=0.59,fontsize=normalsize]%
      \shipV{J,I,H,G,F,E,D,C,B,A}%
      \shipH{1,2,3,4,5,6,7,8,9,10}%
      \shipbox{#1}%
    \end{battleship}%
    \hspace{1cm}%
    \begin{battleship}[rows=10,columns=10,width=6.5cm,title=Enemy,sbindent=0.65cm,titleindent=0.55cm,titlewidth=5.7cm,sbwidth=5.7cm,scale=0.59,fontsize=normalsize]%
      \shipV{J,I,H,G,F,E,D,C,B,A}%
      \shipH{1,2,3,4,5,6,7,8,9,10}%
    \end{battleship}%
  \end{center}%
  \par\vspace{1cm}%
  \begin{center}%
    \begin{battleship}[rows=10,columns=10,width=6.5cm,title=Me,sbindent=0.65cm,titleindent=0.55cm,titlewidth=5.7cm,sbwidth=5.7cm,scale=0.59,fontsize=normalsize]%
      \shipV{J,I,H,G,F,E,D,C,B,A}%
      \shipH{1,2,3,4,5,6,7,8,9,10}%
      \shipbox{#1}%
    \end{battleship}%
    \hspace{1cm}%
    \begin{battleship}[rows=10,columns=10,width=6.5cm,title=Enemy,sbindent=0.65cm,titleindent=0.55cm,titlewidth=5.7cm,sbwidth=5.7cm,scale=0.59,fontsize=normalsize]%
      \shipV{J,I,H,G,F,E,D,C,B,A}%
      \shipH{1,2,3,4,5,6,7,8,9,10}%
    \end{battleship}%
  \end{center}%
}%
%
\newenvironment{battleship}[1][]%
{%
  \setkeys{battleship}{#1}%
  \LP@set@package{battleship}%
  \LP@set@env@prefix{LP@BS}%
  \shipbox{}% clear shipbox
  \setcounter{LP@rows}{\LP@BS@rows}%
  \setcounter{LP@columns}{\LP@BS@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@BS@width}%
    \ifthenelse{\equal{\LP@BS@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@BS@titleindent}\parbox{\LP@BS@titlewidth}{\strut\LP@titleformat\LP@BS@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@BS@scale]%
      \LP@drawbackground{1}{1}{\LP@BS@columns}{\LP@BS@rows}{\LP@BS@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@BS@columns}{\LP@BS@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@BS@counterstyle}%
    \par\hbadness=10000\medskip\noindent\hspace{\LP@BS@sbindent}\begin{minipage}{\LP@BS@sbwidth}{\hbadness=10000\RaggedRight\LP@BS@printshipbox{\LP@BS@shipbox}}\end{minipage}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% bokkusu environment and options
%
\newcommand*\LP@BK@init@prefix{LP@BK}%
\newcommand*\LP@BK@init@package{bokkusu}%
%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{rows}{5}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{columns}{5}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{scale}{1}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{counterstyle}{none}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{color}{black}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{bgcolor}{}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{width}{6.7cm}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{cvoffset}{-38pt}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{title}{}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{titleindent}{0.75cm}%
\LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{titlewidth}{5.85cm}%
\LP@define@choicekey@fontsize{\LP@BK@init@prefix}{\LP@BK@init@package}{Large}%
%
\let\valueH\LP@bottomrow%
\let\valueV\LP@leftcolumn%
\let\sumH\LP@toprow%
\let\sumV\LP@rightcolumn%
%
\newcommand*\bokkususetup[1]%
{%
  \setkeys{bokkusu.sty}{#1}%
}%
%
\newenvironment{bokkusu}[1][]%
{%
  \setkeys{bokkusu}{#1}%
  \LP@set@package{bokkusu}%
  \LP@set@env@prefix{LP@BK}%
  \setcounter{LP@rows}{\LP@BK@rows}%
  \setcounter{LP@columns}{\LP@BK@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@BK@width}%
    \ifthenelse{\equal{\LP@BK@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@BK@titleindent}\parbox{\LP@BK@titlewidth}{\strut\LP@titleformat\LP@BK@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@BK@scale]%
      \LP@drawbackground{1}{1}{\LP@BK@columns}{\LP@BK@rows}{\LP@BK@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@BK@columns}{\LP@BK@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@BK@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% bridges environment and options
%
\newcommand*\LP@BG@init@prefix{LP@BG}%
\newcommand*\LP@BG@init@package{bridges}%
%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{rows}{5}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{columns}{5}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{scale}{1}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{counterstyle}{none}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{grid}{dashed}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{bgcolor}{}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{color}{green}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{width}{6.1cm}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{title}{}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{titlewidth}{6.1cm}%
\LP@define@choicekey@fontsize{\LP@BG@init@prefix}{\LP@BG@init@package}{Large}%
%
\let\bridgescell\setcell%
%
\newcommand*\bridgessetup[1]%
{%
  \setkeys{bridges.sty}{#1}%
}%
%
\newenvironment{bridges}[1][]%
{%
  \setkeys{bridges}{#1}%
  \LP@set@package{bridges}%
  \LP@set@env@prefix{LP@BG}%
  \setcounter{LP@rows}{\LP@BG@rows}%
  \setcounter{LP@columns}{\LP@BG@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@BG@width}%
    \ifthenelse{\equal{\LP@BG@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@BG@titleindent}\parbox{\LP@BG@titlewidth}{\strut\LP@titleformat\LP@BG@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@BG@scale]%
      \LP@drawbackground{1}{1}{\LP@BG@columns}{\LP@BG@rows}{\LP@BG@bgcolor}%
      \ifthenelse{\equal{\LP@BG@grid}{none}}%
      {}%
      {%
        \ifthenelse{\equal{\LP@BG@grid}{dashed}}%
        {%
          \setgridlinestyle{dashed}%
          \LP@drawgrid{1}{1}{\LP@BG@columns}{\LP@BG@rows}{1cm}%
        }%
        {%
          \LP@drawgrid{1}{1}{\LP@BG@columns}{\LP@BG@rows}{1cm}%
        }%
      }%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@BG@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% chaossudoku environment and options
%
\newcommand*\LP@CS@init@prefix{LP@CS}%
\newcommand*\LP@CS@init@package{chaossudoku}%
%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{rows}{5}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{columns}{5}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{scale}{1}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{counterstyle}{none}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{bgcolor}{}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{width}{5.1cm}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{title}{}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@CS@init@prefix}{\LP@CS@init@package}{Large}%
%
\let\chaossudokucell\setcell%
%
\newcommand*\chaossudokusetup[1]%
{%
  \setkeys{chaossudoku.sty}{#1}%
}%
%
\newenvironment{chaossudoku}[1][]%
{%
  \setkeys{chaossudoku}{#1}%
  \LP@set@package{chaossudoku}%
  \LP@set@env@prefix{LP@CS}%
  \setcounter{LP@rows}{\LP@CS@rows}%
  \setcounter{LP@columns}{\LP@CS@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@CS@width}%
    \ifthenelse{\equal{\LP@CS@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@CS@titleindent}\parbox{\LP@CS@titlewidth}{\strut\LP@titleformat\LP@CS@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@CS@scale]%
      \LP@drawbackground{1}{1}{\LP@CS@columns}{\LP@CS@rows}{\LP@CS@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@CS@columns}{\LP@CS@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@CS@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% ddsudoku environment and options
%
\newcommand*\LP@DDS@init@prefix{LP@DDS}%
\newcommand*\LP@DDS@init@package{ddsudoku}%
%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{rows}{5}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{columns}{5}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{scale}{1}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{counterstyle}{none}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{bgcolor}{}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{width}{5.1cm}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{title}{}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@DDS@init@prefix}{\LP@DDS@init@package}{Large}%
%
\let\ddsudokucell\setcell%
%
\newcommand*\ddsudokusetup[1]%
{%
  \setkeys{ddsudoku.sty}{#1}%
}%
%
\newenvironment{ddsudoku}[1][]%
{%
  \setkeys{ddsudoku}{#1}%
  \LP@set@package{ddsudoku}%
  \LP@set@env@prefix{LP@DDS}%
  \setcounter{LP@rows}{\LP@DDS@rows}%
  \setcounter{LP@columns}{\LP@DDS@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@DDS@width}%
    \ifthenelse{\equal{\LP@DDS@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@DDS@titleindent}\parbox{\LP@DDS@titlewidth}{\strut\LP@titleformat\LP@DDS@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@DDS@scale]%
      \LP@drawbackground{1}{1}{\LP@DDS@columns}{\LP@DDS@rows}{\LP@DDS@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@DDS@columns}{\LP@DDS@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@DDS@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% fourwinds environment and options
%
\newcommand*\LP@FW@init@prefix{LP@FW}%
\newcommand*\LP@FW@init@package{fourwinds}%
%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{rows}{5}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{columns}{5}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{scale}{1}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{counterstyle}{none}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{bgcolor}{}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{color}{blue}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{width}{5.1cm}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{title}{}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@FW@init@prefix}{\LP@FW@init@package}{Large}%
%
\newcommand*\fourwindscell[4]%
{%
  \LP@set@LP@fontsize{\LP@env@prefix}%
  \LP@set@LP@color{\LP@env@prefix}%
  \LP@set@LP@bgcolor{\LP@env@prefix}%
  \LP@set@LP@scale{\LP@env@prefix}%
  \ifthenelse{\equal{\LP@bgcolor}{}}%
  {\gdef\LP@c@bg@fw{white}}%
  {\gdef\LP@c@bg@fw{\LP@bgcolor}}%
  \foreach \LP@fw@dir/\LP@fw@length in {#4}%
  {%
    \begin{pgfonlayer}{LPbackgroundtwo}%
      \def\LP@rel@tikzpath{.5}%
      \draw[\LP@fw@linestyle,color=\LP@color,line width=.1cm*\LP@scale,shorten >=-3mm*\LP@scale]%
        \xtikzpath{#1}{#2}{\LP@fw@dir/\LP@fw@length};%
    \end{pgfonlayer}%
  };%
  \begin{puzzlebackground}%
    \node[fill=\LP@c@bg@fw,font=\LP@fontsize] at (#1.5,#2.5) {#3};%
  \end{puzzlebackground}%
}%
%
\newcommand*\fourwindssetup[1]%
{%
  \setkeys{fourwinds.sty}{#1}%
}%
%
\newenvironment{fourwinds}[1][]%
{%
  \setkeys{fourwinds}{#1}%
  \LP@set@package{fourwinds}%
  \LP@set@env@prefix{LP@FW}%
  \setcounter{LP@rows}{\LP@FW@rows}%
  \setcounter{LP@columns}{\LP@FW@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@FW@width}%
    \ifthenelse{\equal{\LP@FW@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@FW@titleindent}\parbox{\LP@FW@titlewidth}{\strut\LP@titleformat\LP@FW@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@FW@scale]%
      \LP@drawbackground{1}{1}{\LP@FW@columns}{\LP@FW@rows}{\LP@FW@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@FW@columns}{\LP@FW@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@FW@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% hakyuu environment and options
%
\newcommand*\LP@HY@init@prefix{LP@HY}%
\newcommand*\LP@HY@init@package{hakyuu}%
%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{rows}{5}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{columns}{5}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{scale}{1}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{counterstyle}{none}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{bgcolor}{}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{width}{5.1cm}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{title}{}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@HY@init@prefix}{\LP@HY@init@package}{Large}%
%
\let\hakyuucell\setcell%
%
\newcommand*\hakyuusetup[1]%
{%
  \setkeys{hakyuu.sty}{#1}%
}%
%
\newenvironment{hakyuu}[1][]%
{%
  \setkeys{hakyuu}{#1}%
  \LP@set@package{hakyuu}%
  \LP@set@env@prefix{LP@HY}%
  \setcounter{LP@rows}{\LP@HY@rows}%
  \setcounter{LP@columns}{\LP@HY@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@HY@width}%
    \ifthenelse{\equal{\LP@HY@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@HY@titleindent}\parbox{\LP@HY@titlewidth}{\strut\LP@titleformat\LP@HY@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@HY@scale]%
      \LP@drawbackground{1}{1}{\LP@HY@columns}{\LP@HY@rows}{\LP@HY@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@HY@columns}{\LP@HY@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@HY@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% hitori environment and options
%
\newcommand*\LP@HT@init@prefix{LP@HT}%
\newcommand*\LP@HT@init@package{hitori}%
%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{rows}{5}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{columns}{5}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{scale}{1}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{counterstyle}{none}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{bgcolor}{}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{width}{5.1cm}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{title}{}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@HT@init@prefix}{\LP@HT@init@package}{Large}%
%
\let\hitoricell\setcell%
%
\newcommand*\hitorisetup[1]%
{%
  \setkeys{hitori.sty}{#1}%
}%
%
\newenvironment{hitori}[1][]%
{%
  \setkeys{hitori}{#1}%
  \LP@set@package{hitori}%
  \LP@set@env@prefix{LP@HT}%
  \setcounter{LP@rows}{\LP@HT@rows}%
  \setcounter{LP@columns}{\LP@HT@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@HT@width}%
    \ifthenelse{\equal{\LP@HT@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@HT@titleindent}\parbox{\LP@HT@titlewidth}{\strut\LP@titleformat\LP@HT@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@HT@scale]%
      \LP@drawbackground{1}{1}{\LP@HT@columns}{\LP@HT@rows}{\LP@HT@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@HT@columns}{\LP@HT@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@HT@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% kakuro environment and options
%
\newcommand*\LP@KKR@init@prefix{LP@KKR}%
\newcommand*\LP@KKR@init@package{kakuro}%
%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{rows}{5}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{columns}{5}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{scale}{1}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{counterstyle}{none}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{bgcolor}{}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{color}{green}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{width}{5.1cm}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{title}{}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@KKR@init@prefix}{\LP@KKR@init@package}{Large}%
%
\newif\ifLP@KKR@solution\LP@KKR@solutionfalse%
%
\define@choicekey*{kakuro.sty}{solution}[\LP@KKR@solution\nr]{true,false}[true]%
{%
  \ifcase\nr\relax%
    \renewcommand*\LP@KKR@solution{true}%
    \LP@KKR@solutiontrue%
  \or%
    \renewcommand*\LP@KKR@solution{false}%
    \LP@KKR@solutionfalse%
  \fi%
}%
%
\define@choicekey*{kakuro}{solution}[\LP@KKR@solution\nr]{true,false}[true]%
{%
  \ifcase\nr\relax%
    \renewcommand*\LP@KKR@solution{true}%
    \LP@KKR@solutiontrue%
  \or%
    \renewcommand*\LP@KKR@solution{false}%
    \LP@KKR@solutionfalse%
  \fi%
}%
%
\let\kakurocell\setcell%
%
\newcommand*\kakurosetup[1]%
{%
  \setkeys{kakuro.sty}{#1}%
}%
%
\newenvironment{kakuro}[1][]%
{%
  \setkeys{kakuro}{#1}%
  \LP@set@package{kakuro}%
  \LP@set@env@prefix{LP@KKR}%
  \setcounter{LP@rows}{\LP@KKR@rows}%
  \setcounter{LP@columns}{\LP@KKR@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@KKR@width}%
    \ifthenelse{\equal{\LP@KKR@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@KKR@titleindent}\parbox{\LP@KKR@titlewidth}{\strut\LP@titleformat\LP@KKR@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@KKR@scale]%
      \LP@drawbackground{1}{1}{\LP@KKR@columns}{\LP@KKR@rows}{\LP@KKR@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@KKR@columns}{\LP@KKR@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@KKR@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% kendoku environment and options
%
\newcommand*\LP@KD@init@prefix{LP@KD}%
\newcommand*\LP@KD@init@package{kendoku}%
%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{rows}{5}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{columns}{5}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{scale}{1}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{counterstyle}{none}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{bgcolor}{}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{width}{5.1cm}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{title}{}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@KD@init@prefix}{\LP@KD@init@package}{Large}%
%
\let\kendokucell\setcell%
%
\newcommand*\kendokusetup[1]%
{%
  \setkeys{kendoku.sty}{#1}%
}%
%
\newenvironment{kendoku}[1][]%
{%
  \setkeys{kendoku}{#1}%
  \LP@set@package{kendoku}%
  \LP@set@env@prefix{LP@KD}%
  \setcounter{LP@rows}{\LP@KD@rows}%
  \setcounter{LP@columns}{\LP@KD@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@KD@width}%
    \ifthenelse{\equal{\LP@KD@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@KD@titleindent}\parbox{\LP@KD@titlewidth}{\strut\LP@titleformat\LP@KD@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@KD@scale]%
      \LP@drawbackground{1}{1}{\LP@KD@columns}{\LP@KD@rows}{\LP@KD@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@KD@columns}{\LP@KD@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@KD@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% killersudoku environment and options
%
\newcommand*\LP@KSDK@init@prefix{LP@KSDK}%
\newcommand*\LP@KSDK@init@package{killersudoku}%
%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{rows}{5}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{columns}{5}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{scale}{1}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{counterstyle}{none}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{bgcolor}{}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{width}{5.1cm}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{title}{}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{Large}%
%
\let\killersudokucell\setcell%
%
\newcommand*\killersudokusetup[1]%
{%
  \setkeys{killersudoku.sty}{#1}%
}%
%
\newenvironment{killersudoku}[1][]%
{%
  \setkeys{killersudoku}{#1}%
  \LP@set@package{killersudoku}%
  \LP@set@env@prefix{LP@KSDK}%
  \setcounter{LP@rows}{\LP@KSDK@rows}%
  \setcounter{LP@columns}{\LP@KSDK@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@KSDK@width}%
    \ifthenelse{\equal{\LP@KSDK@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@KSDK@titleindent}\parbox{\LP@KSDK@titlewidth}{\strut\LP@titleformat\LP@KSDK@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@KSDK@scale]%
      \LP@drawbackground{1}{1}{\LP@KSDK@columns}{\LP@KSDK@rows}{\LP@KSDK@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@KSDK@columns}{\LP@KSDK@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@KSDK@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% laserbeam environment and options
%
\newcommand*\LP@LB@init@prefix{LP@LB}%
\newcommand*\LP@LB@init@package{laserbeam}%
%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{rows}{5}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{columns}{5}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{scale}{1}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{counterstyle}{none}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{bgcolor}{}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{width}{6.5cm}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{cvoffset}{-38pt}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{title}{}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{titlewidth}{6.5cm}%
\LP@define@choicekey@fontsize{\LP@LB@init@prefix}{\LP@LB@init@package}{Large}%
%
\let\laserH\LP@toprow%
\let\laserV\LP@leftcolumn%
\let\mirrorH\LP@bottomrow@edge%
\let\mirrorV\LP@rightcolumn@edge%
%
\newcommand*\laser[2][red]%
{%
  % avoid little laser peaks outside grid
  \clip (1,1) rectangle (\arabic{LP@columns},\arabic{LP@rows});%
  \framearea{#1}{#2}%
}%
%
\newcommand*\laserbeamsetup[1]%
{%
  \setkeys{laserbeam.sty}{#1}%
}%
%
\newenvironment{laserbeam}[1][]%
{%
  \setkeys{laserbeam}{#1}%
  \LP@set@package{laserbeam}%
  \LP@set@env@prefix{LP@LB}%
  \setcounter{LP@rows}{\LP@LB@rows}%
  \setcounter{LP@columns}{\LP@LB@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@LB@width}%
    \ifthenelse{\equal{\LP@LB@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@LB@titleindent}\parbox{\LP@LB@titlewidth}{\strut\LP@titleformat\LP@LB@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@LB@scale]%
      \LP@drawbackground{1}{1}{\LP@LB@columns}{\LP@LB@rows}{\LP@LB@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@LB@columns}{\LP@LB@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@LB@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% lpsudoku environment and options
%
\newcommand*\LP@SDK@init@prefix{LP@SDK}%
\newcommand*\LP@SDK@init@package{lpsudoku}%
%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{rows}{9}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{columns}{9}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{scale}{1}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{bgcolor}{}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{width}{9.1cm}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{title}{}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{titlewidth}{9.1cm}%
\LP@define@choicekey@fontsize{\LP@SDK@init@prefix}{\LP@SDK@init@package}{Large}%
%
\let\lpsudokucell\setcell%
%
\newcommand*\lpsudokusetup[1]%
{%
  \setkeys{lpsudoku.sty}{#1}%
}%
%
\newenvironment{lpsudoku}[1][]%
{%
  \setkeys{lpsudoku}{#1}%
  \LP@set@package{lpsudoku}%
  \LP@set@env@prefix{LP@SDK}%
  \setcounter{LP@rows}{\LP@SDK@rows}%
  \setcounter{LP@columns}{\LP@SDK@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SDK@width}%
    \ifthenelse{\equal{\LP@SDK@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SDK@titleindent}\parbox{\LP@SDK@titlewidth}{\strut\LP@titleformat\LP@SDK@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SDK@scale]%
      \LP@drawbackground{1}{1}{\LP@SDK@columns}{\LP@SDK@rows}{\LP@SDK@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SDK@columns}{\LP@SDK@rows}{1cm}%
      \LP@drawsudokugrid%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% magiclabyrinth environment and options
%
\newcommand*\LP@ML@init@prefix{LP@ML}%
\newcommand*\LP@ML@init@package{magiclabyrinth}%
%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{rows}{5}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{columns}{5}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{scale}{1}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{counterstyle}{none}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{bgcolor}{}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{width}{5.1cm}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{title}{}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@ML@init@prefix}{\LP@ML@init@package}{Large}%
%
\let\magiclabyrinthcell\setcell%
%
\newcommand*\magiclabyrinthsetup[1]%
{%
  \setkeys{magiclabyrinth.sty}{#1}%
}%
%
\newenvironment{magiclabyrinth}[1][]%
{%
  \setkeys{magiclabyrinth}{#1}%
  \LP@set@package{magiclabyrinth}%
  \LP@set@env@prefix{LP@ML}%
  \setcounter{LP@rows}{\LP@ML@rows}%
  \setcounter{LP@columns}{\LP@ML@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@ML@width}%
    \ifthenelse{\equal{\LP@ML@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@ML@titleindent}\parbox{\LP@ML@titlewidth}{\strut\LP@titleformat\LP@ML@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@ML@scale]%
      \LP@drawbackground{1}{1}{\LP@ML@columns}{\LP@ML@rows}{\LP@ML@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@ML@columns}{\LP@ML@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@ML@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% magnets environment and options
%
\newcommand*\LP@MN@init@prefix{LP@MN}%
\newcommand*\LP@MN@init@package{magnets}%
%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{rows}{6}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{columns}{6}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{scale}{1}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{counterstyle}{none}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{bgcolor}{}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{width}{8.1cm}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{title}{}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{titlewidth}{8.1cm}%
\LP@define@choicekey@fontsize{\LP@MN@init@prefix}{\LP@MN@init@package}{Large}%
%
\let\magnetscell\setcell%
%
\let\minusH\LP@toprow%
\let\minusV\LP@leftcolumn%
%
\newcommand*\plusV[1]%
{%
  \LP@set@LP@fontsize{\LP@env@prefix}%
  \setcounter{LP@counti}{1}%
  \foreach \LP@element in{#1}%
  {%
    \node at (-0.5,\arabic{LP@counti}\LP@Pfive){\LP@fontsize\LP@element};%
    \stepcounter{LP@counti}%
  };%
}%
%
\newcommand*\plusH[1]%
{%
  \LP@set@LP@fontsize{\LP@env@prefix}%
  \LP@set@LP@rows{\LP@env@prefix}%
  \setcounter{LP@counti}{1}%
  \setcounter{LP@countii}{\LP@rows}%
  \addtocounter{LP@countii}{2}%
  \foreach \LP@element in{#1}%
  {%
    \node at (\arabic{LP@counti}\LP@Pfive,\arabic{LP@countii}\LP@Pfive){\LP@fontsize\LP@element};%
    \stepcounter{LP@counti}%
  };%
}%
%
\newcommand*\magnetssetup[1]%
{%
  \setkeys{magnets.sty}{#1}%
}%
%
\newenvironment{magnets}[1][]%
{%
  \setkeys{magnets}{#1}%
  \LP@set@package{magnets}%
  \LP@set@env@prefix{LP@MN}%
  \setcounter{LP@rows}{\LP@MN@rows}%
  \setcounter{LP@columns}{\LP@MN@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@MN@width}%
    \ifthenelse{\equal{\LP@MN@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@MN@titleindent}\parbox{\LP@MN@titlewidth}{\strut\LP@titleformat\LP@MN@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@MN@scale]%
      \LP@drawbackground{1}{1}{\LP@MN@columns}{\LP@MN@rows}{\LP@MN@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@MN@columns}{\LP@MN@rows}{1cm}%
      \LP@magnetsgrid%
      \framepuzzle%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@MN@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% masyu environment and options
%
\newcommand*\LP@MY@init@prefix{LP@MY}%
\newcommand*\LP@MY@init@package{masyu}%
%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{rows}{5}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{columns}{5}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{scale}{1}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{counterstyle}{none}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{color}{green}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{bgcolor}{}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{width}{5.1cm}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{title}{}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@MY@init@prefix}{\LP@MY@init@package}{Large}%
%
\let\masyucell\setcell%
%
\newcommand*\masyusetup[1]%
{%
  \setkeys{masyu.sty}{#1}%
}%
%
\newenvironment{masyu}[1][]%
{%
  \setkeys{masyu}{#1}%
  \LP@set@package{masyu}%
  \LP@set@env@prefix{LP@MY}%
  \setcounter{LP@rows}{\LP@MY@rows}%
  \setcounter{LP@columns}{\LP@MY@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@MY@width}%
    \ifthenelse{\equal{\LP@MY@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@MY@titleindent}\parbox{\LP@MY@titlewidth}{\strut\LP@titleformat\LP@MY@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@MY@scale]%
      \LP@drawbackground{1}{1}{\LP@MY@columns}{\LP@MY@rows}{\LP@MY@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@MY@columns}{\LP@MY@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@MY@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% minesweeper environment and options
%
\newcommand*\LP@MS@init@prefix{LP@MS}%
\newcommand*\LP@MS@init@package{minesweeper}%
%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{rows}{5}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{columns}{5}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{scale}{1}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{counterstyle}{none}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{bgcolor}{}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{width}{5.1cm}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{title}{}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@MS@init@prefix}{\LP@MS@init@package}{Large}%
%
\let\minesweepercell\setcell%
%
\newcommand*\minesweepersetup[1]%
{%
  \setkeys{minesweeper.sty}{#1}%
}%
%
\newenvironment{minesweeper}[1][]%
{%
  \setkeys{minesweeper}{#1}%
  \LP@set@package{minesweeper}%
  \LP@set@env@prefix{LP@MS}%
  \setcounter{LP@rows}{\LP@MS@rows}%
  \setcounter{LP@columns}{\LP@MS@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@MS@width}%
    \ifthenelse{\equal{\LP@MS@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@MS@titleindent}\parbox{\LP@MS@titlewidth}{\strut\LP@titleformat\LP@MS@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@MS@scale]%
      \LP@drawbackground{1}{1}{\LP@MS@columns}{\LP@MS@rows}{\LP@MS@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@MS@columns}{\LP@MS@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@MS@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% numberlink environment and options
%
\newcommand*\LP@NL@init@prefix{LP@NL}%
\newcommand*\LP@NL@init@package{numberlink}%
%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{rows}{5}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{columns}{5}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{scale}{1}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{counterstyle}{none}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{bgcolor}{}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{color}{red}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{width}{5.1cm}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{title}{}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@NL@init@prefix}{\LP@NL@init@package}{Large}%
%
\newcommand*\numberlinkcell[3]%
{%
  \fourwindscell{#1}{#2}{#3}{}%
}%
%
%
\newcommand*\numberlinksetup[1]%
{%
  \setkeys{numberlink.sty}{#1}%
}%
%
\newenvironment{numberlink}[1][]%
{%
  \setkeys{numberlink}{#1}%
  \LP@set@package{numberlink}%
  \LP@set@env@prefix{LP@NL}%
  \setcounter{LP@rows}{\LP@NL@rows}%
  \setcounter{LP@columns}{\LP@NL@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@NL@width}%
    \ifthenelse{\equal{\LP@NL@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@NL@titleindent}\parbox{\LP@NL@titlewidth}{\strut\LP@titleformat\LP@NL@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@NL@scale]%
      \LP@drawbackground{1}{1}{\LP@NL@columns}{\LP@NL@rows}{\LP@NL@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@NL@columns}{\LP@NL@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@NL@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% resuko environment and options
%
\newcommand*\LP@RSK@init@prefix{LP@RSK}%
\newcommand*\LP@RSK@init@package{resuko}%
%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{rows}{5}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{columns}{5}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{scale}{1}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{counterstyle}{none}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{bgcolor}{}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{color}{blue}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{width}{5.1cm}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{title}{}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@RSK@init@prefix}{\LP@RSK@init@package}{Large}%
%
\let\resukocell\setcell%
%
\newcommand*\resukosetup[1]%
{%
  \setkeys{resuko.sty}{#1}%
}%
%
\newenvironment{resuko}[1][]%
{%
  \setkeys{resuko}{#1}%
  \LP@set@package{resuko}%
  \LP@set@env@prefix{LP@RSK}%
  \setcounter{LP@rows}{\LP@RSK@rows}%
  \setcounter{LP@columns}{\LP@RSK@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@RSK@width}%
    \ifthenelse{\equal{\LP@RSK@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@RSK@titleindent}\parbox{\LP@RSK@titlewidth}{\strut\LP@titleformat\LP@RSK@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@RSK@scale]%
      \LP@drawbackground{1}{1}{\LP@RSK@columns}{\LP@RSK@rows}{\LP@RSK@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@RSK@columns}{\LP@RSK@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@RSK@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% schatzsuche environment and options
%
\newcommand*\LP@SS@init@prefix{LP@SS}%
\newcommand*\LP@SS@init@package{schatzsuche}%
%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{rows}{5}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{columns}{5}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{scale}{1}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{bgcolor}{}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{width}{5.1cm}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{title}{}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@SS@init@prefix}{\LP@SS@init@package}{Large}%
%
\let\schatzsuchecell\setcell%
%
\newcommand*\schatzsuchesetup[1]%
{%
  \setkeys{schatzsuche.sty}{#1}%
}%
%
\newenvironment{schatzsuche}[1][]%
{%
  \setkeys{schatzsuche}{#1}%
  \LP@set@package{schatzsuche}%
  \LP@set@env@prefix{LP@SS}%
  \setcounter{LP@rows}{\LP@SS@rows}%
  \setcounter{LP@columns}{\LP@SS@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SS@width}%
    \ifthenelse{\equal{\LP@SS@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SS@titleindent}\parbox{\LP@SS@titlewidth}{\strut\LP@titleformat\LP@SS@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SS@scale]%
      \LP@drawbackground{1}{1}{\LP@SS@columns}{\LP@SS@rows}{\LP@SS@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SS@columns}{\LP@SS@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SS@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% skyline environment and options
%
\newcommand*\LP@SL@init@prefix{LP@SL}%
\newcommand*\LP@SL@init@package{skyline}%
%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{rows}{5}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{columns}{5}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{scale}{1}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{bgcolor}{}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{width}{6.7cm}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{cvoffset}{-38pt}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{title}{}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{titleindent}{0.75cm}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{titlewidth}{5.85cm}%
\LP@define@choicekey@fontsize{\LP@SL@init@prefix}{\LP@SL@init@package}{Large}%
%
\newcommand*\LP@SL@sudoku{false}%
%
\define@choicekey*{skyline.sty}{sudoku}[\LP@SL@sudoku\nr]{true,false}[true]%
{%
  \ifcase\nr\relax%
    \renewcommand*\LP@SL@sudoku{true}%
    \renewcommand*\LP@SL@rows{9}%
    \renewcommand*\LP@SL@columns{9}%
  \or%
    \renewcommand*\LP@SL@sudoku{false}%
  \fi%
}%
%
\define@choicekey*{skyline}{sudoku}[\LP@SL@sudoku\nr]{true,false}[true]%
{%
  \ifcase\nr\relax%
    \renewcommand*\LP@SL@sudoku{true}%
    \renewcommand*\LP@SL@rows{9}%
    \renewcommand*\LP@SL@columns{9}%
  \or%
    \renewcommand*\LP@SL@sudoku{false}%
  \fi%
}%
%
\let\skylineB\LP@bottomrow%
\let\skylineT\LP@toprow%
\let\skylineL\LP@leftcolumn%
\let\skylineR\LP@rightcolumn%
\let\skylinecell\setcell%
%
\newcommand*\skylinesetup[1]%
{%
  \setkeys{skyline.sty}{#1}%
}%
%
\newenvironment{skyline}[1][]%
{%
  \setkeys{skyline}{#1}%
  \LP@set@package{skyline}%
  \LP@set@env@prefix{LP@SL}%
  \setcounter{LP@rows}{\LP@SL@rows}%
  \setcounter{LP@columns}{\LP@SL@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SL@width}%
    \ifthenelse{\equal{\LP@SL@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SL@titleindent}\parbox{\LP@SL@titlewidth}{\strut\LP@titleformat\LP@SL@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SL@scale]%
      \LP@drawbackground{1}{1}{\LP@SL@columns}{\LP@SL@rows}{\LP@SL@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SL@columns}{\LP@SL@rows}{1cm}%
      \ifthenelse{\equal{\LP@SL@sudoku}{true}}%
      {\LP@drawsudokugrid}%
      {}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SL@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% slitherlink environment and options
%
\newcommand*\LP@SK@init@prefix{LP@SK}%
\newcommand*\LP@SK@init@package{slitherlink}%
%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{rows}{5}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{columns}{5}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{scale}{1}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{bgcolor}{}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{width}{5.2cm}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{title}{}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{titlewidth}{5.2cm}%
\LP@define@choicekey@fontsize{\LP@SK@init@prefix}{\LP@SK@init@package}{Large}%
%
\let\slitherlinkcell\setcell%
%
\newcommand*\slitherlinksetup[1]%
{%
  \setkeys{slitherlink.sty}{#1}%
}%
%
\newenvironment{slitherlink}[1][]%
{%
  \setkeys{slitherlink}{#1}%
  \LP@set@package{slitherlink}%
  \LP@set@env@prefix{LP@SK}%
  \ifthenelse{\equal{\LP@grid@linestyle}{}}%
    {\setgridlinestyle{dashed}}{}%
  \setcounter{LP@rows}{\LP@SK@rows}%
  \setcounter{LP@columns}{\LP@SK@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SK@width}%
    \ifthenelse{\equal{\LP@SK@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SK@titleindent}\parbox{\LP@SK@titlewidth}{\strut\LP@titleformat\LP@SK@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SK@scale]%
      \LP@drawbackground{1}{1}{\LP@SK@columns}{\LP@SK@rows}{\LP@SK@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SK@columns}{\LP@SK@rows}{1cm}%
      \LP@drawgriddots%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SK@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% starbattle environment and options
%
\newcommand*\LP@SB@init@prefix{LP@SB}%
\newcommand*\LP@SB@init@package{starbattle}%
%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{rows}{5}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{columns}{5}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{scale}{1}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{bgcolor}{}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{width}{5.1cm}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{title}{}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@SB@init@prefix}{\LP@SB@init@package}{Large}%
%
\let\starbattlecell\setcell%
%
\newcommand*\starbattlesetup[1]%
{%
  \setkeys{starbattle.sty}{#1}%
}%
%
\newenvironment{starbattle}[1][]%
{%
  \setkeys{starbattle}{#1}%
  \LP@set@package{starbattle}%
  \LP@set@env@prefix{LP@SB}%
  \setcounter{LP@rows}{\LP@SB@rows}%
  \setcounter{LP@columns}{\LP@SB@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SB@width}%
    \ifthenelse{\equal{\LP@SB@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SB@titleindent}\parbox{\LP@SB@titlewidth}{\strut\LP@titleformat\LP@SB@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SB@scale]%
      \LP@drawbackground{1}{1}{\LP@SB@columns}{\LP@SB@rows}{\LP@SB@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SB@columns}{\LP@SB@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SB@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% starsandarrows environment and options
%
\newcommand*\LP@SAA@init@prefix{LP@SAA}%
\newcommand*\LP@SAA@init@package{starsandarrows}%
%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{rows}{5}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{columns}{5}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{scale}{1}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{bgcolor}{}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{width}{5.9cm}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{title}{}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{titlewidth}{5.9cm}%
\LP@define@choicekey@fontsize{\LP@SAA@init@prefix}{\LP@SAA@init@package}{Large}%
%
\let\starsH\LP@toprow%
\let\starsV\LP@leftcolumn%
%
\newcommand*\starsandarrowssetup[1]%
{%
  \setkeys{starsandarrows.sty}{#1}%
}%
%
\newenvironment{starsandarrows}[1][]%
{%
  \setkeys{starsandarrows}{#1}%
  \LP@set@package{starsandarrows}%
  \LP@set@env@prefix{LP@SAA}%
  \setcounter{LP@rows}{\LP@SAA@rows}%
  \setcounter{LP@columns}{\LP@SAA@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SAA@width}%
    \ifthenelse{\equal{\LP@SAA@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SAA@titleindent}\parbox{\LP@SAA@titlewidth}{\strut\LP@titleformat\LP@SAA@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SAA@scale]%
      \LP@drawbackground{1}{1}{\LP@SAA@columns}{\LP@SAA@rows}{\LP@SAA@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SAA@columns}{\LP@SAA@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SAA@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% sunandmoon environment and options
%
\newcommand*\LP@SAM@init@prefix{LP@SAM}%
\newcommand*\LP@SAM@init@package{sunandmoon}%
%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{rows}{5}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{columns}{5}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{scale}{1}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{bgcolor}{}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{width}{5.1cm}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{title}{}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{titlewidth}{5.1cm}%
\LP@define@choicekey@fontsize{\LP@SAM@init@prefix}{\LP@SAM@init@package}{Large}%
%
\let\sunandmooncell\setcell%
%
\newcommand*\sunandmoonsetup[1]%
{%
  \setkeys{sunandmoon.sty}{#1}%
}%
%
\newenvironment{sunandmoon}[1][]%
{%
  \setkeys{sunandmoon}{#1}%
  \LP@set@package{sunandmoon}%
  \LP@set@env@prefix{LP@SAM}%
  \setcounter{LP@rows}{\LP@SAM@rows}%
  \setcounter{LP@columns}{\LP@SAM@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@SAM@width}%
    \ifthenelse{\equal{\LP@SAM@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SAM@titleindent}\parbox{\LP@SAM@titlewidth}{\strut\LP@titleformat\LP@SAM@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SAM@scale]%
      \LP@drawbackground{1}{1}{\LP@SAM@columns}{\LP@SAM@rows}{\LP@SAM@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SAM@columns}{\LP@SAM@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SAM@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% tentsandtrees environment and options
%
\newcommand*\LP@TAT@init@prefix{LP@TAT}%
\newcommand*\LP@TAT@init@package{tentsandtrees}%
%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{rows}{5}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{columns}{5}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{scale}{1}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{counterstyle}{none}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{bgcolor}{}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{width}{5.9cm}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{title}{}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{titlewidth}{5.9cm}%
\LP@define@choicekey@fontsize{\LP@TAT@init@prefix}{\LP@TAT@init@package}{Large}%
%
\let\tentH\LP@toprow%
\let\tentV\LP@leftcolumn%
%
\newcommand*\tentsandtreessetup[1]%
{%
  \setkeys{tentsandtrees.sty}{#1}%
}%
%
\newenvironment{tentsandtrees}[1][]%
{%
  \setkeys{tentsandtrees}{#1}%
  \LP@set@package{tentsandtrees}%
  \LP@set@env@prefix{LP@TAT}%
  \setcounter{LP@rows}{\LP@TAT@rows}%
  \setcounter{LP@columns}{\LP@TAT@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@TAT@width}%
    \ifthenelse{\equal{\LP@TAT@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@TAT@titleindent}\parbox{\LP@TAT@titlewidth}{\strut\LP@titleformat\LP@TAT@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@TAT@scale]%
      \LP@drawbackground{1}{1}{\LP@TAT@columns}{\LP@TAT@rows}{\LP@TAT@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@TAT@columns}{\LP@TAT@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@TAT@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
% tunnel environment and options
%
\newcommand*\LP@TN@init@prefix{LP@TN}%
\newcommand*\LP@TN@init@package{tunnel}%
%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{rows}{5}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{columns}{5}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{scale}{1}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{counterstyle}{none}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{bgcolor}{}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{width}{5.9cm}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{cvoffset}{-23pt}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{title}{}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{titleindent}{0cm}%
\LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{titlewidth}{5.9cm}%
\LP@define@choicekey@fontsize{\LP@TN@init@prefix}{\LP@TN@init@package}{Large}%
%
\let\tunnelH\LP@toprow%
\let\tunnelV\LP@leftcolumn%
%
\newcommand*\tunnelsetup[1]%
{%
  \setkeys{tunnel.sty}{#1}%
}%
%
\newenvironment{tunnel}[1][]%
{%
  \setkeys{tunnel}{#1}%
  \LP@set@package{tunnel}%
  \LP@set@env@prefix{LP@TN}%
  \setcounter{LP@rows}{\LP@TN@rows}%
  \setcounter{LP@columns}{\LP@TN@columns}%
  \stepcounter{LP@rows}%
  \stepcounter{LP@columns}%
  \begin{minipage}[t]{\LP@TN@width}%
    \ifthenelse{\equal{\LP@TN@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@TN@titleindent}\parbox{\LP@TN@titlewidth}{\strut\LP@titleformat\LP@TN@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@TN@scale]%
      \LP@drawbackground{1}{1}{\LP@TN@columns}{\LP@TN@rows}{\LP@TN@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@TN@columns}{\LP@TN@rows}{1cm}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@TN@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
\endinput%