diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-23 22:23:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-23 22:23:48 +0000 |
commit | ae7524f53f8c6f75067ee684e1566d1cee110b6b (patch) | |
tree | cd01837fc675bc22a270b7e0d5f54613b0963603 /Master/texmf-dist/tex/latex/logicpuzzle | |
parent | f6cdffa509c8082653ba4c7946ae899e368a0333 (diff) |
logicpuzzle (21apr13)
git-svn-id: svn://tug.org/texlive/trunk@30087 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/logicpuzzle')
3 files changed, 362 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/laserbeam.sty b/Master/texmf-dist/tex/latex/logicpuzzle/laserbeam.sty new file mode 100644 index 00000000000..9053cabca72 --- /dev/null +++ b/Master/texmf-dist/tex/latex/logicpuzzle/laserbeam.sty @@ -0,0 +1,89 @@ +%% +%% 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{laserbeam}[2013/04/20 laserbeam.sty v1.0 - Josef Kleber (C) 2013]% +% +\RequirePackage{logicpuzzle}% +% +\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}% +% +\ExecuteOptionsX{rows,columns,width,fontsize,scale,bgcolor,cvoffset,counterstyle,title,titleindent,titlewidth}% +% +\ProcessOptionsX\relax% +% +\LP@init@counter{\LP@LB@init@prefix}% +% +\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@LB@columns},\arabic{LP@LB@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@LB@rows}{\LP@LB@rows}% + \setcounter{LP@LB@columns}{\LP@LB@columns}% + \stepcounter{LP@LB@rows}% + \stepcounter{LP@LB@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}% +}% +% +\endinput%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty b/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty index 3dcb1fa9c1e..f431d57fd15 100644 --- a/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty +++ b/Master/texmf-dist/tex/latex/logicpuzzle/logicpuzzle.sty @@ -19,7 +19,7 @@ %% %% This work consists of all files listed in manifest.txt. %% -\ProvidesPackage{logicpuzzle}[2013/04/12 logicpuzzle.sty v1.8 - Josef Kleber (C) 2013]% +\ProvidesPackage{logicpuzzle}[2013/04/20 logicpuzzle.sty v1.9 - Josef Kleber (C) 2013]% % \RequirePackage{xkeyval}% \RequirePackage{ifthen}% @@ -27,7 +27,7 @@ \RequirePackage{etoolbox}% \RequirePackage{marginnote}% \RequirePackage{tikz}% -\usetikzlibrary{decorations.pathmorphing}% +\usetikzlibrary{decorations.pathmorphing,calc}% \pgfdeclarelayer{LPdump}% \pgfdeclarelayer{LPbgcolor}% \pgfdeclarelayer{LPbackgroundtwo}% @@ -60,6 +60,10 @@ \gdef\LP@fontsize\Large% \gdef\LP@cvoffset{0pt}% % +\def\LP@normallines{0.5pt}% +\def\LP@thicklines{1.5pt}% +\def\LP@grid@linestyle{}% +% \newcommand*\LP@Pfive{.5}% % % init @@ -166,6 +170,9 @@ \LP@definecolor{LP@c@vii}{.53,.808,.98}% \LP@definecolor{LP@c@viii}{.196,.804,.196}% \LP@definecolor{LP@c@ix}{1,.96,.932}% +\LP@definecolor{LP@c@griddots}{.25,.51,.33}% +\LP@definecolor{LP@c@cross}{.25,.51,.33}% +\LP@definecolor{LP@c@mirror}{.8,.8,.8}% % % drawing grids % @@ -180,19 +187,33 @@ \setcounter{LP@countii}{#4}% max row \stepcounter{LP@counti}% \stepcounter{LP@countii}% - \draw[step=#5] (#1,#2) grid (\value{LP@counti},\value{LP@countii});% + \draw[step=#5,line width=\LP@normallines,\LP@grid@linestyle] (#1,#2) grid (\value{LP@counti},\value{LP@countii});% }% % +\newcommand*\LP@drawgriddots% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \pgfmathsetmacro{\START}{1}% + % dots are drawn immediatly after the grid, + % so we can recycle LP@counti and LP@countii + \pgfmathsetmacro{\ENDC}{\arabic{LP@counti}}% + \pgfmathsetmacro{\ENDR}{\arabic{LP@countii}}% + \begin{pgfonlayer}{LPforeground}% + \foreach \i in {\START,...,\ENDC}% + \foreach \j in {\START,...,\ENDR}% + \fill[color=LP@c@griddots] (\i,\j) circle [radius=3pt];% + \end{pgfonlayer}% +}% \newcommand*\LP@drawsudokugrid% {% - \draw[ultra thick] (1,1) -- (1,10);% - \draw[ultra thick] (4,1) -- (4,10);% - \draw[ultra thick] (7,1) -- (7,10);% - \draw[ultra thick] (10,1) -- (10,10);% - \draw[ultra thick] (1,1) -- (10,1);% - \draw[ultra thick] (1,4) -- (10,4);% - \draw[ultra thick] (1,7) -- (10,7);% - \draw[ultra thick] (1,10) -- (10,10);% + \draw[line width=\LP@thicklines] (1,1) -- (1,10);% + \draw[line width=\LP@thicklines] (4,1) -- (4,10);% + \draw[line width=\LP@thicklines] (7,1) -- (7,10);% + \draw[line width=\LP@thicklines] (10,1) -- (10,10);% + \draw[line width=\LP@thicklines] (1,1) -- (10,1);% + \draw[line width=\LP@thicklines] (1,4) -- (10,4);% + \draw[line width=\LP@thicklines] (1,7) -- (10,7);% + \draw[line width=\LP@thicklines] (1,10) -- (10,10);% }% % % drawing grid background @@ -212,7 +233,7 @@ \stepcounter{LP@counti}% \stepcounter{LP@countii}% \begin{pgfonlayer}{LPbgcolor}% - \draw[fill=#5] (#1,#2) rectangle (\value{LP@counti},\value{LP@countii});% + \fill[color=#5] (#1,#2) rectangle (\value{LP@counti},\value{LP@countii});% \end{pgfonlayer}{LPbgcolor}% }% }% @@ -271,6 +292,24 @@ \node at (#1\LP@Pfive,#2\LP@Pfive){#3};% }% % +% #1 column +% #2 row +% #3 content +\newcommand*\LP@setcellcontentC[3]% +{% + \node at (#1,#2){#3};% +}% +% +\newcommand*\LP@setcellcontentVE[3]% +{% + \node at (#1,#2\LP@Pfive){#3};% +}% +% +\newcommand*\LP@setcellcontentHE[3]% +{% + \node at (#1\LP@Pfive,#2){#3};% +}% +% % #1 csv list % #2 column % #3 row @@ -292,6 +331,24 @@ \stepcounter{LP@counti}% }% % +\newcommand*\LP@setrowcontents@edge[3]% +{% + \setcounter{LP@counti}{#2}% + \setcounter{LP@countii}{#3}% + \forcsvlist\LP@setrowcontents@edge@i{#1}{\LP@env@prefix}% +}% +% +\newcommand*\LP@setrowcontents@edge@i[1]% +{% + \LP@setrowcontents@edge@ii{#1}{\LP@env@prefix}% +}% +% +\newcommand*\LP@setrowcontents@edge@ii[2]% +{% + \LP@setcellcontentVE{\arabic{LP@counti}}{\arabic{LP@countii}}{\csname #2@fontsize\endcsname#1}% + \stepcounter{LP@counti}% +}% +% \newcommand*\setrow[2]% {% \LP@setrowcontents{#2}{1}{#1}% @@ -318,6 +375,24 @@ \stepcounter{LP@countii}% }% % +\newcommand*\LP@setcolumncontents@edge[3]% +{% + \setcounter{LP@counti}{#2}% + \setcounter{LP@countii}{#3}% + \forcsvlist\LP@setcolumncontents@edge@i{#1}% +}% +% +\newcommand*\LP@setcolumncontents@edge@i[1]% +{% + \LP@setcolumncontents@edge@ii{#1}{\LP@env@prefix}% +}% +% +\newcommand*\LP@setcolumncontents@edge@ii[2]% +{% + \LP@setcellcontentHE{\arabic{LP@counti}}{\arabic{LP@countii}}{\csname #2@fontsize\endcsname#1}% + \stepcounter{LP@countii}% +}% +% \newcommand*\setcolumn[2]% {% \LP@setcolumncontents{#2}{#1}{1}% @@ -333,6 +408,24 @@ \LP@setcellcontent{#1}{#2}{\LP@fontsize#3}% }% % +\newcommand*\setbigcell[4][Huge]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \LP@set@LP@bgcolor{\LP@env@prefix}% + \ifthenelse{\equal{\LP@bgcolor}{}}% + {\gdef\LP@sbc@bgcolor{white}}% + {\gdef\LP@sbc@bgcolor{\LP@bgcolor}}% + \setcounter{LP@counti}{#2}% + \setcounter{LP@countii}{#3}% + \stepcounter{LP@counti}% + \stepcounter{LP@countii}% + \draw[line width=\LP@normallines,fill=\LP@sbc@bgcolor,\LP@grid@linestyle] (#2,#3) rectangle ++(2,2);% + \begin{pgfonlayer}{LPforegroundtwo}% + \fill[color=\LP@sbc@bgcolor] (\arabic{LP@counti},\arabic{LP@countii}) circle [radius=3.5pt*\LP@scale];% + \node at (\arabic{LP@counti},\arabic{LP@countii}){\csname#1\endcsname#4};% + \end{pgfonlayer}% +}% +% \newcommand*\setcolorrow[2]% {% \setcounter{LP@counti}{1}% @@ -431,12 +524,12 @@ % \newcommand*\framearea[2]% {% - \draw[ultra thick,color=#1] #2;% + \draw[line width=\LP@thicklines,color=#1] #2;% }% % \newcommand*\fillarea[2]% {% - \draw[ultra thick,fill=#1] #2 ;% + \draw[line width=\LP@thicklines,fill=#1] #2 ;% }% % \newcommand*\colorarea[2]% @@ -516,12 +609,26 @@ \setcounter{LP@countii}{\LP@rows}% \stepcounter{LP@counti}% \stepcounter{LP@countii}% - \draw[ultra thick,color=#1] (1,1)--(1,\arabic{LP@countii});% - \draw[ultra thick,color=#1] (1,\arabic{LP@countii})--(\arabic{LP@countii},\arabic{LP@countii});% - \draw[ultra thick,color=#1] (\arabic{LP@countii},\arabic{LP@countii})--(\arabic{LP@countii},1);% - \draw[ultra thick,color=#1] (\arabic{LP@countii},1)--(1,1);% + \draw[line width=\LP@thicklines,color=#1] (1,1)--(1,\arabic{LP@countii});% + \draw[line width=\LP@thicklines,color=#1] (1,\arabic{LP@countii})--(\arabic{LP@countii},\arabic{LP@countii});% + \draw[line width=\LP@thicklines,color=#1] (\arabic{LP@countii},\arabic{LP@countii})--(\arabic{LP@countii},1);% + \draw[line width=\LP@thicklines,color=#1] (\arabic{LP@countii},1)--(1,1);% +}% +% +\newcommand*\placecross[2]% +{% + \LP@setcellcontentC{#1}{#2}{\LP@Cross}% }% % +\newcommand*\placemirror[3]% +{% + \LP@setcellcontentC{#1}{#2}{\LP@Mirror{#3}}% +}% +% +\newcommand*\placearrow[3]% +{% + \LP@setcellcontentC{#1}{#2}{\LP@Arrow{#3}}% +}% \newenvironment{puzzlebackground}% {% \begin{pgfonlayer}{LPbackground}% @@ -545,6 +652,11 @@ \LP@setrowcontents{#1}{1}{0}% }% % +\newcommand*\LP@bottomrow@edge[1]% +{% + \LP@setrowcontents@edge{#1}{1}{0}% +}% +% \newcommand*\LP@leftcolumn[1]% {% \LP@setcolumncontents{#1}{0}{1}% @@ -570,6 +682,16 @@ \LP@setcolumncontents{#1}{\csname the#2@columns\endcsname}{1}% }% % +\newcommand*\LP@rightcolumn@edge[1]% +{% + \LP@rightcolumn@edge@i{#1}{\LP@env@prefix}% +}% +% +\newcommand*\LP@rightcolumn@edge@i[2]% +{% + \LP@setcolumncontents@edge{#1}{\csname the#2@columns\endcsname}{1}% +}% +% % Presentation % \newcommand*\titleformat[1]% @@ -601,7 +723,42 @@ \definecounterstyle{left}{\begingroup\reversemarginpar\marginnote{\tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,draw,rounded corners=3pt,thick]{\Huge\puzzlecounter};}[\LP@cvoffset]\endgroup}% \definecounterstyle{right}{\marginnote{\tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,draw,rounded corners=3pt,thick]{\Huge\puzzlecounter};}[\LP@cvoffset]}% % -\newcommand*\LP@Block{\tikz[scale=\LP@scale]\draw[fill=\LP@color] (0,0) rectangle (1,1);}% +\newcommand*\LP@Block{\tikz[scale=\LP@scale]\draw[line width=\LP@normallines,fill=\LP@color] (0,0) rectangle (1,1);}% +% +\newcommand*\LP@Arrow[1]% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \def\LP@rotate{45}% + \ifthenelse{\equal{#1}{LeftUp}}{\def\LP@rotate{135}}{}% + \ifthenelse{\equal{#1}{LeftDown}}{\def\LP@rotate{225}}{}% + \ifthenelse{\equal{#1}{RightDown}}{\def\LP@rotate{315}}{}% + \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}% + \tikz\draw[->,line width=\LPlinewidth,rotate=\LP@rotate,scale=\LP@scale] (0.1,.5) -- (0.9,.5);% +}% +% +\newcommand*\LP@Cross% +{% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture} + \begin{pgfonlayer}{LPforeground} + \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}% + \draw[line width=\LPlinewidth,scale=\LP@scale,color=LP@c@cross] (.35,.35) -- (0.65,.65) -- (.5,.5) -- (.65,.35)-- (.35,.65);% + \end{pgfonlayer} + \end{tikzpicture} +}% +% +\newcommand*\LP@Mirror[1]% +{% + \def\LP@rotate{0}% + \ifthenelse{\equal{#1}{V}}{\def\LP@rotate{90}}{}% + \LP@set@LP@scale{\LP@env@prefix}% + \begin{tikzpicture}% + \begin{pgfonlayer}{LPforegroundtwo}% + \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}% + \draw[line width=\LPlinewidth,scale=\LP@scale,color=LP@c@mirror,rotate=\LP@rotate] (.35,.5) -- (0.65,.5);% + \end{pgfonlayer}% + \end{tikzpicture}% +}% % % get package options with prefix % @@ -651,6 +808,21 @@ \gdef\LP@package{#1}% }% % +\newcommand*\setgridlinestyle[1]% +{% + \def\LP@grid@linestyle{#1}% +}% +% +\newcommand*\setnormallinewidth[1]% +{% + \def\LP@normallines{#1}% +}% +% +\newcommand*\setthicklinewidth[1]% +{% + \def\LP@thicklines{#1}% +}% +% % generic logicpuzzle environment and options % \newcommand*\LP@LP@init@prefix{LP@LP}% diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/slitherlink.sty b/Master/texmf-dist/tex/latex/logicpuzzle/slitherlink.sty new file mode 100644 index 00000000000..bceeb2c85af --- /dev/null +++ b/Master/texmf-dist/tex/latex/logicpuzzle/slitherlink.sty @@ -0,0 +1,82 @@ +%% +%% 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{slitherlink}[2013/04/20 slitherlink.sty v1.0 - Josef Kleber (C) 2013]% +% +\RequirePackage{logicpuzzle}% +% +\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}% +% +\ExecuteOptionsX{rows,columns,width,fontsize,scale,bgcolor,cvoffset,counterstyle,title,titleindent,titlewidth}% +% +\ProcessOptionsX\relax% +% +\LP@init@counter{\LP@SK@init@prefix}% +% +\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@SK@rows}{\LP@SK@rows}% + \setcounter{LP@SK@columns}{\LP@SK@columns}% + \stepcounter{LP@SK@rows}% + \stepcounter{LP@SK@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}% +}% +% +\endinput%
\ No newline at end of file |