diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-03 23:37:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-03 23:37:53 +0000 |
commit | 1e17ed5c41d36b50fefdc9b895c388c24532e9b1 (patch) | |
tree | d971d31a49e19596d26ee32712f77e3289c8e280 /Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty | |
parent | c299102ae69ccd88ed0439d282548fbeea3fef60 (diff) |
logicpuzzle (3may13)
git-svn-id: svn://tug.org/texlive/trunk@30222 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty | 219 |
1 files changed, 6 insertions, 213 deletions
diff --git a/Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty b/Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty index 7e5739cac8b..442cfc155f7 100644 --- a/Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty +++ b/Master/texmf-dist/tex/latex/logicpuzzle/battleship.sty @@ -23,220 +23,13 @@ % http://en.wikipedia.org/wiki/Battleship_%28puzzle%29 % http://de.wikipedia.org/wiki/Bimaru % -\ProvidesPackage{battleship}[2013/04/10 battleship.sty v1.4a - Josef Kleber (C) 2013]% +\ProvidesPackage{battleship}[2013/04/30 battleship.sty v1.5 - Josef Kleber (C) 2013]% % \RequirePackage{logicpuzzle}% % -\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}}% -% -\ExecuteOptionsX{rows,columns,width,fontsize,shipcolor,scale,bgcolor,cvoffset,counterstyle,title,titleindent,titlewidth,sbindent,sbwidth,sbshipscale}% -\ProcessOptionsX\relax% -% -\LP@init@counter{\LP@BS@init@prefix}% -% -\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@BS@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@BS@rows}{\LP@BS@rows}% - \setcounter{LP@BS@columns}{\LP@BS@columns}% - \stepcounter{LP@BS@rows}% - \stepcounter{LP@BS@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}% -}% -% +\PackageWarningNoLine{battleship}{ +Usage of package battleship.sty is deprecated\MessageBreak +\space battleship.sty will be deleted in near future!\MessageBreak +\space Just use package logicpuzzle.sty instead! +} \endinput%
\ No newline at end of file |