Debian Codegraph @

texmf-dist/doc/latex/logicpuzzle/logicpuzzle.dtx

raw
1 % \iffalse meta-comment
2 % !TEX program = pdfLaTeX
3 %<*internal>
4 \iffalse
5 %</internal>
6 %<*readme>
7 The logicpuzzle bundle allows you to typeset various logic
8 puzzles. At the moment the following puzzles are supported:
9
10 * 2D-Sudoku (aka Magiequadrat, Diagon, ...)
11 * Battleship (aka Bimaru, Marinespiel, Batalla Naval, ...)
12 * Bokkusu (aka Kakurasu, Feldersummenrätsel, ...)
13 * Bridges (aka Brückenbau, Hashi, ...)
14 * Chaos Sudoku
15 * Four Winds (aka Eminent Domain, Lichtstrahl, ...)
16 * Hakyuu (aka Seismic, Ripple Effect, ...)
17 * Hitori
18 * Kakuro
19 * Kendoku (aka Mathdoku, Calcudoku, Basic, MiniPlu, Ken Ken,
20 Square Wisdom, Sukendo, Caldoku, ...)
21 * Killer Sudoku (aka Samunapure, Sum Number Place, Sumdoku,
22 Gebietssummen, ...)
23 * Laser Beam (aka Laserstrahl, ...)
24 * Magic Labyrinth (aka Magic Spiral, Magisches Labyrinth, ...)
25 * Magnets (aka Magnetplatte, Magnetfeld, ...)
26 * Masyu (aka Mashi, {White|Black} Pearls, ...)
27 * Minesweeper (aka Minensuche, ...)
28 + Nonogram (aka Griddlers, Hanjie, Tsunami, Logic Art,
29 Logimage, ...)
30 * Number Link (aka Alphabet Link, Arukone, Buchstabenbund, ...)
31 * Resuko
32 * Schatzsuche
33 * Skyline (aka Skycrapers, Wolkenkratzer, Hochhäuser, ...)
34 incl. Skyline Sudoku and Skyline Sudoku (N*N) variants
35 * Slitherlink (aka Fences, Number Line, Dotty Dilemma,
36 Sli-Lin, Takegaki, Great Wall of China,
37 Loop the Loop, Rundweg, Gartenzaun, ...)
38 * Star Battle (aka Sternenschlacht, ...)
39 * Stars and Arrows (aka Sternenhimmel, ...)
40 * Sudoku
41 * Sun and Moon (aka Sternenhaufen, Munraito, ...)
42 * Tents and Trees (aka Zeltlager, Zeltplatz, Camping, ...)
43 * Tunnel
44
45 License: LPPL
46
47 Changes in v2.5:
48
49 - added support for Nonogram puzzle
50 https://bitbucket.org/kleberj/logicpuzzle/wiki/Nonogram
51 https://bitbucket.org/kleberj/logicpuzzle/downloads/example-nonogram.pdf
52
53 feature request by: Theresa Spannbauer
54
55 - added documented source (dtx)
56
57 - added LPpreset TikZ style to all puzzle environments plus some minor
58 changes
59
60 INSTALL
61 ===========
62
63 First of all, install the package with the package manager of your
64 TeX distribution, if possible.
65
66 Or download logicpuzzle.tds.zip and unzip it in the root directory
67 of your local TeX tree! Run texhash, that's it!
68
69 Manual installation:
70
71 - download logicpuzzle.dtx and qrcode.png
72
73 - extract all other files with pdftex logicpuzzle.dtx
74 If you also want to create logicpuzzle.pdf, you can also run
75 pdflatex logicpuzzle.dtx
76
77 - finish logicpuzzle.pdf by running:
78
79 (pdflatex logicpuzzle.dtx) already done???
80 bibtex logicpuzzle
81 makeindex -s gind.ist logicpuzzle
82 makeindex -s gglo.ist logicpuzzle.glo -o logicpuzzle.gls
83 pdflatex logicpuzzle.dtx
84 bibtex logicpuzzle
85 makeindex -s gind.ist logicpuzzle
86 makeindex -s gglo.ist logicpuzzle.glo -o logicpuzzle.gls
87 pdflatex logicpuzzle.dtx
88
89 - rename some files:
90
91 createlpsudoku.sh -> createlpsudoku
92 lpsmag.sh -> lpsmag
93 README.txt -> README
94
95 or use one of the scripts:
96
97 * Linux: simply run ./rename.sh
98 * Windows: rename rename.win -> rename.bat and run it
99 Windows does pdftex not allow to write a batch file (.bat)
100
101 - move the files:
102
103 *.sty -> localtexmf/tex/latex/logicpuzzle/
104 *.pdf -> localtexmf/doc/latex/logicpuzzle/
105 *.dtx -> localtexmf/doc/latex/logicpuzzle/
106 *.txt -> localtexmf/doc/latex/logicpuzzle/
107 README -> localtexmf/doc/latex/logicpuzzle/
108 bash scripts + *.smc -> somewhere in $PATH
109
110 - update your FNDB (Filename database)
111
112 run texhash
113
114 You really should use the package manager! ;-)
115
116 %</readme>
117 %<*manifest>
118 This work consists of the following files:
119
120 logicpuzzle.dtx
121 logicpuzzle.pdf
122 qrcode.png
123 README
124 %</manifest>
125 %<*renamebat>
126 ren createlpsudoku.sh createlpsudoku
127 ren lpsmag.sh lpsmag
128 ren README.txt README
129 %</renamebat>
130 %<*renamesh>
131 #!/bin/bash
132 #
133 mv createlpsudoku.sh createlpsudoku
134 mv lpsmag.sh lpsmag
135 mv README.txt README
136 %</renamesh>
137 %<*lpsmag>
138 #!/bin/bash
139 #
140 # lpsmag CONFIGFILE
141 #
142 # creates a LaTeX file for the production
143 # a Sudoku magazine with lpsudoku.sty
144 #
145 # License: LPPL
146 #
147 VERSION="v1.1 (06/05/2013)"
148 CONFIGFILE="$1"
149 TEXFILE="lpsmag.tex"
150 TEXFILEBAK="${TEXFILE}.bak"
151 typeset -i COUNT=0
152 SUDOKUPP="6"
153 SUDOKUPPD="12"
154 #
155 if [ -z "$CONFIGFILE" ]
156 then
157 echo "no config file"
158 echo "Usage: `basename $0` configfile"
159 exit 1
160 fi
161 #
162 exec 1> $TEXFILE
163 #
164 startpuzzles()
165 {
166 echo "\lpsudokusetup{scale=0.75,width=6.8cm,fontsize=Large,cvoffset=-24pt}"
167 echo "\setpuzzlecounter{1}"
168 }
169 #
170 startsolutions()
171 {
172 echo "\lpsudokusetup{scale=0.5,width=4.6cm,fontsize=normalsize}"
173 echo "\setpuzzlecounter{1}"
174 }
175 #
176 page()
177 {
178 local name="$1"
179 local difficulty="$2"
180 qqwing --generate $SUDOKUPP --one-line --difficulty $difficulty >${name}.81
181 cat ${name}.81 | qqwing --solve --one-line >${name}_sol.81
182 }
183 #
184 typesetpage()
185 {
186 local name="$1"
187 local last="$2"
188 local puzzlenummer="uneven"
189 COUNT=0
190 echo "%startpage"
191 for puzzle in `cat ${name}.81`
192 do
193 ((COUNT++))
194 echo $puzzle >puzzle.81
195 createlpsudoku -i puzzle.81
196 if [ "$puzzlenummer" = "uneven" ]
197 then
198 echo "\hfill"
199 # toggle even/uneven
200 puzzlenummer="even"
201 else
202 # no \vfill after last lpsudoku
203 # environment of the page
204 if [ $COUNT -lt $SUDOKUPP ]
205 then
206 echo "\vfill"
207 else
208 if [ "$last" != "last" ]
209 then
210 echo "\clearpage"
211 fi
212 fi
213 puzzlenummer="uneven"
214 fi
215 done
216 }
217 #
218 tspfor()
219 {
220 local name="$1"
221 local last="$2"
222 local puzzlepos="one"
223 for puzzle in `cat ${name}.81`
224 do
225 ((COUNT++))
226 if [ $COUNT -eq 1 -o $COUNT -eq 7 ]
227 then
228 echo "%startpage"
229 fi
230 echo $puzzle >puzzle.81
231 createlpsudoku -i puzzle.81
232 if [ "$puzzlepos" = "one" ]
233 then
234 echo "\hfill"
235 puzzlepos="two"
236 elif [ "$puzzlepos" = "two" ]
237 then
238 echo "\hfill"
239 puzzlepos="three"
240 else
241 if [ $COUNT -lt $SUDOKUPPD ]
242 then
243 echo "\vfill"
244 puzzlepos="one"
245 else
246 if [ "$last" = "last" ]
247 then
248 puzzlepos="one"
249 else
250 echo "\clearpage"
251 puzzlepos="one"
252 fi
253 fi
254 fi
255 done
256 }
257 #
258 typesetsolpage()
259 {
260 local name1="$1_sol"
261 local name2="$2_sol"
262 local last="$3"
263 COUNT=0
264 tspfor $name1 $last
265 tspfor $name2 $last
266 }
267 #
268 addcounterstyle()
269 {
270 grep -ne'startpage' $TEXFILE | cut -d':' -f1 >csl.tmp
271 for linenumber in `cat csl.tmp`
272 do
273 COUNT="$linenumber"
274 ((COUNT++))
275 echo "$COUNT a [counterstyle=left]" >>sed.tmp
276 echo "$linenumber d" >>sed.tmp
277 done
278 sed -f sed.tmp $TEXFILE >$TEXFILEBAK
279 rm $TEXFILE
280 mv $TEXFILEBAK $TEXFILE
281 }
282 #
283 addpercent()
284 {
285 sed -e's/$/%/' $TEXFILE >$TEXFILEBAK
286 rm $TEXFILE
287 mv $TEXFILEBAK $TEXFILE
288 }
289 #
290 deleteauxfiles()
291 {
292 rm *.81
293 rm *.tmp
294 }
295 #
296 cat >preamble.tmp <<EOF
297 \documentclass[a4paper]{article}%
298 \usepackage[bottom=3cm,top=3cm,left=2.7cm,right=2.7cm]{geometry}
299 \usepackage{logicpuzzle}%
300 \lpsudokusetup{width=5cm,scale=0.55,fontsize=normalsize}%
301 EOF
302 #
303 cat preamble.tmp
304 echo "\begin{document}"
305 #
306 . $CONFIGFILE
307 #
308 echo "\end{document}"
309 #
310 addcounterstyle
311 addpercent
312 deleteauxfiles
313 exit 0
314 #
315 %</lpsmag>
316 %<*createlpsudoku>
317 #!/bin/bash
318 #
319 # createlpsudoku [options] [-o output] -i input
320 #
321 # transforms Sudokus in 81 format (-e) or Simple Sudoku format (-s)
322 # into lpsudoku environments for lpsudoku.sty
323 #
324 # License: LPPL
325 #
326 FORMAT="81"
327 VERSION="v1.1"
328 LINEENDINGS="UNIX"
329 IFILE=""
330 OFILE=""
331 #
332 typeset -i SLBEGIN=1
333 typeset -i SLEND=9
334 typeset -i COUNT=9
335 #
336 while getopts "eshwvi:o:" FLAG
337 do
338 case "$FLAG" in
339 e) FORMAT="81";;
340 s) FORMAT="ss";;
341 w) LINEENDINGS="WINDOWS";;
342 i) IFILE="$OPTARG";;
343 o) OFILE="$OPTARG";;
344 h) echo "`basename $0` [options] [-o output] -i input"; exit 0;;
345 v) echo "`basename $0` $VERSION (C) 2013 Josef Kleber"; exit 0;;
346 esac
347 done
348 #
349 if [ -z "$IFILE" ]
350 then
351 echo "no input file"
352 echo "Usage: `basename $0` [options] [-o output] -i input"
353 exit 1
354 fi
355 #
356 if [ ! -e "$IFILE" ]
357 then
358 echo "ERROR: input file $IFILE does not exist"
359 exit 1
360 fi
361 #
362 if [ -n "$OFILE" ]
363 then
364 exec 1> $OFILE
365 fi
366 #
367 if [ "$FORMAT" = "ss" ]
368 then
369 echo "\begin{lpsudoku}"
370 for SDLINE in `cat $IFILE | sed -e '1d' -e'5d' -e'9d' -e'13,200d' | sed -e 's/|//g' | sed -e's/^[[:space:]]//g'`
371 do
372 ROWARG=`echo $SDLINE | sed -e's/\./{},/g' -e's/\([[:digit:]]\)/\1,/g' | sed -e's/,$//'`
373 echo " \setrow{$COUNT}{$ROWARG}"
374 ((COUNT--))
375 done
376 echo "\end{lpsudoku}"
377 echo
378 fi
379 #
380 if [ "$FORMAT" = "81" ]
381 then
382 for SUDOKU in `cat $IFILE | sed -e's/#.*//'`
383 do
384 echo "\begin{lpsudoku}"
385 while [ $COUNT -gt 0 ]
386 do
387 SDLINE=`echo $SUDOKU | cut -c${SLBEGIN}-${SLEND}`
388 ROWARG=`echo $SDLINE | sed -e's/\./{},/g' -e's/\([[:digit:]]\)/\1,/g' | sed -e's/,$//'`
389 echo " \setrow{$COUNT}{$ROWARG}"
390 ((COUNT--))
391 ((SLBEGIN+=9))
392 ((SLEND+=9))
393 done
394 SLBEGIN=1
395 SLEND=9
396 COUNT=9
397 echo "\end{lpsudoku}"
398 echo
399 done
400 fi
401 #
402 if [ -n "$OFILE" -a "$LINEENDINGS" = "WINDOWS" ]
403 then
404 unix2dos -q $OFILE
405 fi
406 #
407 exit 0
408 %</createlpsudoku>
409 %<*simple>
410 page p1 easy
411 page p2 easy
412 startpuzzles
413 typesetpage p1
414 typesetpage p2
415 startsolutions
416 typesetsolpage p1 p2 last
417 %</simple>
418 %<*bibfile>
419 @misc{bib:webbb:logigpuzzle,
420 author = {Josef Kleber},
421 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/}(https://bitbucket.org/kleberj/logicpuzzle/)},
422 title = {The logicpuzzle bundle},
423 year = {2013},
424 }
425
426 @misc{bib:weblp:logigpuzzle,
427 author = {Josef Kleber},
428 note = {\href{http://logicpuzzle.square7.de/}(http://logicpuzzle.square7.de/)},
429 title = {{logicpuzzle -- A LaTeX style file for typesetting logic puzzles}},
430 year = {2013},
431 }
432
433 @misc{bib:wiki:createlpsudoku,
434 author = {Josef Kleber},
435 note = {\href{http://logicpuzzle.square7.de/createlpsudoku}(http://logicpuzzle.square7.de/createlpsudoku)},
436 title = {createlpsudoku},
437 year = {2013},
438 }
439
440 @misc{bib:wiki:lpsmag,
441 author = {Josef Kleber},
442 note = {\href{http://logicpuzzle.square7.de/lpsmag}(http://logicpuzzle.square7.de/lpsmag)},
443 title = {lpsmag},
444 year = {2013},
445 }
446
447 @misc{bib:wiki:howtosudoku,
448 author = {Josef Kleber},
449 note = {\href{http://logicpuzzle.square7.de/sudoku_magazine}(http://logicpuzzle.square7.de/sudoku\_magazine)},
450 title = {{How to create a Sudoku magazine}},
451 year = {2013},
452 }
453
454 @misc{bib:web:qqwing,
455 author = {Stephen Ostermiller},
456 note = {\href{http://ostermiller.org/qqwing/}(http://ostermiller.org/qqwing/)},
457 title = {{QQwing -- Sudoku Generator and Solver}},
458 year = {2011},
459 }
460
461 @misc{bib:web:hodoku,
462 author = {Bernhard Hobiger},
463 note = {\href{http://hodoku.sourceforge.net/en/index.php}(http://hodoku.sourceforge.net/en/index.php)},
464 title = {{HoDoKu}},
465 year = {2012},
466 }
467
468 @misc{bib:ex:ddsudoku,
469 author = {Josef Kleber},
470 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-ddsudoku.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-ddsudoku.pdf)},
471 title = {{Examples \& Solutions (ddsudoku)}},
472 year = {2013},
473 }
474
475 @misc{bib:ex:battleship,
476 author = {Josef Kleber},
477 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-battleship.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-battleship.pdf)},
478 title = {{Examples \& Solutions (battleship)}},
479 year = {2013},
480 }
481
482 @misc{bib:ex:bokkusu,
483 author = {Josef Kleber},
484 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-bokkusu.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-bokkusu.pdf)},
485 title = {{Examples \& Solutions (bokkusu)}},
486 year = {2013},
487 }
488
489 @misc{bib:ex:chaossudoku,
490 author = {Josef Kleber},
491 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-chaossudoku.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-chaossudoku.pdf)},
492 title = {{Examples \& Solutions (chaossudoku)}},
493 year = {2013},
494 }
495
496 @misc{bib:ex:hakyuu,
497 author = {Josef Kleber},
498 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-hakyuu.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-hakyuu.pdf)},
499 title = {{Examples \& Solutions (hakyuu)}},
500 year = {2013},
501 }
502
503 @misc{bib:ex:hitori,
504 author = {Josef Kleber},
505 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-hitor.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-hitori.pdf)},
506 title = {{Examples \& Solutions (hitori)}},
507 year = {2013},
508 }
509
510 @misc{bib:ex:kendoku,
511 author = {Josef Kleber},
512 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-kendoku.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-kendoku.pdf)},
513 title = {{Examples \& Solutions (kendoku)}},
514 year = {2013},
515 }
516
517 @misc{bib:ex:killersudoku,
518 author = {Josef Kleber},
519 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-killersudoku.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-killersudoku.pdf)},
520 title = {{Examples \& Solutions (killersudoku)}},
521 year = {2013},
522 }
523
524 @misc{bib:ex:laserbeam,
525 author = {Josef Kleber},
526 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-laserbeam.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-laserbeam.pdf)},
527 title = {{Examples \& Solutions (laserbeam)}},
528 year = {2013},
529 }
530
531 @misc{bib:ex:minesweeper,
532 author = {Josef Kleber},
533 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-minesweeper.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-minesweeper.pdf)},
534 title = {{Examples \& Solutions (minesweeper)}},
535 year = {2013},
536 }
537
538 @misc{bib:ex:skyline,
539 author = {Josef Kleber},
540 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-skyline.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-skyline.pdf)},
541 title = {{Examples \& Solutions (skyline)}},
542 year = {2013},
543 }
544
545 @misc{bib:ex:slitherlink,
546 author = {Josef Kleber},
547 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-slitherlink.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-slitherlink.pdf)},
548 title = {{Examples \& Solutions (slitherlink)}},
549 year = {2013},
550 }
551
552 @misc{bib:ex:lpsudoku,
553 author = {Josef Kleber},
554 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-lpsudoku.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-lpsudoku.pdf)},
555 title = {{Examples \& Solutions (lpsudoku)}},
556 year = {2013},
557 }
558
559 @misc{bib:ex:tunnel,
560 author = {Josef Kleber},
561 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-tunnel.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-tunnel.pdf)},
562 title = {{Examples \& Solutions (tunnel)}},
563 year = {2013},
564 }
565
566 @misc{bib:ex:schatzsuche,
567 author = {Josef Kleber},
568 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-schatzsuche.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-schatzsuche.pdf)},
569 title = {{Examples \& Solutions (schatzsuche)}},
570 year = {2013},
571 }
572
573 @misc{bib:ex:kakuro,
574 author = {Josef Kleber},
575 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-kakuro.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-kakuro.pdf)},
576 title = {{Examples \& Solutions (kakuro)}},
577 year = {2013},
578 }
579
580 @misc{bib:ex:tentsandtrees,
581 author = {Josef Kleber},
582 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-tentsandtrees.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-tentsandtrees.pdf)},
583 title = {{Examples \& Solutions (tentsandtrees)}},
584 year = {2013},
585 }
586
587 @misc{bib:ex:sunandmoon,
588 author = {Josef Kleber},
589 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-sunandmoon.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-sunandmoon.pdf)},
590 title = {{Examples \& Solutions (sunandmoon)}},
591 year = {2013},
592 }
593
594 @misc{bib:ex:bridges,
595 author = {Josef Kleber},
596 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-bridges.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-bridges.pdf)},
597 title = {{Examples \& Solutions (bridges)}},
598 year = {2013},
599 }
600
601 @misc{bib:ex:fourwinds,
602 author = {Josef Kleber},
603 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-fourwinds.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-fourwinds.pdf)},
604 title = {{Examples \& Solutions (fourwinds)}},
605 year = {2013},
606 }
607
608 @misc{bib:ex:numberlink,
609 author = {Josef Kleber},
610 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-numberlink.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-numberlink.pdf)},
611 title = {{Examples \& Solutions (numberlink)}},
612 year = {2013},
613 }
614
615 @misc{bib:ex:magiclabyrinth,
616 author = {Josef Kleber},
617 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-magiclabyrinth.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-magiclabyrinth.pdf)},
618 title = {{Examples \& Solutions (magiclabyrinth)}},
619 year = {2013},
620 }
621
622 @misc{bib:ex:masyu,
623 author = {Josef Kleber},
624 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-masyu.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-masyu.pdf)},
625 title = {{Examples \& Solutions (masyu)}},
626 year = {2013},
627 }
628
629 @misc{bib:ex:magnets,
630 author = {Josef Kleber},
631 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-magnets.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-magnets.pdf)},
632 title = {{Examples \& Solutions (magnets)}},
633 year = {2013},
634 }
635
636 @misc{bib:ex:nonogram,
637 author = {Josef Kleber},
638 note = {\href{https://bitbucket.org/kleberj/logicpuzzle/downloads/example-nonogram.pdf}(https://bitbucket.org/kleberj/logicpuzzle/downloads/example-nonogram.pdf)},
639 title = {{Examples \& Solutions (nonogram)}},
640 year = {2014},
641 }
642
643 %</bibfile>
644 %<*internal>
645 \fi
646 \def\nameofplainTeX{plain}
647 \ifx\fmtname\nameofplainTeX\else
648 \expandafter\begingroup
649 \fi
650 %</internal>
651 %<*install>
652 \input docstrip.tex
653 \keepsilent
654 \askforoverwritefalse
655 \preamble
656
657 Copyright (C) 2013-2014 by:
658 Josef Kleber
659 <[email protected]>
660
661 This file may be distributed and/or modified under the conditions of
662 the LaTeX Project Public License, either version 1.3 of this license
663 or (at your option) any later version. The latest version of this
664 license is in:
665
666 http://www.latex-project.org/lppl.txt
667
668 and version 1.3 or later is part of all distributions of LaTeX version
669 2003/12/01 or later.
670
671 This work has the LPPL maintenance status "author-maintained".
672
673 The Current Maintainer of this work is Josef Kleber.
674
675 This work consists of all files listed in manifest.txt.
676
677 \endpreamble
678
679 \usedir{tex/latex/logicpuzzle}
680 \generate{
681 \file{\jobname.sty}{\from{\jobname.dtx}{package}}
682 }
683 \generate{
684 \file{lpenv.sty}{\from{\jobname.dtx}{lpenv}}
685 }
686 %</install>
687 %<install>\endbatchfile
688 %<*internal>
689 \nopreamble\nopostamble
690 \usedir{source/latex/logicpuzzle}
691 \generate{
692 \file{\jobname.ins}{\from{\jobname.dtx}{install}}
693 }
694 \usedir{doc/latex/logicpuzzle}
695 \generate{
696 \file{README.txt}{\from{\jobname.dtx}{readme}}
697 }
698 \generate{
699 \file{manifest.txt}{\from{\jobname.dtx}{manifest}}
700 }
701 \generate{
702 \file{\jobname.bib}{\from{\jobname.dtx}{bibfile}}
703 }
704 \usedir{scripts/logicpuzzle}
705 \generate{
706 \file{simple.smc}{\from{\jobname.dtx}{simple}}
707 }
708 \generate{
709 \file{lpsmag.sh}{\from{\jobname.dtx}{lpsmag}}
710 }
711 \generate{
712 \file{createlpsudoku.sh}{\from{\jobname.dtx}{createlpsudoku}}
713 }
714 \generate{
715 \file{rename.sh}{\from{\jobname.dtx}{renamesh}}
716 }
717 \generate{
718 \file{rename.win}{\from{\jobname.dtx}{renamebat}}
719 }
720 \ifx\fmtname\nameofplainTeX
721 \expandafter\endbatchfile
722 \else
723 \expandafter\endgroup
724 \fi
725 %</internal>
726 %<*lpenv>
727 \NeedsTeXFormat{LaTeX2e}%
728 \ProvidesPackage{lpenv}[2015/06/15 v2.5 lpenv.sty - Josef Kleber (C) 2013-2014]%
729 %</lpenv>
730 %<*driver>
731 \documentclass[a4paper]{ltxdoc}%
732 \usepackage[english]{babel}%
733 \usepackage[utf8]{inputenc}%
734 \usepackage[T1]{fontenc}%
735 \usepackage{textcomp}%
736 \usepackage{lmodern}%
737 \usepackage{bera}%
738 \usepackage{makeidx}
739 \usepackage{ccicons}
740 \usepackage{tabularx}
741 \usepackage{microtype}%
742 \usepackage{listings}
743 \usepackage{nicefrac}
744 \usepackage[numbered]{hypdoc}
745 \usepackage{marginnote}%
746 \usepackage[svgnames,rgb]{xcolor}%
747 \usepackage[automark,nouppercase]{scrpage2}
748 \usepackage[tocgraduated]{tocstyle}
749 \usetocstyle{classic}
750 \usepackage{logicpuzzle}
751 \usepackage{hyperref}
752 \makeatletter
753 \global\let\tikz@ensure@dollar@catcode=\relax
754 \makeatother
755 \EnableCrossrefs
756 \CodelineIndex
757 \RecordChanges
758 \makeatletter
759 \setlength{\headheight}{1.1\baselineskip}%
760 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
761 {-2.5ex\@plus -1ex \@minus -.25ex}%
762 {1.25ex \@plus .25ex}%
763 {\normalfont\normalsize\bfseries}}
764 \setcounter{secnumdepth}{5}
765 \setcounter{tocdepth}{5}
766 \AtBeginDocument{\IfFileExists{qrcode.png}{}{\write18{wget -O qrcode.png http://i.imgur.com/KAunnuS.png}}}%
767 \hypersetup{colorlinks=true,urlcolor=NavyBlue,linkcolor=NavyBlue,citecolor=CornflowerBlue}%
768 \lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny, basicstyle=\ttfamily, aboveskip=\baselineskip, frame=single, backgroundcolor=\color{LightGoldenrodYellow}, keywordstyle=\color{Blue},
769 emph={ddsudoku, battleship, bokkusu, chaossudoku, hakyuu, hitori, kakuro, kendoku, killersudoku, laserbeam, skyline, slitherlink, lpsudoku, minesweeper, schatzsuche, tentsandtrees, tunnel, bridges, starsandarrows, starbattle, sunandmoon, fourwinds, numberlink, resuko, magiclabyrinth, masyu, magnets, nonogram
770 ,minipage, tikzpicture, puzzlebackground, puzzleforeground, center, pgfonlayer, left,
771 shape, fill, inner, sep, draw, rounded, corners, thick},
772 emphstyle=\color{Tomato}, emph={[2]Wheat, HotPink, GreenYellow, LightBlue, LightSalmon,
773 LightYellow, green, sudoku, rows, columns, scale, layer, color, bgcolor, counterstyle, title,
774 titleindent, titlewidth, cvoffset, width, grid, fontsize, extracells, helplines, solution},
775 emphstyle={[2]\color{OliveDrab}}, morekeywords={LP@definecolor, LP@define@choicekey@fontsize,
776 ExecuteOptionsX, ProcessOptionsX, LP@init@counter, valueH, valueV, sumH, sumV, LP@bottomrow,
777 LP@toprow, LP@rightcolumn, bokkususetup, setkeys, LP@set@package, LP@set@env@prefix,
778 ifthenelse, equal, LP@drawbackground, LP@drawgrid, LP@drawcounter, ProvidesPackage,
779 RequirePackage, LP@BK@init@prefix, LP@BK@init@package, LP@leftcolumn, skylineL,
780 LP@define@key, framearea, framepuzzle, fillarea, filldiagonals, tikzpath, setrule, colorarea,
781 ddsudokucell, chaossudokucell, hakyuucell, setrow, LP@cvoffset, titleformat, definecounterstyle,
782 marginnote, tikz, node, placesegment, placeship, shipH, shipV, shipbox, puzzlecounter, color,
783 fillrow, setcolorrow, laserV, laserH, mirrorV, mirrorH, placearrow, placecross, placemirror,
784 laser, skylineT, skylineB, skylineR, skylineL, skylinecell, setbigcell, slitherlinkcell,
785 tunnelH, tunnelV, tube, portal, Mine, Diamond, ShipR, kakurosetup, kakurorow, KKR, Black,
786 Tent, Tree, definecolor, tentH, tentV, bridgesrow, starbattlecell, starsH, starsV, [, ],
787 RightDown, Right, LeftDown, LeftUp, Up, RightUp, Left, Star, Cloud, Moon, MoonTL, MoonR,
788 MoonT, colorlet, bridge, fourwindscell, numberlinkcell, link, resukosetup, resukocell,
789 Graveltrap, Cross, StraightV, StraightH, CurveTR, CurveBR, trackH, trackV, track,
790 parkinglot, pitlane, xtikzpath, mlline, setcells, magiclabyrinthcell, magnetssetup, minusH,
791 minusV, plusH, plusV, magnetsH, magnetsV, PMH, PMV, MPH, MPV, masyucell, masyuline,
792 masyusetup, MasyuW, MasyuB, nonogramV, nonogramH, nonogramrow, puzzlestrut}}
793 \renewcommand{\maketitle}%
794 {%
795 \thispagestyle{empty}%
796 \pagecolor{Ivory}%
797 \begin{titlepage}%
798 \begin{tikzpicture}[remember picture,overlay]%
799 \node[yshift=-2cm] at (current page.north west)%
800 {%
801 \begin{tikzpicture}[remember picture, overlay]%
802 \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle%
803 (\paperwidth,2cm);%
804 \draw[anchor=west,yshift=-4cm,xshift=3cm,color=NavyBlue] (0,0) node%
805 {\parbox{15cm}{\RaggedRight\Huge\sffamily\textbf{\@title}}};%
806 \draw[anchor=west,yshift=-6cm,xshift=3cm,color=NavyBlue] (0,0) node%
807 {\parbox{15cm}{\huge\sffamily\textbf{\@fileversion}}};%
808 \draw[anchor=west,yshift=-9cm,xshift=3cm,color=NavyBlue] (0,0) node%
809 {\parbox{15cm}{\RaggedRight\huge\sffamily\textbf{\@subtitle}}};%
810 \draw[anchor=west,yshift=-13cm,xshift=3cm,color=NavyBlue] (0,0) node%
811 {\usebox\logo};%
812 \draw[anchor=west,yshift=-17cm,xshift=3cm,color=NavyBlue] (0,0) node%
813 {\parbox{15cm}{\huge\sffamily\textbf{\@date}}};%
814 \draw[anchor=west,yshift=-20cm,xshift=3cm,color=NavyBlue] (0,0) node%
815 {\parbox{15cm}{\Large\sffamily{\@authorline\\\textbf{\@author}}}};%
816 \end{tikzpicture}%
817 };%
818 \node[yshift=0cm] at (current page.south west)%
819 {%
820 \begin{tikzpicture}[remember picture, overlay]%
821 \draw[fill=NavyBlue,color=NavyBlue,yshift=6cm,xshift=2cm] (0,0) rectangle (0.2cm,19cm);%
822 \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);%
823 \draw[anchor=west,yshift=1cm,xshift=3cm,color=NavyBlue] (0,0) node%
824 {\parbox{15cm}{\large\sffamily{\@refline}}};%
825 \end{tikzpicture}%
826 };%
827 \end{tikzpicture}%
828 \end{titlepage}%
829 \pagecolor{white}%
830 }%
831 %
832 \newcommand*{\@tikzhead}[1]%
833 {%
834 \begin{tikzpicture}[remember picture,overlay]%
835 \node[yshift=-2cm] at (current page.north west)%
836 {%
837 \begin{tikzpicture}[remember picture, overlay]%
838 \draw[fill=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);%
839 \draw[anchor=west,yshift=1cm,xshift=1.5cm,color=NavyBlue] (0,0) node%
840 {\parbox{15cm}{\LARGE\sffamily\textbf{\@title}}};%
841 \node[anchor=east,xshift=.9\paperwidth,rectangle,%
842 rounded corners=15pt,inner sep=11pt,fill=NavyBlue]%
843 {\color{white}\textsc{#1}};%
844 \end{tikzpicture}%
845 };%
846 \end{tikzpicture}%
847 }%
848 \clearscrheadings%
849 \ihead{\@tikzhead{\headmark}}%
850 \cfoot{\upshape\thepage}%
851 \pagestyle{scrheadings}%
852 %
853 \newcommand*{\Headline}[1]{\@mkboth{#1}{#1}}%
854 %
855 \renewcommand{\headfont}{\normalfont\mdseries\scshape}
856 %
857 \gdef\@subtitle{}%
858 \providecommand*{\Subtitle}[1]{\gdef\@subtitle{#1}}%
859 \gdef\@fileversion{}%
860 \providecommand*{\Fileversion}[1]{\gdef\@fileversion{#1}}%
861 \gdef\@author{}%
862 \providecommand*{\Author}[1]{\gdef\@author{#1}}%
863 \gdef\@authorline{Package author:}%
864 \providecommand*{\Authorline}[1]{\gdef\@authorline{#1}}%
865 \gdef\@refline{}%
866 \providecommand*{\Refline}[1]{\gdef\@refline{#1}}%
867 \gdef\and{\unskip{}, }%
868 \newcommand\doubledash{-\kern0.5pt-}
869 \def\filename{logicpuzzle.sty}%
870 \def\XeLaTeX{Xe\LaTeX}%
871 %
872 \newenvironment{optionlist}
873 {\begin{trivlist}\setlength\leftskip{2em}}
874 {\end{trivlist}}
875 \newcommand\optitem[3]{\item [\texttt{\textbf{\textcolor{DodgerBlue}{#1}} \lbrack\textcolor{Crimson}{#2}\rbrack}] #3}
876 \renewcommand\tableofcontents%
877 {%
878 % \section*{\contentsname}%
879 \@mkboth{%
880 \MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
881 \@starttoc{toc}%
882 }%
883 %
884 \newcommand\env[1]{\texttt{#1}}%
885 \newcommand\layer[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (PGF layer)}%
886 \SortIndex{PGF layer>#1}{\texttt{#1}}}%
887 \newcommand\styleoption[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Style option)}%
888 \SortIndex{Style option>#1}{\texttt{#1}}}%
889 \newcommand\envoption[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Puzzle option)}%
890 \SortIndex{Puzzle option>#1}{\texttt{#1}}}%
891 \newcommand\stylename[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Style file)}%
892 \SortIndex{Style file>#1}{\texttt{#1}}}%
893 \newcommand\package[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Package)}%
894 \SortIndex{Package>#1}{\texttt{#1}}}%
895 \newcommand*\margcs[1]{\marginnote{\hbadness=10000\RaggedLeft\scriptsize #1}}%
896 \hypersetup{pdfauthor={Josef Kleber},pdftitle={A style file for typesetting logic puzzles},pdfsubject={Documentation for LaTeX style \filename},pageanchor=true,hyperindex=true}%
897 \def\PrintIndex{\clearpage\Headline{Index}\@input@{\jobname.ind}%
898 \global\let\PrintIndex\@empty}
899 \renewenvironment{theindex}
900 {\if@twocolumn
901 \@restonecolfalse
902 \else
903 \@restonecoltrue
904 \fi
905 \columnseprule \z@
906 \columnsep 35\p@
907 \def\see##1##2{\textit{See} ##1}%
908 \def\seealso##1##2{\textit{See also} ##1}%
909 \long\def\cmd##1{\cs{\expandafter\cmd@to@cs\string##1}}%
910 \def\@url##1{\url@break\ttt{##1}\endgroup}%
911 \def\ttt{\begingroup\@sanitize\ttfamily\@ttt}%
912 \def\@ttt##1{##1\endgroup}%
913 \mathchardef\save@secnumdepth\c@secnumdepth
914 \c@secnumdepth\m@ne
915 \phantomsection%
916 \twocolumn%[\section{\indexname}]%
917 \refstepcounter{section}
918 \addcontentsline{toc}{section}{\protect\numberline{\thesection}Index}%
919 \c@secnumdepth\save@secnumdepth
920 % \thispagestyle{plain}
921 \parindent\z@
922 \parskip\z@ \@plus .3\p@\relax
923 \let\item\@idxitem}
924 {\if@restonecol\onecolumn\else\clearpage\fi}
925 \setlength\parindent{0pt}%
926 \makeatother
927 \newenvironment{mydescription}%
928 {%
929 \begin{list}{}{\setlength\leftmargin{0pt}\setlength\labelwidth{-6pt}}
930 }%
931 {%
932 \end{list}
933 }%
934 \begin{document}
935 \DocInput{\jobname.dtx}
936 \end{document}
937 %</driver>
938 % \fi
939 %
940 %\GetFileInfo{\jobname.sty}
941 %\DoNotIndex{\,,\addtocounter,\allowbreak,\arabic,\centering,\clip,\color,\colorlet,
942 %\csname,\definecolor,\draw,\endcsname,\enspace,\equal,\ExecuteOptionsX,\fill,\footnotesize,
943 %\foreach,\hbadness,\Huge,\huge,\i,\if,\ifthenelse,\j,\LARGE,\Large,\large,\marginnote,
944 %\medskip,\MessageBreak,\newif,\node,\normalsize,\PackageError,\parbox,\ProcessOptionsX,
945 %\RaggedRight,\RequirePackage,\scalebox,\scriptsize,\setkeys,\sffamily,\shade,\small,
946 %\stepcounter,\strut,\tiny,\usetikzlibrary,\value,\whiledo,\xdef,\define@choicekey,
947 %\define@key,\begingroup,\begin,\bgroup,\bfseries,\def,\egroup,\else,\end,\endgroup,
948 %\expandafter,\fi,\gdef,\hspace,\ifcase,\ifnum,\let,\newcommand,\newcounter,
949 %\newenvironment,\newlength,\noindent,\or,\par,\relax,\renewcommand,\setcounter,
950 %\space,\vspace}
951 %
952 % \bibliographystyle{plain}
953 % \ddsudokusetup{width=4.5cm,scale=0.85}
954 % \battleshipsetup{width=4.5cm,scale=0.77,sbindent=0.65cm,sbwidth=3.6cm}
955 % \bokkususetup{width=4.5cm,scale=0.64,fontsize=normalsize}
956 % \chaossudokusetup{width=4.5cm,scale=0.89}
957 % \hakyuusetup{width=4.5cm,scale=0.89}
958 % \hitorisetup{width=4.5cm,scale=0.85}
959 % \kakurosetup{width=4.5cm,scale=0.85}
960 % \kendokusetup{width=4.5cm,scale=0.89}
961 % \killersudokusetup{width=4.5cm,scale=0.89}
962 % \laserbeamsetup{width=4.5cm,scale=0.66,fontsize=normalsize}
963 % \minesweepersetup{width=4.5cm,scale=0.85}
964 % \schatzsuchesetup{width=4.5cm,scale=0.85}
965 % \skylinesetup{width=4.5cm,scale=0.66,fontsize=normalsize}
966 % \slitherlinksetup{width=4.5cm,scale=0.85}
967 % \lpsudokusetup{width=4.5cm,scale=0.49,fontsize=small}
968 % \tentsandtreessetup{width=4.5cm,scale=0.75}
969 % \tunnelsetup{width=4.5cm,scale=0.75}
970 % \sunandmoonsetup{width=4.5cm,scale=0.85}
971 % \starsandarrowssetup{width=4.5cm,scale=0.75}
972 % \starbattlesetup{width=4.5cm,scale=0.85}
973 % \bridgessetup{width=4.5cm,rows=8,columns=8,scale=0.55,color=orange!40}
974 % \resukosetup{rows=8,columns=8,width=4cm,fontsize=Huge,scale=.48}
975 % \numberlinksetup{width=4.5cm,scale=0.89}
976 % \killersudokusetup{width=4.5cm,scale=0.89}
977 % \magiclabyrinthsetup{width=4.5cm,scale=0.89}
978 % \masyusetup{width=4.5cm,scale=0.89,color=Teal}
979 % \magnetssetup{width=4.5cm,scale=0.55,bgcolor=Teal!50}
980 % \title{\filename}%
981 % \Subtitle{A style file for typesetting logic puzzles}%
982 % \author{Josef Kleber}
983 % \Fileversion{\fileversion}
984 % \date{\filedate}
985 % \Refline{\href{mailto:[email protected]}{\texttt{[email protected]}}\\\href{https://bitbucket.org/kleberj/logicpuzzle/}{\texttt{https://bitbucket.org/kleberj/logicpuzzle/}}}
986 % \newsavebox\logo
987 % \savebox\logo{%
988 % \begin{laserbeam}
989 % \laserV{1}
990 % \laserH{{}}
991 % \mirrorH{{},2}
992 % \mirrorV{{},{},{},{},{},2}
993 % \framepuzzle[LP@c@mirror]
994 % \placearrow{3}{1}{LeftUp}
995 % \placearrow{6}{4}{RightUp}
996 % \placecross{3}{3}
997 % \end{laserbeam}
998 % \hspace{1.5cm}
999 % \begin{laserbeam}
1000 % \laserV{1}
1001 % \laserH{{}}
1002 % \mirrorH{{},2}
1003 % \mirrorV{{},{},{},{},{},2}
1004 % \framepuzzle[LP@c@mirror]
1005 % \placearrow{3}{1}{LeftUp}
1006 % \placearrow{6}{4}{RightUp}
1007 % \placecross{3}{3}
1008 % \placemirror{2}{2}{V}
1009 % \placemirror{4}{2}{H}
1010 % \placemirror{5}{5}{V}
1011 % \placemirror{3}{5}{H}
1012 % \begin{puzzlebackground}
1013 % \laser{\tikzpath{3}{1}{7,9,9,9,7,1,7,1,3,3,3,9,9}}
1014 % \end{puzzlebackground}
1015 % \end{laserbeam}
1016 %}
1017 % \maketitle
1018 % \stepcounter{page}
1019 % \tableofcontents
1020 % \clearpage
1021 % \setlength\parskip{6pt}%
1022 %
1023 %
1024 %\StopEventually{^^A
1025 % {
1026 % \clearpage
1027 % \raggedright
1028 % \nocite{*}
1029 % \bibliography{logicpuzzle}
1030 % }
1031 % \clearpage
1032 % \PrintChanges
1033 % \PrintIndex
1034 %}
1035 %
1036 % \section{Roll out your own grid-based logic puzzle}
1037 % \label{sec:rollout}
1038 % As an example we take a look at the former \package{bokkusu.sty} package. First, we ignore the LPPL license stuff.
1039 % \lstset{numbers=none,basicstyle=\ttfamily\footnotesize}%
1040 % \iffalse
1041 %<*example>
1042 % \fi
1043 \begin{lstlisting}
1044 \ProvidesPackage{bokkusu}[2013/03/25 bokkusu.sty v1.2 - Josef Kleber (C) 2013]%
1045 \RequirePackage{logicpuzzle}%
1046 \end{lstlisting}
1047 % \iffalse
1048 %</example>
1049 % \fi
1050 % We wrote a package \package{bokkusu.sty} with version number v1.2 and date 2013/03/25 and added a copyright remark. We need to load the code base package \package{logicpuzzle.sty}.
1051 % \iffalse
1052 %<*example>
1053 % \fi
1054 \begin{lstlisting}
1055 \newcommand*\LP@BK@init@prefix{LP@BK}%
1056 \newcommand*\LP@BK@init@package{bokkusu}%
1057 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{rows}{5}%
1058 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{columns}{5}%
1059 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{scale}{1}%
1060 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{counterstyle}{none}%
1061 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{color}{black}%
1062 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{bgcolor}{}%
1063 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{width}{6.7cm}%
1064 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{cvoffset}{-38pt}%
1065 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{title}{}%
1066 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{titleindent}{0.75cm}%
1067 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{titlewidth}{5.85cm}%
1068 \LP@define@choicekey@fontsize{\LP@BK@init@prefix}{\LP@BK@init@package}{Large}%
1069 \ExecuteOptionsX{rows,columns,width,fontsize,scale,color,bgcolor,cvoffset,
1070 counterstyle,title,titleindent,titlewidth}%
1071 \ProcessOptionsX\relax%
1072 \end{lstlisting}
1073 % \iffalse
1074 %</example>
1075 % \fi
1076 % We save the package prefix and name in a macro for easy change. Then we define the options for package \package{bokkusu.sty} and the environment \env{bokkusu}, which are executed afterwards to create the macros for the option values.
1077 % \iffalse
1078 %<*example>
1079 % \fi
1080 \begin{lstlisting}
1081 \let\valueH\LP@bottomrow%
1082 \let\valueV\LP@leftcolumn%
1083 \let\sumH\LP@toprow%
1084 \let\sumV\LP@rightcolumn%
1085 \end{lstlisting}
1086 % \iffalse
1087 %</example>
1088 % \fi
1089 % We need numbers around the grid. Therefore, we define some aliases for the existing generic commands.
1090 % \iffalse
1091 %<*example>
1092 % \fi
1093 \begin{lstlisting}
1094 \newcommand*\bokkususetup[1]%
1095 {%
1096 \setkeys{bokkusu.sty}{#1}%
1097 }%
1098 \end{lstlisting}
1099 % \iffalse
1100 %</example>
1101 % \fi
1102 % We define \cmd\bokkususetup\ for resetting the global package options.
1103 % \clearpage
1104 % \noindent{}Finally, we define the \env{bokkusu} environment.
1105 % \iffalse
1106 %<*example>
1107 % \fi
1108 \begin{lstlisting}
1109 \newenvironment{bokkusu}[1][]%
1110 {%
1111 \setkeys{bokkusu}{#1}%
1112 \LP@set@package{bokkusu}%
1113 \LP@set@env@prefix{LP@BK}%
1114 \setcounter{LP@rows}{\LP@BK@rows}%
1115 \setcounter{LP@columns}{\LP@BK@columns}%
1116 \stepcounter{LP@rows}%
1117 \stepcounter{LP@columns}%
1118 \end{lstlisting}
1119 % \iffalse
1120 %</example>
1121 % \fi
1122 % We locally set the environment options and the prefix and name of the current puzzle environment. We need to reset the counters for \envoption{rows} and \envoption{columns}, as they might have been altered.
1123 % \iffalse
1124 %<*example>
1125 % \fi
1126 \begin{lstlisting}
1127 \begin{minipage}[t]{\LP@BK@width}%
1128 \ifthenelse{\equal{\LP@BK@title}{}}%
1129 {\par\enspace\par}% empty
1130 {\enspace\par\noindent\hspace{\LP@BK@titleindent}\parbox{\LP@BK@titlewidth}
1131 {\strut\LP@titleformat\LP@BK@title}\vspace{3mm}\par}%
1132 \begin{tikzpicture}[scale=\LP@BK@scale]%
1133 \LP@drawbackground{1}{1}{\LP@BK@columns}{\LP@BK@rows}{\LP@BK@bgcolor}%
1134 \LP@drawgrid{1}{1}{\LP@BK@columns}{\LP@BK@rows}{1cm}%
1135 }%
1136 \end{lstlisting}
1137 % \iffalse
1138 %</example>
1139 % \fi
1140 % We start a minipage with width \marg{width}. If the user defined a title, we typeset the title and add a vertical space. Then, we draw the puzzle with the help of \package{tikz.sty}. We start drawing the background and the grid.
1141 % \iffalse
1142 %<*example>
1143 % \fi
1144 \begin{lstlisting}
1145 {%
1146 \end{tikzpicture}%
1147 \LP@drawcounter{\LP@BK@counterstyle}%
1148 \stepcounter{LP@puzzlecounter}%
1149 \end{minipage}%
1150 }%
1151 \end{lstlisting}
1152 % \iffalse
1153 %</example>
1154 % \fi
1155 % Finally, we just end the picture for the puzzle. We draw and step the counter. As last action, we need to close the \env{minipage} environment. That's it. Easy, isn't it? You just need to copy this skelton and change or add some code for your specific puzzle.
1156 %
1157 % \section{User documentation}
1158 % \label{sec:code}
1159 % \lstset{basicstyle=\ttfamily\normalsize}%
1160 % \subsection{PGF Layers}
1161 % \label{sec:layer}
1162 % The \package{logicpuzzle.sty} package defines the PGF layers: \layer{LPdump}, \layer{LPbgcolor}, \layer{LPbackgroundtwo}, \layer{LPbackground}, \layer{LPforeground} and \layer{LPforegroundtwo}
1163 %
1164 % Without specifying a special layer, the standard \layer{main} layer is used. The \texttt{LPback\-ground} and \layer{LPforeground} layers can be accessed with the \env{puzzlebackground} and \env{puzzleforeground} environments.
1165 % The \layer{LPbgcolor} is and should only be used for the background color of the grid.
1166 %
1167 % All layers can also be accessed with the generic PGF method:
1168 %
1169 % \iffalse
1170 %<*example>
1171 % \fi
1172 \begin{lstlisting}
1173 \begin{pgfonlayer}{layer}
1174 ...
1175 \end{pgfonlayer}
1176 \end{lstlisting}
1177 % \iffalse
1178 %</example>
1179 % \fi
1180 %
1181 % \begin{tabularx}{\textwidth}{lX}
1182 % Order: & \layer{LPdump} $\rightarrow$ \layer{LPbgcolor} $\rightarrow$ \layer{LPbackgroundtwo} $\rightarrow$ \layer{LPbackground} $\rightarrow$ \layer{main} $\rightarrow$ \layer{LPforeground} $\rightarrow$ \layer{LPforegroundtwo} \\
1183 % \end{tabularx}
1184 %
1185 % So, if you are in the need to place something behind \layer{LPbackground} or in front of \layer{LPforeground}, you can use the \layer{LPbackgroundtwo} and \layer{LPforegroundtwo} layers. You can hide elements like help nodes behind the background color on the \layer{LPdump} layer.
1186 %
1187 % \subsection{Environments}
1188 % \label{sec:env}
1189 % \subsubsection{\texttt{Puzzle environments}}
1190 % \DescribeEnv{logicpuzzle}
1191 % The \env{logicpuzzle} environment is the generic environment for typesetting logic puzzles. With the optional argument of the environment, you can reset the options with local scope. Here, a blank grid is created.
1192 % Furthermore, there are the other puzzle environments. They have their own set of options, that is also different option values and defaults! These can be changed with the \texttt{\textbackslash puzzlesetup} commands with global scope or in the optional argument of the environment with local scope.
1193 %
1194 % \paragraph{Options}
1195 % \begin{optionlist}
1196 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
1197 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
1198 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
1199 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
1200 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
1201 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
1202 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
1203 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
1204 % \optitem{\envoption{color}}{}{specifies the color for coloring the cells.}
1205 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
1206 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
1207 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
1208 % \end{optionlist}
1209 % \subsubsection{\texttt{Supporting environments}}
1210 % \label{sec:puzzlebackground}
1211 % The \env{puzzlebackground} \DescribeEnv{puzzlebackground}environment allows you to place elements behind the \layer{main} layer on the \layer{LPbackground} layer. This is for example usefull for the \cmd\fillarea\ command.
1212 %
1213 % \label{sec:puzzleforeground}
1214 % The \env{puzzleforeground} \DescribeEnv{puzzleforeground}environment allows you to place elements in front of the \layer{main} layer on the \layer{LPforeground} layer. This is for example usefull for the \cmd\framearea\ command.
1215 %
1216 % \subsection{Commands}
1217 % \subsubsection{In the grid}
1218 % \label{sec:setcell}
1219 % \setlength\leftmargin{0pt}
1220 % \setlength\leftskip{0pt}
1221 % \begin{mydescription}
1222 % \item[\cs{setcell}\marg{column}\marg{row}\marg{element}] \DescribeMacro{\setcell}\mbox{}\\sets an \marg{element} into cell \marg{column}\marg{row} as central node. It is aware of the current values of the surrounding environment options \envoption{rows}, \envoption{columns}, \envoption{scale} and \envoption{fontsize}. Furthermore, a check if \marg{element} is within the grid is applied.
1223 % \label{sec:setcells}
1224 % \item[\cs{setcells}\marg{csv list}\marg{element}] \DescribeMacro{\setcells}\mbox{}\\ sets \marg{element} into several cells by using the \texttt{column}/\texttt{row} format in \marg{csv list}. It works for numbers, letters and most graphical objects, with the exception of commands like \cmd\KKR, which is not a graphic itself, but drawing something into the grid.
1225 % \label{sec:setbigcell}
1226 % \item[\cs{setbigcell}\oarg{fontsize}\marg{column}\marg{row}\marg{element}] \DescribeMacro{\setbigcell}\mbox{}\\sets \marg{element} into a big (\texttt{$2\times2$}) cell \marg{column}\marg{row} as central node. The optional argument \oarg{fontsize} is set to 'Huge' by default.
1227 % \label{sec:setrow}
1228 % \item[\cs{setrow}\marg{row}\marg{csv list}] \DescribeMacro{\setrow}\mbox{}\\sets the contents of a \marg{row}. These may be numbers or letters.
1229 % \label{sec:setcolorrow}
1230 % \item[\cs{setcolorrow}\marg{row}\marg{csv list}] \DescribeMacro{\setcolorrow}\mbox{}\\sets the contents of a \marg{row}. Furthermore, the background of the cell is filled with color \texttt{LP@c@romannumber}. With the number 0, you can black out the grid cell.
1231 % \label{sec:setcolumn}
1232 % \item[\cs{setcolumn}\marg{column}\marg{csv list}] \DescribeMacro{\setcolumn}\mbox{}\\sets the contents of a \marg{column}. These may be numbers or letters.
1233 % \label{sec:setcolorcolumn}
1234 % \item[\cs{setcolorcolumn}\marg{column}\marg{csv list}] \DescribeMacro{\setcolorcolumn}\mbox{}\\sets the contents of a \marg{column}. Furthermore, the background of the cell is filled with color \texttt{LP@c@romannumber}.
1235 % \label{sec:setrule}
1236 % \item[\cs{setrule}\marg{column}\marg{row}\marg{rule}] \DescribeMacro{\setrule}\mbox{}\\sets a calculation rule \marg{rule} into the top left corner of cell \marg{column}\marg{row}. The rule is typeset in inline math mode. You might consider using the \cmd\times\ and \cmd\div\ commands.
1237 % \label{sec:fillcell}
1238 % \item[\cs{fillcell}\marg{column}\marg{row}] \DescribeMacro{\fillcell}\mbox{}\\fills cell \marg{column}\marg{row} with the color defined with environment option \envoption{color}\footnote{Therefore, you must define an option \envoption{color} in the style file you want to use fill commands}. It is aware of the current values of the surrounding envionment options \envoption{rows}, \envoption{columns}, \envoption{scale} and \envoption{color}. Furthermore, a check if the cell is within the grid is applied.
1239 % \label{sec:fillrow}
1240 % \item[\cs{fillrow}\marg{row}\marg{csv list}] \DescribeMacro{\fillrow}\mbox{}\\fills a \marg{row}. In \marg{csv list} '1' means 'fill' and '0' means 'don't fill'. Internally, \cmd\fillrow\ uses \cmd\fillcell.
1241 % \label{sec:fillcolumn}
1242 % \item[\cs{fillcolumn}\marg{column}\marg{csv list}] \DescribeMacro{\fillcolumn}\mbox{}\\fills a \marg{column}. In \marg{csv list} '1' means 'fill' and '0' means 'don't fill'. Internally, \cmd\fillcolumn\ uses \cmd\fillcell.
1243 % \label{sec:filldiagonals}
1244 % \item[\cs{filldiagonals}\oarg{color}] \DescribeMacro{\filldiagonals}\mbox{}\\fills the diagonals with the color specified with the optional argument \oarg{color} (default: yellow!20). Furthermore, it checks for a quadratic grid, otherwise an error message is issued.
1245 % \label{sec:framearea}
1246 % \item[\cs{framearea}\marg{color}\marg{TikZ path}] \DescribeMacro{\framearea}\mbox{}\\frames the area given by \marg{Ti\textit{k}Z path} with color \marg{color}. The reference for coordinates is the bottom left corner of the cell.
1247 % \iffalse
1248 %<*example>
1249 % \fi
1250 \begin{lstlisting}
1251 \framearea{green}{(2,2)--(2,3)--(3,3)--(3,2)--(2,2)}
1252 \end{lstlisting}
1253 % \iffalse
1254 %</example>
1255 % \fi
1256 % This command will color the frame of the grid cell \texttt{(2,2)} green. You should consider using this command in the \env{puzzleforeground} environment.
1257 % \label{sec:fillarea}
1258 % \item[\cs{fillarea}\marg{color}\marg{TikZ path}] \DescribeMacro{\fillarea}\mbox{}\\fills the area given by \marg{Ti\textit{k}Z path} with color \marg{color}. The reference for coordinates is the bottom left corner of the cell. You should consider using this command in the \env{puzzlebackground} environment.
1259 % \label{sec:colorarea}
1260 % \item[\cs{colorarea}\marg{color}\marg{TikZ path}] \DescribeMacro{\colorarea}\mbox{}\\fills the area given by \marg{Ti\textit{k}Z path} with color \marg{color} -- just like \cmd\framearea\ without frame.
1261 % \clearpage
1262 % \label{sec:framepuzzle}
1263 % \item[\cs{framepuzzle}\oarg{color}] \DescribeMacro{\framepuzzle}\mbox{}\\frames the grid (thicker line) with the color specified with the optional argument \oarg{color} (default: black).
1264 % \label{sec:tikzpath}
1265 % \item[\cs{tikzpath}\marg{column}\marg{row}\marg{csv list}] \DescribeMacro{\tikzzpath}\mbox{}\\does easily construct a Ti\textit{k}Z path. You just need to define a starting point \marg{column}\marg{row} (bottom left corner) and a \marg{csv list} with direction indicators relative to the current position.
1266 %
1267 % \begin{center}
1268 % \begin{tabular}{rlrlrl}
1269 % 7: & up left & 8: & up & 9: & up right \\
1270 % 4: & left & 5: & no change & 6: & right \\
1271 % 1: & down left & 2: & down & 3: & down right \\
1272 % \end{tabular}
1273 % \end{center}
1274 % \iffalse
1275 %<*example>
1276 % \fi
1277 \begin{lstlisting}
1278 \framearea{green}{\tikzpath{2}{2}{8,6,2,4}}
1279 \end{lstlisting}
1280 % \iffalse
1281 %</example>
1282 % \fi
1283 % This command will frame grid cell \texttt{(2,2)} green.
1284 %
1285 % \label{sec:xtikzpath}
1286 % \item[\cs{xtikzpath}\marg{column}\marg{row}\marg{csv list}] \DescribeMacro{\xtikzpath}\mbox{}\\is an evolution of the \cmd\tikzpath\ command with slightly different input syntax. In the \marg{csv list} argument, it expects pairs in the form \texttt{direction/length}. Therefore, you can easily define paths from corner to corner.
1287 % \iffalse
1288 %<*example>
1289 % \fi
1290 \begin{lstlisting}
1291 \framearea{green}{\xtikzpath{2}{2}{8/2,6/2,2/2,4/2}}
1292 \end{lstlisting}
1293 % \iffalse
1294 %</example>
1295 % \fi
1296 % This command will frame an area defined by the grid cells \texttt{(2,2)} and \texttt{(3,3)} green.
1297 % \end{mydescription}
1298 % \subsubsection{Presentation}
1299 % \begin{mydescription}
1300 % \label{sec:titleformat}
1301 % \item[\cs{titleformat}\marg{format}] \DescribeMacro{\titleformat}\mbox{}\\defines the \marg{format} of the title. By default, the definition is as follows:
1302 % \iffalse
1303 %<*example>
1304 % \fi
1305 \begin{lstlisting}
1306 \titleformat{\centering\Large\color{blue}}
1307 \end{lstlisting}
1308 % \iffalse
1309 %</example>
1310 % \fi
1311 % \label{sec:puzzlecounter}
1312 % \item[\cs{puzzlecounter}] \DescribeMacro{\puzzlecounter}\mbox{}\\provides the puzzle counter in textual form to use it in \cmd\definecounterstyle.
1313 % \label{sec:setpuzzlecounter}
1314 % \item[\cs{setpuzzlecounter}\marg{number}] \DescribeMacro{\setpuzzlecounter}\mbox{}\\resets the puzzle counter, for example before the solutions.
1315 % \label{sec:definecounterstyle}
1316 % \item[\cs{definecounterstyle}\marg{name}\marg{definition}] \DescribeMacro{\definecounterstyle}\mbox{}\\allows you to define your own styles. For example, the style \texttt{left} is defined as follows:
1317 % \iffalse
1318 %<*example>
1319 % \fi
1320 \begin{lstlisting}
1321 \definecounterstyle{left}{
1322 \begingroup\reversemarginpar\marginnote{
1323 \tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,
1324 draw,rounded corners=3pt,thick]
1325 {\Huge\puzzlecounter};}[\LP@cvoffset]\endgroup}
1326 }
1327 \end{lstlisting}
1328 % \iffalse
1329 %</example>
1330 % \fi
1331 % To typeset the counter into the margin we use the command \cmd\marginnote. We need to use the command \cmd\reversemarginpar\ to set the counter into the left margin. Of course, we must use this command in a group for local scope. Finally we use \cmd\puzzlecounter\ in a \cmd\tikz\ node with a vertical offset set with the option \envoption{cvoffset}.
1332 % \label{sec:setgridlinestyle}
1333 % \item[\cs{setgridlinestyle}\marg{style}] \DescribeMacro{\setgridlinestyle}\mbox{}\\sets the style of lines used in the grid. By default, the style is set to \texttt{solid}, whereas \env{slitherlink} uses \texttt{dashed}.
1334 % \label{sec:setnormallinewidth}
1335 % \item[\cs{setnormallinewidth}\marg{dimension}] \DescribeMacro{\setnormallinewidth}\mbox{}\\sets the width of the standard lines (default: \texttt{0.5pt})
1336 % \label{sec:setthicklinewidth}
1337 % \item[\cs{setthicklinewidth}\marg{dimension}] \DescribeMacro{\setthicklinewidth}\mbox{}\\sets the width of the 'thicker' lines (default: \texttt{1.5pt})
1338 % \end{mydescription}
1339 % \subsubsection{Puzzle specific commands}
1340 % \label{sec:pscommands}
1341 % \paragraph{2D-Sudoku}
1342 % \label{sec:pscddsudoku}
1343 % \begin{mydescription}
1344 % \item[\cs{ddsudokucell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\ddsudokucell}\mbox{}\\
1345 % sets \marg{number} into grid cell \marg{column}\marg{row}.
1346 % \item[\cs{ddsudokusetup}\marg{options}] \DescribeMacro{\ddsudokusetup}\mbox{}\\
1347 % resets the options with global scope.
1348 % \end{mydescription}
1349 % \paragraph{Battleship}
1350 % \label{sec:pscbattleship}
1351 % \begin{mydescription}
1352 % \item[\cs{placeship}\marg{direction}\marg{column}\marg{row}\marg{length}] \DescribeMacro{\placeship}\mbox{}\\
1353 % places complete ships in the grid. It expects the specification of the direction as horizontal (H) or vertical (V). Furthermore, it requires the starting coordinates and the length of the ship.
1354 % \item[\cs{placesegment}\marg{column}\marg{row}\marg{ship segment}] \DescribeMacro{\placesegment}\mbox{}\\
1355 % is used for the placement of ship segments in the grid. In the mandatory argument \marg{ship segment}, you can use the following commands:
1356 % \begin{center}
1357 % \begin{tabular}{lccl}
1358 % \cs{Ship} & \scalebox{.5}{\Ship} & \scalebox{.5}{\ShipC} & \cs{ShipC} \\
1359 % \cs{ShipL} & \scalebox{.5}{\ShipL} & \scalebox{.5}{\ShipR} & \cs{ShipR} \\
1360 % \cs{ShipB} & \scalebox{.5}{\ShipB} & \scalebox{.5}{\ShipT} & \cs{ShipT} \\
1361 % \end{tabular}
1362 % \end{center}
1363 % \item[\cs{ship}] \DescribeMacro{\ship}\mbox{}\\
1364 % The command \cs{ship} was replaced by the \cs{placesegment} command. The command \cs{ship} is deprecated and should not be used longer. It may still be used, but it is not recommended.
1365 % \item[\cs{placewater}\marg{column}\marg{row}] \DescribeMacro{\placewater}\mbox{}\\
1366 % places water markers \mbox{( \raisebox{2pt}{\Water} )} in the grid.
1367 % \item[\cs{placeisland}\marg{column}\marg{row}] \DescribeMacro{\placeisland}\mbox{}\\
1368 % places islands ( \raisebox{-2pt}{\resizebox{!}{10pt}{\Island}} ) in the grid. The island outlines are created randomly: \raisebox{-2pt}{\resizebox{!}{10pt}{\Island}}, \raisebox{-2pt}{\resizebox{!}{10pt}{\Island}}, \raisebox{-2pt}{\resizebox{!}{10pt}{\Island}}, ...
1369 % \item[\cs{shipH}\marg{csv list}] \DescribeMacro{\shipH}\mbox{}\\
1370 % typesets the horizontal numbers above the grid. It expects a comma-separated list as an argument.
1371 % \subparagraph{\texttt{shipV}}
1372 % \item[\cs{shipV}\marg{csv list}] \DescribeMacro{\shipV}\mbox{}\\
1373 % typesets the vertical numbers beside the grid. It also expects a comma separated list.
1374 % \item[\cs{shipbox}\marg{csv list}] \DescribeMacro{\shipbox}\mbox{}\\
1375 % defines the number and size of the ships, which are typeset under the grid.
1376 % \item[\cs{battleshipsetup}\marg{options}] \DescribeMacro{\battleshipsetup}\mbox{}\\
1377 % resets the options with global scope.
1378 % \item[\cs{classicgame}\marg{csv list}] \DescribeMacro{\classicgame}\mbox{}\\
1379 % typesets a game sheet for playing classic Battleship. It expects a comma separated list with the number and sizes of the ships.
1380 % \end{mydescription}
1381 % \paragraph{Bokkusu}
1382 % \label{sec:pscbokkusu}
1383 % \begin{mydescription}
1384 % \item[\cs{valueH}\marg{csv list}] \DescribeMacro{\valueH}\mbox{}\\
1385 % typesets the numbers left to the grid indicating the values of the cells. It expects a comma-separated list as an argument.
1386 % \item[\cs{valueV}\marg{csv list}] \DescribeMacro{\valueV}\mbox{}\\
1387 % typesets the numbers below the grid specifying the values of the cells. It also expects a comma separated list.
1388 % \item[\cs{sumH}\marg{csv list}] \DescribeMacro{\sumH}\mbox{}\\
1389 % typesets the numbers right to the grid indicating the sums of the values of the colored cells. It expects a comma-separated list.
1390 % \item[\cs{sumV}\marg{csv list}] \DescribeMacro{\sumV}\mbox{}\\
1391 % typesets the numbers above the grid specifying the sums of the values of the colored cells. It expects a comma separated list.
1392 % \item[\cs{bokkususetup}\marg{options}] \DescribeMacro{\bokkususetup}\mbox{}\\
1393 % resets the options with global scope.
1394 % \end{mydescription}
1395 % \paragraph{Bridges}
1396 % \label{sec:pscbridges}
1397 % \begin{mydescription}
1398 % \item[\cs{bridgesrow}\marg{row}\marg{csv list}] \DescribeMacro{\bridgesrow}\mbox{}\\
1399 % sets the contents of a bridges \marg{row}. These are the numbers indicating how many bridges originate from this specific island.
1400 % \item[\cs{bridgescolumn}\marg{column}\marg{csv list}] \DescribeMacro{\bridgescolumn}\mbox{}\\
1401 % sets the contents of a bridges \marg{column}.
1402 % \item[\cs{bridge}\oarg{optional arguments}marg{Ti\textit{k}Z path}] \DescribeMacro{\bridge}\mbox{}\\
1403 % draws the bridges between islands. With the optional argument \oarg{double} you can draw a double bridge. Furthermore, you can set the color of the bridge with the option \oarg{color}.
1404 % \item[\cs{bridgessetup}\marg{options}] \DescribeMacro{\bridgessetup}\mbox{}\\
1405 % resets the options with global scope.
1406 % \end{mydescription}
1407 % \paragraph{Chaos Sudoku}
1408 % \label{sec:pscchaossudoku}
1409 % \begin{mydescription}
1410 % \item[\cs{chaossudokucell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\chaossudokucell}\mbox{}\\
1411 % sets \marg{number} into grid cell \marg{column}\marg{row}.
1412 % \item[\cs{chaossudokusetup}\marg{options}] \DescribeMacro{\chaossudokusetup}\mbox{}\\
1413 % resets the options with global scope.
1414 % \end{mydescription}
1415 % \paragraph{Four Winds}
1416 % \label{sec:pscfourwinds}
1417 % \begin{mydescription}
1418 % \item[\cs{fourwindscell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\fourwindscell}\mbox{}\\
1419 % sets \marg{number} into grid cell \marg{column}\marg{row}. Furthermore, it draws lines specified in \marg{csv list} in the \texttt{direction/length} format.
1420 % \item[\cs{fourwindssetup}\marg{options}] \DescribeMacro{\fourwindssetup}\mbox{}\\
1421 % resets the options with global scope.
1422 % \end{mydescription}
1423 % \paragraph{Hakyuu}
1424 % \label{sec:pschakyuu}
1425 % \begin{mydescription}
1426 % \item[\cs{hakyuucell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\hakyuucell}\mbox{}\\
1427 % sets \marg{number} into grid cell \marg{column}\marg{row}.
1428 % \item[\cs{hakyuusetup}\marg{options}] \DescribeMacro{\hakyuusetup}\mbox{}\\
1429 % reset the options with global scope.
1430 % \end{mydescription}
1431 % \paragraph{Hitori}
1432 % \label{sec:pschitori}
1433 % \begin{mydescription}
1434 % \item[\cs{hitorisetup}\marg{options}] \DescribeMacro{\hitorisetup}\mbox{}\\
1435 % resets the options with global scope.
1436 % \end{mydescription}
1437 % \paragraph{Kakuro}
1438 % \label{sec:psckakuro}
1439 % \begin{mydescription}
1440 % \item[\cs{kakurorow}\marg{row}\marg{csv list}] \DescribeMacro{\kakurorow}\mbox{}\\
1441 % sets the contents of a kakuro \marg{row}. These may be numbers and the commands \cmd\KKR\ or \cmd\Black.
1442 % \item[\cs{kakurocolumn}\marg{column}\marg{csv list}] \DescribeMacro{\kakurocolumn}\mbox{}\\
1443 % sets the contents of a kakuro \marg{column}.
1444 % \item[\cs{KKR}\marg{sumV}\marg{sumH}] \DescribeMacro{\KKR}\mbox{}\\
1445 % sets the contents of a kakuro cell.
1446 % \item[\cs{Black}] \DescribeMacro{\Black}\mbox{}\\
1447 % blacks out a cell.
1448 % \item[\cs{kakurosetup}\marg{options}] \DescribeMacro{\kakurosetup}\mbox{}\\
1449 % resets the options with global scope.
1450 % \end{mydescription}
1451 % \paragraph{Kendoku}
1452 % \label{sec:psckendoku}
1453 % \begin{mydescription}
1454 % \item[\cs{kendokucell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\kendokucell}\mbox{}\\
1455 % sets \marg{number} into grid cell \marg{column}\marg{row}.
1456 % \item[\cs{kendokusetup}\marg{options}] \DescribeMacro{\kendokusetup}\mbox{}\\
1457 % resets the options with global scope.
1458 % \end{mydescription}
1459 % \paragraph{Killer Sudoku}
1460 % \label{sec:psckillersudoku}
1461 % \begin{mydescription}
1462 % \item[\cs{killersudokucell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\killersudokucell}\mbox{}\\
1463 % sets \marg{number} into grid cell \marg{column} \marg{row}.
1464 % \subparagraph{\texttt{killersudokusetup}}
1465 % \item[\cs{killersudokusetup}\marg{options}] \DescribeMacro{\killersudokusetup}\mbox{}\\
1466 % resets the options with global scope.
1467 % \end{mydescription}
1468 % \paragraph{Laser Beam}
1469 % \label{sec:psclaserbeam}
1470 % \begin{mydescription}
1471 % \item[\cs{laserH}\marg{csv list}] \DescribeMacro{\laserH}\mbox{}\\
1472 % typesets the numbers above the grid indicating how many cells are traversed by the laser beam. It expects a comma-separated list as an argument.
1473 % \item[\cs{laserV}\marg{csv list}] \DescribeMacro{\laserV}\mbox{}\\
1474 % typesets the numbers left to the grid.
1475 % \item[\cs{mirrorH}\marg{csv list}] \DescribeMacro{\mirrorH}\mbox{}\\
1476 % typesets the numbers below the grid indicating how many mirrors are placed in the intersections of this column.
1477 % \item[\cs{mirrorV}\marg{csv list}] \DescribeMacro{\mirrorV}\mbox{}\\
1478 % typesets the numbers right to the grid.
1479 % \subparagraph{\texttt{placearrow}}
1480 % \item[\cs{placearrow}\marg{column}\marg{row}] \DescribeMacro{\placearrow}\mbox{}\\
1481 % is used for the placement of arrows at the grid frame. The reference for coordinates is the bottom left corner of the cell. In the mandatory argument \marg{direction}, you can use the following indicators: LeftUp, LeftDown, RightUp, RightDown
1482 % \item[\cs{placecross}\marg{column}\marg{row}] \DescribeMacro{\placecross}\mbox{}\\
1483 % places a cross in the intersections of the grid.
1484 % \item[\cs{placemirror}\marg{column}\marg{row}\marg{direction}] \DescribeMacro{\placemirror}\mbox{}\\
1485 % places mirrors in the intersections of the grid. In the mandatory argument \marg{direction}, you can use the following indicators: H, V
1486 % \subparagraph{\texttt{laser}}
1487 % \item[\cs{laser}\oarg{color}\marg{Ti\textit{k}Z path}] \DescribeMacro{\laser}\mbox{}\\
1488 % draws the laser beam given by \marg{Ti\textit{k}Z path} with color \oarg{color} (default: red). The reference for coordinates is the bottom left corner of the cell.
1489 % \iffalse
1490 %<*example>
1491 % \fi
1492 \begin{lstlisting}
1493 \laser[green]{(1,2)--(2,3)--(1,4)}
1494 \end{lstlisting}
1495 % \iffalse
1496 %</example>
1497 % \fi
1498 % You should consider using this command in the \env{puzzlebackground} environment.
1499 % \item[\cs{laserbeamsetup}\marg{options}] \DescribeMacro{\laserbeamsetup}\mbox{}\\
1500 % resets the options with global scope.
1501 % \end{mydescription}
1502 % \paragraph{Magic Labyrinth}
1503 % \label{sec:pscmagiclabyrinth}
1504 % \begin{mydescription}
1505 % \item[\cs{magiclabyrinthcell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\magiclabyrinthcell}\mbox{}\\
1506 % sets a number into grid cell \marg{column} \marg{row}.
1507 % \item[\cs{mlline}\marg{Ti\textit{k}Z path}] \DescribeMacro{\mlline}\mbox{}\\
1508 % draws a line given by \marg{Ti\textit{k}Z path}.
1509 % \item[\cs{magiclabyrinthsetup}\marg{options}] \DescribeMacro{\magiclabyrinthsetup}\mbox{}\\
1510 % resets the options with global scope.
1511 % \end{mydescription}
1512 % \paragraph{Magnets}
1513 % \label{sec:pscmagnets}
1514 % \begin{mydescription}
1515 % \item[\cs{plusH}\marg{csv list}] \DescribeMacro{\plusH}\mbox{}\\
1516 % typesets the numbers above the grid indicating how many positive poles are in the respective column. It expects a comma-separated list as an argument.
1517 % \item[\cs{minusH}\marg{csv list}] \DescribeMacro{\minusH}\mbox{}\\
1518 % typesets the numbers above the grid indicating how many negative poles are in the respective column.
1519 % \item[\cs{plusV}\marg{csv list}] \DescribeMacro{\plusV}\mbox{}\\
1520 % typesets the numbers left to the grid indicating how many positive poles are in the respective row.
1521 % \item[\cs{minusV}\marg{csv list}] \DescribeMacro{\minusV}\mbox{}\\
1522 % typesets the numbers left to the grid indicating how many negative pole ares in the respective row.
1523 % \item[\cs{magnetsH}\marg{csv list}] \DescribeMacro{\magnetsH}\mbox{}\\
1524 % typesets non-magnetic horizontal plates by using the \texttt{column}/\texttt{row} format in \marg{csv list}.
1525 % \subparagraph{\texttt{magnetsV}}
1526 % \item[\cs{magnetsV}\marg{csv list}] \DescribeMacro{\magnetsV}\mbox{}\\
1527 % typesets non-magnetic vertical plates by using the \texttt{column}/\texttt{row} format in \marg{csv list}.
1528 % \item[\cs{PMH}\marg{csv list}] \DescribeMacro{\PMH}\DescribeMacro{\MPH}\DescribeMacro{\PMV}\DescribeMacro{\MPV}\mbox{}\\
1529 % draws horizontal magnetic plates with \fbox{$+$ $-$} arrangement. It expects the \texttt{column}/\texttt{row} format in \marg{csv list}. You can typeset the three other magnetic arrangements by using the \cmd\MPH, \cmd\PMV\ and \cmd\MPV\ commands.
1530 % \item[\cs{magnetssetup}\marg{options}] \DescribeMacro{\magnetssetup}\mbox{}\\
1531 % resets the options with global scope.
1532 % \end{mydescription}
1533 % \paragraph{Masyu}
1534 % \label{sec:pscmasyu}
1535 % \begin{mydescription}
1536 % \item[\cs{masyucell}\marg{column}\marg{row}\marg{element}] \DescribeMacro{\masyucell}\mbox{}\\
1537 % sets an element into grid cell \marg{column} \marg{row}.
1538 % \item[\cs{MasyuW}] \DescribeMacro{\MasyuW}\mbox{}\\
1539 % draws an empty (white) circle.
1540 % \item[\cs{MasyuB}] \DescribeMacro{\MasyuB}\mbox{}\\
1541 % draws a black circle.
1542 % \item[\cs{masyuline}\marg{Ti\textit{k}Z path}] \DescribeMacro{\masyuline}\mbox{}\\
1543 % draws a line given by \marg{Ti\textit{k}Z path}.
1544 % \item[\cs{masyusetup}\marg{options}] \DescribeMacro{\masyusetup}\mbox{}\\
1545 % resets the options with global scope.
1546 % \end{mydescription}
1547 % \paragraph{Minesweeper}
1548 % \label{sec:pscminesweeper}
1549 % \begin{mydescription}
1550 % \item[\cs{Mine}] \DescribeMacro{\Mine}\mbox{}\\
1551 % draws a mine. It can be used in commands like \cmd\setcell\ or \cmd\setrow!
1552 % \item[\cs{minesweepersetup}\marg{options}] \DescribeMacro{\minesweepersetup}\mbox{}\\
1553 % resets the options with global scope.
1554 % \end{mydescription}
1555 % \paragraph{Nonogram}
1556 % \label{sec:pscnonogram}
1557 % \begin{mydescription}
1558 % \item[\cs{nonogramrow}\marg{row}\marg{csv list}] \DescribeMacro{\nonogramrow}\mbox{}\\
1559 % sets the contents of row \marg{row}. In \marg{csv list} it expects the \texttt{column/length} format.
1560 % \item[\cs{nonogramcolumn}\marg{column}\marg{csv list}] \DescribeMacro{\nonogramcolumn}\mbox{}\\
1561 % sets the contents of column \marg{column}. In \marg{csv list} it expects the \texttt{row/length} format.
1562 % \item[\cs{nonogramV}\marg{csv list}] \DescribeMacro{\nonogramV}\mbox{}\\
1563 % sets the contents of the extra cells left to the grid. By definition, the first number is always typeset next to the grid!
1564 % \item[\cs{nonogramH}\marg{csv list}] \DescribeMacro{\nonogramH}\mbox{}\\
1565 % sets the contents of the extra cells on top of the grid.
1566 % \item[\cs{puzzlestrut}] \DescribeMacro{\puzzlestrut}\mbox{}\\
1567 % serves the height adjustment depending on option \texttt{extracells} when you want to typeset puzzle and solution (without extra cells) next to each other.
1568 % \item[\cs{nonogramsetup}\marg{options}] \DescribeMacro{\nonogramsetup}\mbox{}\\
1569 % resets the options with global scope.
1570 % \end{mydescription}
1571 % \paragraph{Number Link}
1572 % \label{sec:pscnumberlink}
1573 % \begin{mydescription}
1574 % \item[\cs{numberlinkcell}\marg{column}\marg{row}\marg{element}] \DescribeMacro{\numberlinkcell}\mbox{}\\
1575 % sets a number or letter into grid cell \marg{column}\marg{row}.
1576 % \item[\cs{link}\marg{\marg{Ti\textit{k}Z path}}] \DescribeMacro{\link}\mbox{}\\
1577 % draws a line given by \marg{Ti\textit{k}Z path}.
1578 % \item[\cs{numberlinksetup}\marg{options}] \DescribeMacro{\numberlinksetup}\mbox{}\\
1579 % resets the options with global scope.
1580 % \end{mydescription}
1581 % \paragraph{Resuko}
1582 % \label{sec:pscresuko}
1583 % \begin{mydescription}
1584 % \item[\cs{resukocell}\marg{column}\marg{row}\marg{element}] \DescribeMacro{\resukocell}\mbox{}\\
1585 % sets the \marg{element} into grid cell \marg{column}\marg{row}.
1586 % \subparagraph{\texttt{Track tiles}}
1587 % \DescribeMacro{\Straight}\DescribeMacro{\StraightH}\DescribeMacro{\StraightV}\DescribeMacro{\Cross}\DescribeMacro{\CrossH}\DescribeMacro{\CrossV}
1588 %
1589 % \DescribeMacro{\CurveTL}\DescribeMacro{\CurveTR}\DescribeMacro{\CurveBL}\DescribeMacro{\CurveBR}\DescribeMacro{\Graveltrap}
1590 % You can use the following commands to draw different track tiles, e.g. with the \cmd\resukocell\ command:
1591 %
1592 % \begin{center}
1593 % \begin{tabular}{rlrlrl}
1594 % \raisebox{-7pt}{\Straight} & \cmd\Straight & \raisebox{-7pt}{\StraightH} & \cmd\StraightH & \raisebox{-7pt}{\StraightV} & \cmd\StraightV \\
1595 % & & & & & \\
1596 % \raisebox{-7pt}{\Cross} & \cmd\Cross & \raisebox{-7pt}{\CrossH} & \cmd\CrossH & \raisebox{-7pt}{\CrossV} & \cmd\CrossV \\
1597 % & & & & & \\
1598 % \raisebox{-7pt}{\CurveTL} & \cmd\CurveTL & \raisebox{-7pt}{\CurveTR} & \cmd\CurveTR & \raisebox{-7pt}{\CurveBL} & \cmd\CurveBL \\
1599 % & & & & & \\
1600 % \raisebox{-7pt}{\CurveBR} & \cmd\CurveBR & \raisebox{-7pt}{\Graveltrap} & \cmd\Graveltrap & \\
1601 % \end{tabular}
1602 % \end{center}
1603 %
1604 % \item[\cs{pitlane}\marg{column}\marg{row}\marg{direction}] \DescribeMacro{\pitlane}\mbox{}\\
1605 % draws the pit lane in grid cell \{\marg{column}\}\{\marg{row}\} with \{\marg{direction}\} V or H.
1606 % \item[\cs{parkinglot}\marg{column}\marg{row}] \DescribeMacro{\parkinglot}\mbox{}\\
1607 % draws the parking lot in grid cell \marg{column}\marg{row}.
1608 % \item[\cs{trackH}\marg{csv list}] \DescribeMacro{\trackH}\mbox{}\\
1609 % typesets the track tiles below the grid indicating how many different tiles are in the respective column. It expects a comma-separated list as an argument with the format \texttt{straights/curves/intersections}.
1610 % \item[\cs{trackV}\marg{csv list}] \DescribeMacro{\trackV}\mbox{}\\
1611 % typesets the track tiles left to the grid.
1612 % \item[\cs{track}\marg{Ti\textit{k}Z path}] \DescribeMacro{\track}\mbox{}\\
1613 % draws the race track given by \marg{Ti\textit{k}Z path}. The design of the race track is based on \href{http://tex.stackexchange.com/users/3708/frederic}{Frédéric}'s answer to this \href{http://tex.stackexchange.com/questions/115923/crossing-paths-in-tikz-without-intersection}{question} on \TeX.sx. The design with auto-generated bridges will only work, if the path is not constructed with an intersection point. It's recommended to start the path on a standard straight and define the path from corner to corner with \cmd\xtikzpath.
1614 % \item[\cs{resukosetup}\marg{options}] \DescribeMacro{\resukosetup}\mbox{}\\
1615 % resets the options with global scope.
1616 % \end{mydescription}
1617 % \paragraph{Schatzsuche}
1618 % \label{sec:pscschatzsuche}
1619 % \begin{mydescription}
1620 % \item[\cs{Diamond}] \DescribeMacro{\Diamond}\mbox{}\\
1621 % draws a diamond. It can be used in commands like \cmd\setcell\ or \cmd\setrow!
1622 % \item[\cs{schatzsuchesetup}\marg{options}] \DescribeMacro{\schatzsuchesetup}\mbox{}\\
1623 % resets the options with global scope.
1624 % \end{mydescription}
1625 % \paragraph{Skyline}
1626 % \label{sec:pscskyline}
1627 % \begin{mydescription}
1628 % \item[\cs{skylineT}\marg{csv list}] \DescribeMacro{\skylineT}\mbox{}\\
1629 % typesets the numbers above the grid indicating how many skycrapers are visible. It expects a comma-separated list as an argument.
1630 % \item[\cs{skylineB}\marg{csv list}] \DescribeMacro{\skylineB}\mbox{}\\
1631 % typesets the numbers below the grid.
1632 % \item[\cs{skylineL}\marg{csv list}] \DescribeMacro{\skylineL}\mbox{}\\
1633 % typesets the numbers left to the grid.
1634 % \item[\cs{skylineR}\marg{csv list}] \DescribeMacro{\skylineR}\mbox{}\\
1635 % typesets the numbers right to the grid.
1636 % \item[\cs{skylinecell}\marg{column}\marg{row}\}\marg{height}] \DescribeMacro{\skylinecell}\mbox{}\\
1637 % sets \marg{height} into grid cell \marg{column}\marg{row}.
1638 % \item[\cs{skylinesetup}\marg{options}] \DescribeMacro{\skylinesetup}\mbox{}\\
1639 % resets the options with global scope.
1640 % \end{mydescription}
1641 % \paragraph{Slitherlink}
1642 % \label{sec:pscslitherlink}
1643 % \begin{mydescription}
1644 % \item[\cs{slitherlinkcell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\slitherlinkcell}\mbox{}\\
1645 % sets \marg{number} into grid cell \marg{column}\marg{row}.
1646 % \item[\cs{slitherlinksetup}\marg{options}] \DescribeMacro{\slitherlinksetup}\mbox{}\\
1647 % resets the options with global scope.
1648 % \end{mydescription}
1649 % \paragraph{Star Battle}
1650 % \label{sec:pscstarbattle}
1651 % \begin{mydescription}
1652 % \item[\cs{starbattlecell}\marg{column}\marg{row}\marg{element}] \DescribeMacro{\starbattlecell}\mbox{}\\
1653 % sets \marg{element} into grid cell \marg{column}\marg{row}, e.g. the \cmd\Star\ command.
1654 % \item[\cs{starbattlesetup}\marg{options}] \DescribeMacro{\starbattlesetup}\mbox{}\\
1655 % resets the options with global scope.
1656 % \end{mydescription}
1657 % \paragraph{Stars and Arrows}
1658 % \label{sec:pscstarsandarrows}
1659 % \begin{mydescription}
1660 % \item[\cs{starsH}\marg{csv list}] \DescribeMacro{\starsH}\mbox{}\\
1661 % typesets the numbers above the grid indicating how many stars are in the respective column. It expects a comma-separated list as an argument.
1662 % \item[\cs{starsV}\marg{csv list}] \DescribeMacro{\starsV}\mbox{}\\
1663 % typesets the numbers left to the grid.
1664 % \item[\cs{Star}] \DescribeMacro{\Star}\mbox{}\\
1665 % draws a star. It can be used in commands like \cmd\setcell\ or \cmd\setrow!
1666 % \subparagraph{Arrows}
1667 % \DescribeMacro{\Right}\DescribeMacro{\RightUp}\DescribeMacro{\Up}\DescribeMacro{\LeftUp}
1668 %
1669 % \DescribeMacro{\Left}\DescribeMacro{\LeftDown}\DescribeMacro{\Down}\DescribeMacro{\RightDown}
1670 % You can use the following commands to draw different arrows:
1671 %
1672 % \begin{center}
1673 % \begin{tabular}{lrlrlrlr}
1674 % \cmd\Right & \raisebox{3pt}{\Right} & \cmd\RightUp & \raisebox{-4pt}{\RightUp} & \cmd\Up & \raisebox{-7pt}{\Up} & \cmd\LeftUp & \raisebox{-4pt}{\LeftUp} \\
1675 % \cmd\Left & \raisebox{3pt}{\Left} & \cmd\LeftDown & \raisebox{-4pt}{\LeftDown} & \cmd\Down & \raisebox{-7pt}{\Down} & \cmd\RightDown & \raisebox{-4pt}{\RightDown} \\
1676 % \end{tabular}
1677 % \end{center}
1678 % \item[\cs{starsandarrowssetup}\marg{options}] \DescribeMacro{\starsandarrowssetup}\mbox{}\\
1679 % resets the options with global scope.
1680 % \end{mydescription}
1681 % \paragraph{Sudoku}
1682 % \label{sec:psclpsudoku}
1683 % \begin{mydescription}
1684 % \item[\cs{lpsudokucell}\marg{column}\marg{row}\marg{number}] \DescribeMacro{\lpsudokucell}\mbox{}\\
1685 % sets \marg{number} into grid cell \marg{column}\marg{row}.
1686 % \item[\cs{lpsudokusetup}\marg{options}] \DescribeMacro{\lpsudokusetup}\mbox{}\\
1687 % resets the options with global scope.
1688 % \end{mydescription}
1689 % \paragraph{Sun and Moon}
1690 % \label{sec:pscsunandmoon}
1691 % \begin{mydescription}
1692 % \item[\cs{Star}] \DescribeMacro{\Star}\mbox{}\\
1693 % draws a star. It can be used in commands like \cmd\setcell\ or \cmd\setrow!
1694 % \item[\cs{Cloud}] \DescribeMacro{\Cloud}\mbox{}\\
1695 % draws a dark cloud.
1696 % \subparagraph{Howl at the Moon}
1697 % \DescribeMacro{\Moon}\DescribeMacro{\MoonT}\DescribeMacro{\MoonB}\DescribeMacro{\MoonR}\DescribeMacro{\MoonL}
1698 %
1699 % \DescribeMacro{\MoonTR}\DescribeMacro{\MoonTL}\DescribeMacro{\MoonBR}\DescribeMacro{\MoonBL}
1700 % You can use the following commands to draw different iluminated moons:
1701 %
1702 % \begin{center}
1703 % \begin{tabular}{lrlrlr}
1704 % \cmd\Moon & \raisebox{-4pt}{\Moon} & \cmd\MoonT & \raisebox{-4pt}{\MoonT} & \cmd\MoonB & \raisebox{-4pt}{\MoonB} \\
1705 % & & & & & \\
1706 % \cmd\MoonR & \raisebox{-4pt}{\MoonR} & \cmd\MoonL & \raisebox{-4pt}{\MoonL} & \cmd\MoonTR & \raisebox{-4pt}{\MoonTR} \\
1707 % & & & & & \\
1708 % \cmd\MoonTL & \raisebox{-4pt}{\MoonTL} & \cmd\MoonBR & \raisebox{-4pt}{\MoonBR} & \cmd\MoonBL & \raisebox{-4pt}{\MoonBL} \\
1709 % \end{tabular}
1710 % \end{center}
1711 % \item[\cs{sunandmoonssetup}\marg{options}] \DescribeMacro{\sunandmoonssetup}\mbox{}\\
1712 % resets the options with global scope.
1713 % \end{mydescription}
1714 % \paragraph{Tents and Trees}
1715 % \label{sec:psctentsandtrees}
1716 % \begin{mydescription}
1717 % \item[\cs{tentH}\marg{csv list}] \DescribeMacro{\tentH}\mbox{}\\
1718 % typesets the numbers above the grid indicating how many tents are in the respective column. It expects a comma-separated list as an argument.
1719 % \item[\cs{tentV}\marg{csv list}] \DescribeMacro{\tentV}\mbox{}\\
1720 % typesets the numbers left to the grid.
1721 % \item[\cs{Tree}] \DescribeMacro{\Tree}\mbox{}\\
1722 % draws a tree. It can be used in commands like \cmd\setcell\ or \cmd\setrow! The design of the tree is based on \href{http://tex.stackexchange.com/users/3144/alain-matthes}{Alain Matthes}' answer to this \href{http://tex.stackexchange.com/questions/39149/how-can-we-draw-a-christmas-tree-with-decorations-using-tikz}{question} on \TeX.sx.
1723 % \item[\cs{Tent}] \DescribeMacro{\Tent}\mbox{}\\
1724 % draws a tent.
1725 % \item[\cs{tentsandtreessetup}\marg{options}] \DescribeMacro{\tentsandtreessetup}\mbox{}\\
1726 % resets the options with global scope.
1727 % \end{mydescription}
1728 % \paragraph{Tunnel}
1729 % \label{sec:psctunnel}
1730 % \begin{mydescription}
1731 % \item[\cs{tunnelH}\marg{csv list}] \DescribeMacro{\tunnelH}\mbox{}\\
1732 % typesets the numbers above the grid indicating how many tube segments are in the respective column. It expects a comma-separated list as an argument.
1733 % \item[\cs{tunnelV}\marg{csv list}] \DescribeMacro{\tunnelV}\mbox{}\\
1734 % typesets the numbers left to the grid.
1735 % \item[\cs{portal}\marg{column}\}\{\marg{row}] \DescribeMacro{\portal}\mbox{}\\
1736 % is used for the placement of tunnel portals in the grid.
1737 % \item[\cs{tube}\marg{Ti\textit{k}Z path}] \DescribeMacro{\tube}\mbox{}\\
1738 % draws the tunnel tube given by \marg{Ti\textit{k}Z path}. The reference for coordinates is the center of the cell. The design of the tube is based on \href{http://tex.stackexchange.com/users/16772/xoff}{Xoff}'s answer to this \href{http://tex.stackexchange.com/questions/109410/how-to-pimp-my-tube}{question} on \TeX.sx.
1739 % \iffalse
1740 %<*example>
1741 % \fi
1742 \begin{lstlisting}
1743 \tube{(1.5,2.5)--(3.5,2.5)--(3.5,4.5)}
1744 \end{lstlisting}
1745 % \iffalse
1746 %</example>
1747 % \fi
1748 % \item[\cs{tunnelsetup}\marg{options}] \DescribeMacro{\tunnelsetup}\mbox{}\\
1749 % resets the options with global scope.
1750 % \end{mydescription}
1751 % \section{Examples}
1752 % \subsection{2D-Sudoku}
1753 % Fill every row, every column and each of the two diagonals -- if indicated -- with numbers from 1 to SIZE of the grid.
1754 %
1755 % \subsubsection{Example}
1756 % \begin{figure}[htbp]
1757 % \begin{center}
1758 % \begin{ddsudoku}
1759 % \framepuzzle
1760 % \filldiagonals[orange!50]
1761 % \ddsudokucell{1}{5}{1}
1762 % \ddsudokucell{1}{4}{3}
1763 % \ddsudokucell{2}{3}{4}
1764 % \ddsudokucell{4}{1}{3}
1765 % \ddsudokucell{4}{3}{2}
1766 % \ddsudokucell{5}{4}{4}
1767 % \end{ddsudoku}
1768 % \hspace{1.5cm}
1769 % \begin{ddsudoku}
1770 % \framepuzzle
1771 % \filldiagonals[orange!50]
1772 % \setrow{5}{1,3,4,5,2}
1773 % \setrow{4}{3,2,5,1,4}
1774 % \setrow{3}{5,4,3,2,1}
1775 % \setrow{2}{2,5,1,4,3}
1776 % \setrow{1}{4,1,2,3,5}
1777 % \end{ddsudoku}
1778 % \end{center}
1779 % \end{figure}
1780 % \iffalse
1781 %<*example>
1782 % \fi
1783 \begin{lstlisting}
1784 \begin{center}
1785 \begin{ddsudoku}
1786 \framepuzzle
1787 \filldiagonals[orange!50]
1788 \ddsudokucell{1}{5}{1}
1789 \ddsudokucell{1}{4}{3}
1790 \ddsudokucell{2}{3}{4}
1791 \ddsudokucell{4}{1}{3}
1792 \ddsudokucell{4}{3}{2}
1793 \ddsudokucell{5}{4}{4}
1794 \end{ddsudoku}
1795 \hspace{1.5cm}
1796 \begin{ddsudoku}
1797 \framepuzzle
1798 \filldiagonals[orange!50]
1799 \setrow{5}{1,3,4,5,2}
1800 \setrow{4}{3,2,5,1,4}
1801 \setrow{3}{5,4,3,2,1}
1802 \setrow{2}{2,5,1,4,3}
1803 \setrow{1}{4,1,2,3,5}
1804 \end{ddsudoku}
1805 \end{center}
1806 \end{lstlisting}
1807 % \iffalse
1808 %</example>
1809 % \fi
1810 % \subsubsection{Options}
1811 % \begin{optionlist}
1812 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
1813 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
1814 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
1815 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
1816 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
1817 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
1818 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
1819 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
1820 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
1821 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
1822 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
1823 % \end{optionlist}
1824 %
1825 % \subsection{Battleship}
1826 % Try to find the positions of the ships listed below the puzzle. The numbers on the side of the puzzle reveals how many ship segments can be found in the rows and columns. All remaining fields indicate 'water'. Consider the following rules: The ships are arranged horizontally and vertically. No ship touches another ship at any point, not even diagonally.
1827 %
1828 % \subsubsection{Example}
1829 % \begin{figure}[htbp]
1830 % \begin{center}
1831 % \begin{battleship}
1832 % \placesegment{4}{1}{\ShipR}
1833 % \shipH{4,1,2,2,2}
1834 % \shipV{3,1,4,0,3}
1835 % \shipbox{3,3,2,2,1}
1836 % \end{battleship}
1837 % \hspace{1.5cm}
1838 % \begin{battleship}
1839 % \placeship{V}{1}{1}{3}
1840 % \placeship{H}{1}{5}{2}
1841 % \placeship{H}{3}{1}{2}
1842 % \placeship{H}{3}{3}{3}
1843 % \placeship{H}{5}{5}{1}
1844 % \shipH{4,1,2,2,2}
1845 % \shipV{3,1,4,0,3}
1846 % \end{battleship}
1847 % \end{center}
1848 % \end{figure}
1849 % \iffalse
1850 %<*example>
1851 % \fi
1852 \begin{lstlisting}
1853 \begin{center}
1854 \begin{battleship}
1855 \placesegment{4}{1}{\ShipR}
1856 \shipH{4,1,2,2,2}
1857 \shipV{3,1,4,0,3}
1858 \shipbox{3,3,2,2,1}
1859 \end{battleship}
1860 \hspace{1.5cm}
1861 \begin{battleship}
1862 \placeship{V}{1}{1}{3}
1863 \placeship{H}{1}{5}{2}
1864 \placeship{H}{3}{1}{2}
1865 \placeship{H}{3}{3}{3}
1866 \placeship{H}{5}{5}{1}
1867 \shipH{4,1,2,2,2}
1868 \shipV{3,1,4,0,3}
1869 \end{battleship}
1870 \end{center}
1871 \end{lstlisting}
1872 % \iffalse
1873 %</example>
1874 % \fi
1875 % \subsubsection{Options}
1876 % \begin{optionlist}
1877 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
1878 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid.}
1879 % \optitem{shipcolor}{green}{sets the color of the ship segments.}
1880 % \optitem{\envoption{width}}{6cm}{sets the width of the minipage, in which the grid is typeset.}
1881 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
1882 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
1883 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
1884 % \optitem{\envoption{titleindent}}{0.75cm}{defines the indent of the title.}
1885 % \optitem{\envoption{titlewidth}}{5.15cm}{specifies the width of the box the title is set in.}
1886 % \optitem{\envoption{sbindent}}{0.75cm}{defines the indent of the ship box below the grid.}
1887 % \optitem{\envoption{sbwidth}}{5.15cm}{specifies the width of the minipage, in which the ships are typeset.}
1888 % \optitem{\envoption{sbshipscale}}{1}{scales the size of the ships in the ship box.}
1889 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
1890 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
1891 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
1892 % \end{optionlist}
1893 %
1894 % \subsection{Bokkusu}
1895 % Black out some of the grid cells. The numbers on the left and the bottom edge of the grid indicate the values of the cells for adding up. The numbers on the right and the top edge of the grid specify the sums of the values of the colored cells.
1896 %
1897 % \subsubsection{Example}
1898 % \begin{figure}[htbp]
1899 % \begin{center}
1900 % \begin{bokkusu}
1901 % \valueH{1,2,3,4,5}
1902 % \valueV{1,2,3,4,5}
1903 % \sumH{7,1,11,9,6}
1904 % \sumV{2,12,5,13,?}
1905 % \end{bokkusu}
1906 % \hspace{1.5cm}
1907 % \begin{bokkusu}
1908 % \valueH{1,2,3,4,5}
1909 % \valueV{1,2,3,4,5}
1910 % \sumH{7,1,11,9,6}
1911 % \sumV{2,12,5,13,?}
1912 % \fillrow{1}{0,1,0,0,0}
1913 % \fillrow{2}{0,0,1,1,1}
1914 % \fillrow{3}{1,0,0,1,0}
1915 % \fillrow{4}{1,0,1,1,1}
1916 % \fillrow{5}{0,0,1,0,0}
1917 % \end{bokkusu}
1918 % \end{center}
1919 % \end{figure}
1920 % \iffalse
1921 %<*example>
1922 % \fi
1923 \begin{lstlisting}
1924 \begin{center}
1925 \begin{bokkusu}
1926 \valueH{1,2,3,4,5}
1927 \valueV{1,2,3,4,5}
1928 \sumH{7,1,11,9,6}
1929 \sumV{2,12,5,13,?}
1930 \end{bokkusu}
1931 \hspace{1.5cm}
1932 \begin{bokkusu}
1933 \valueH{1,2,3,4,5}
1934 \valueV{1,2,3,4,5}
1935 \sumH{7,1,11,9,6}
1936 \sumV{2,12,5,13,?}
1937 \fillrow{5}{0,0,1,0,0}
1938 \fillrow{4}{1,0,1,1,1}
1939 \fillrow{3}{1,0,0,1,0}
1940 \fillrow{2}{0,0,1,1,1}
1941 \fillrow{1}{0,1,0,0,0}
1942 \end{bokkusu}
1943 \end{center}
1944 \end{lstlisting}
1945 % \iffalse
1946 %</example>
1947 % \fi
1948 % \subsubsection{Options}
1949 % \begin{optionlist}
1950 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
1951 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
1952 % \optitem{\envoption{width}}{6.7cm}{sets the width of the minipage, in which the grid is typeset.}
1953 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
1954 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
1955 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
1956 % \optitem{\envoption{titleindent}}{0.75cm}{defines the indent of the title.}
1957 % \optitem{\envoption{titlewidth}}{5.85cm}{specifies the width of the box the title is set in.}
1958 % \optitem{\envoption{color}}{black}{specifies the color for coloring the cells.}
1959 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
1960 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
1961 % \optitem{\envoption{cvoffset}}{-38pt}{sets the vertical offset of the counters in the margin.}
1962 % \end{optionlist}
1963 %
1964 % \subsection{Bridges}
1965 % Connect all the islands (circles) located in the grid by bridges. The bridges may only be routed horizontally and vertically. Islands may be connected by a maximum of two bridges. The bridges must neither overlap nor cross. They may also not be built over islands. The numbers in the islands indicate how many bridges originate from this island. All islands must be fully connected.
1966 %
1967 % \subsubsection{Example}
1968 % \colorlet{LP@c@bridge}{Teal}
1969 % \begin{figure}[htbp]
1970 % \begin{center}
1971 % \begin{bridges}
1972 % \framepuzzle
1973 % \bridgesrow{8}{{},4,{},{},{},5,{},2}
1974 % \bridgesrow{7}{{},{},1}
1975 % \bridgesrow{5}{{},{},3,{},4}
1976 % \bridgesrow{4}{{},3,{},1,{},2}
1977 % \bridgesrow{3}{{},{},{},{},{},{},{}}
1978 % \bridgesrow{2}{{},2,{},{},5,{},{},2}
1979 % \end{bridges}
1980 % \hspace{1.5cm}
1981 % \begin{bridges}[grid=none]
1982 % \framepuzzle
1983 % \bridgesrow{8}{{},4,{},{},{},5,{},2}
1984 % \bridgesrow{7}{{},{},1}
1985 % \bridgesrow{5}{{},{},3,{},4}
1986 % \bridgesrow{4}{{},3,{},1,{},2}
1987 % \bridgesrow{3}{{},{},{},{},{},{},{}}
1988 % \bridgesrow{2}{{},2,{},{},5,{},{},2}
1989 % \bridge[double]{\tikzpath{2}{4}{8,8,8,8,6,6,6,6,2,2,2,2}}
1990 % \bridge[double]{\tikzpath{2}{2}{6,6,6,8,8,8,4,4}}
1991 % \bridge{\tikzpath{2}{4}{6,6}}
1992 % \bridge{\tikzpath{3}{5}{8,8}}
1993 % \bridge{\tikzpath{5}{2}{6,6,6,8,8,8,8,8,8,4,4}}
1994 % \end{bridges}
1995 % \end{center}
1996 % \end{figure}
1997 % \iffalse
1998 %<*example>
1999 % \fi
2000 \begin{lstlisting}
2001 \colorlet{LP@c@bridge}{Teal}
2002 \begin{center}
2003 \begin{bridges}
2004 \framepuzzle
2005 \bridgesrow{8}{{},4,{},{},{},5,{},2}
2006 \bridgesrow{7}{{},{},1}
2007 \bridgesrow{5}{{},{},3,{},4}
2008 \bridgesrow{4}{{},3,{},1,{},2}
2009 \bridgesrow{3}{{},{},{},{},{},{},{}}
2010 \bridgesrow{2}{{},2,{},{},5,{},{},2}
2011 \end{bridges}
2012 \hspace{1.5cm}
2013 \begin{bridges}[grid=none]
2014 \framepuzzle
2015 \bridgesrow{8}{{},4,{},{},{},5,{},2}
2016 \bridgesrow{7}{{},{},1}
2017 \bridgesrow{5}{{},{},3,{},4}
2018 \bridgesrow{4}{{},3,{},1,{},2}
2019 \bridgesrow{3}{{},{},{},{},{},{},{}}
2020 \bridgesrow{2}{{},2,{},{},5,{},{},2}
2021 \bridge[double]{\tikzpath{2}{4}{8,8,8,8,6,6,6,6,2,2,2,2}}
2022 \bridge[double]{\tikzpath{2}{2}{6,6,6,8,8,8,4,4}}
2023 \bridge{\tikzpath{2}{4}{6,6}}
2024 \bridge{\tikzpath{3}{5}{8,8}}
2025 \bridge{\tikzpath{5}{2}{6,6,6,8,8,8,8,8,8,4,4}}
2026 \end{bridges}
2027 \end{center}
2028 \end{lstlisting}
2029 % \iffalse
2030 %</example>
2031 % \fi
2032 % \subsubsection{Options}
2033 % \begin{optionlist}
2034 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2035 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2036 % \optitem{\envoption{width}}{6.1cm}{sets the width of the minipage, in which the grid is typeset.}
2037 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2038 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2039 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2040 % \optitem{\envoption{titlewidth}}{6.1cm}{specifies the width of the box the title is set in.}
2041 % \optitem{\envoption{color}}{green}{specifies the color for coloring the islands.}
2042 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2043 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2044 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2045 % \optitem{\envoption{grid}}{dashed}{sets the style of the grid. Possible values: \underline{\texttt{dashed}}, \texttt{none}, \texttt{solid}}
2046 % \end{optionlist}
2047 %
2048 % \subsection{Chaos Sudoku}
2049 % Fill the cells of an area with numbers from 1 to N of the N*N grid. Each number can appear only once - in each area, column, row or diagonal if indicated.
2050 % \subsubsection{Example}
2051 % \begin{figure}[htbp]
2052 % \begin{center}
2053 % \begin{chaossudoku}
2054 % \chaossudokucell{1}{1}{3}
2055 % \chaossudokucell{1}{5}{4}
2056 % \chaossudokucell{3}{2}{4}
2057 % \chaossudokucell{4}{2}{5}
2058 % \chaossudokucell{5}{5}{2}
2059 % \begin{puzzlebackground}
2060 % \fillarea{Wheat}{(1,1)--(1,2)--(2,2)--(2,3)--(4,3)--(4,1)--(1,1)}
2061 % \fillarea{HotPink!30}{(1,2)--(1,6)--(3,6)--(3,5)--(2,5)--(2,2)--(1,2)}
2062 % \fillarea{GreenYellow}{(2,3)--(2,5)--(3,5)--(3,4)--(5,4)--(5,2)--(4,2)--(4,3)--(2,3)}
2063 % \fillarea{LightBlue}{(3,4)--(3,6)--(6,6)--(6,5)--(5,5)--(5,4)--(3,4)}
2064 % \fillarea{LightYellow}{(4,1)--(4,2)--(5,2)--(5,5)--(6,5)--(6,1)--(4,1)}
2065 % \end{puzzlebackground}
2066 % \end{chaossudoku}
2067 % \hspace{1.5cm}
2068 % \begin{chaossudoku}
2069 % \setrow{5}{4,3,5,1,2}
2070 % \setrow{4}{2,1,3,4,5}
2071 % \setrow{3}{5,4,2,3,1}
2072 % \setrow{2}{1,2,4,5,3}
2073 % \setrow{1}{3,5,1,2,4}
2074 % \begin{puzzlebackground}
2075 % \fillarea{Wheat}{\tikzpath{1}{1}{8,6,8,6,6,2,2,4,4,4}}
2076 % \fillarea{HotPink!30}{\tikzpath{1}{2}{8,8,8,8,6,6,2,4,2,2,2,4}}
2077 % \fillarea{GreenYellow}{\tikzpath{2}{3}{8,8,6,2,6,6,2,2,4,8,4,4}}
2078 % \fillarea{LightBlue}{\tikzpath{3}{4}{8,8,6,6,6,2,4,2,4,4}}
2079 % \fillarea{LightYellow}{\tikzpath{4}{1}{8,6,8,8,8,6,2,2,2,2,4,4}}
2080 % \end{puzzlebackground}
2081 % \end{chaossudoku}
2082 % \end{center}
2083 % \end{figure}
2084 % \iffalse
2085 %<*example>
2086 % \fi
2087 \begin{lstlisting}
2088 \begin{center}
2089 \begin{chaossudoku}
2090 \chaossudokucell{1}{1}{3}
2091 \chaossudokucell{1}{5}{4}
2092 \chaossudokucell{3}{2}{4}
2093 \chaossudokucell{4}{2}{5}
2094 \chaossudokucell{5}{5}{2}
2095 \begin{puzzlebackground}
2096 \fillarea{Wheat}{(1,1)--(1,2)--(2,2)--(2,3)--(4,3)--(4,1)
2097 --(1,1)}
2098 \fillarea{HotPink!30}{(1,2)--(1,6)--(3,6)--(3,5)--(2,5)
2099 --(2,2)--(1,2)}
2100 \fillarea{GreenYellow}{(2,3)--(2,5)--(3,5)--(3,4)--(5,4)
2101 --(5,2)--(4,2)--(4,3)--(2,3)}
2102 \fillarea{LightBlue}{(3,4)--(3,6)--(6,6)--(6,5)--(5,5)
2103 --(5,4)--(3,4)}
2104 \fillarea{LightYellow}{(4,1)--(4,2)--(5,2)--(5,5)--(6,5)
2105 --(6,1)--(4,1)}
2106 \end{puzzlebackground}
2107 \end{chaossudoku}
2108 \hspace{1.5cm}
2109 \begin{chaossudoku}
2110 \setrow{5}{4,3,5,1,2}
2111 \setrow{4}{2,1,3,4,5}
2112 \setrow{3}{5,4,2,3,1}
2113 \setrow{2}{1,2,4,5,3}
2114 \setrow{1}{3,5,1,2,4}
2115 \begin{puzzlebackground}
2116 \fillarea{Wheat}{(1,1)--(1,2)--(2,2)--(2,3)--(4,3)--(4,1)
2117 --(1,1)}
2118 \fillarea{HotPink!30}{(1,2)--(1,6)--(3,6)--(3,5)--(2,5)
2119 --(2,2)--(1,2)}
2120 \fillarea{GreenYellow}{(2,3)--(2,5)--(3,5)--(3,4)--(5,4)
2121 --(5,2)--(4,2)--(4,3)--(2,3)}
2122 \fillarea{LightBlue}{(3,4)--(3,6)--(6,6)--(6,5)--(5,5)
2123 --(5,4)--(3,4)}
2124 \fillarea{LightYellow}{(4,1)--(4,2)--(5,2)--(5,5)--(6,5)
2125 --(6,1)--(4,1)}
2126 \end{puzzlebackground}
2127 \end{chaossudoku}
2128 \end{center}
2129 \end{lstlisting}
2130 % \iffalse
2131 %</example>
2132 % \fi
2133 % \subsubsection{Options}
2134 % \begin{optionlist}
2135 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2136 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2137 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2138 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2139 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2140 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2141 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2142 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2143 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2144 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2145 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2146 % \end{optionlist}
2147 %
2148 % \subsection{Four Winds}
2149 % Fill all cells with light rays. These may not intersect. Cells with numbers represent the lighting system that lits horizontally and vertically. The number indicates how many cells are illuminated. Cells with numbers do not count. No cell must remain empty.
2150 %
2151 % \subsubsection{Example}
2152 % \begin{figure}[htbp]
2153 % \begin{center}
2154 % \begin{fourwinds}
2155 % \framepuzzle
2156 % \fourwindscell{1}{2}{2}{}
2157 % \fourwindscell{1}{5}{2}{}
2158 % \fourwindscell{2}{4}{3}{}
2159 % \fourwindscell{3}{3}{3}{}
2160 % \fourwindscell{4}{1}{4}{}
2161 % \fourwindscell{5}{5}{5}{}
2162 % \end{fourwinds}
2163 % \hspace{1.5cm}
2164 % \begin{fourwinds}
2165 % \framepuzzle
2166 % \fourwindscell{1}{2}{2}{2/1,6/1}
2167 % \fourwindscell{1}{5}{2}{2/2}
2168 % \fourwindscell{2}{4}{3}{8/1,6/2}
2169 % \fourwindscell{3}{3}{3}{4/1,6/1,2/1}
2170 % \fourwindscell{4}{1}{4}{4/2,6/1,8/1}
2171 % \fourwindscell{5}{5}{5}{4/2,2/3}
2172 % \end{fourwinds}
2173 % \end{center}
2174 % \end{figure}
2175 % \iffalse
2176 %<*example>
2177 % \fi
2178 \begin{lstlisting}
2179 \begin{fourwinds}
2180 \framepuzzle
2181 \fourwindscell{1}{2}{2}{}
2182 \fourwindscell{1}{5}{2}{}
2183 \fourwindscell{2}{4}{3}{}
2184 \fourwindscell{3}{3}{3}{}
2185 \fourwindscell{4}{1}{4}{}
2186 \fourwindscell{5}{5}{5}{}
2187 \end{fourwinds}
2188 \hspace{1.5cm}
2189 \begin{fourwinds}
2190 \framepuzzle
2191 \fourwindscell{1}{2}{2}{2/1,6/1}
2192 \fourwindscell{1}{5}{2}{2/2}
2193 \fourwindscell{2}{4}{3}{8/1,6/2}
2194 \fourwindscell{3}{3}{3}{4/1,6/1,2/1}
2195 \fourwindscell{4}{1}{4}{4/2,6/1,8/1}
2196 \fourwindscell{5}{5}{5}{4/2,2/3}
2197 \end{fourwinds}
2198 \end{lstlisting}
2199 % \iffalse
2200 %</example>
2201 % \fi
2202 % \subsubsection{Options}
2203 % \begin{optionlist}
2204 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2205 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2206 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2207 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2208 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2209 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2210 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2211 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2212 % \optitem{\envoption{color}}{blue}{sets the color of the lines.}
2213 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2214 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2215 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2216 % \end{optionlist}
2217 %
2218 % \subsection{Hakyuu}
2219 % Fill the cells of an area with numbers from 1 to SIZE of the area. If there are two cells with the same number N in a row or a column, there must be at least N cells between those two cells.
2220 % \subsubsection{Example}
2221 % \begin{figure}[htbp]
2222 % \begin{center}
2223 % \begin{hakyuu}
2224 % \hakyuucell{1}{5}{2}
2225 % \hakyuucell{3}{5}{6}
2226 % \hakyuucell{4}{5}{5}
2227 % \hakyuucell{4}{4}{4}
2228 % \hakyuucell{1}{3}{3}
2229 % \hakyuucell{2}{2}{2}
2230 % \hakyuucell{5}{2}{5}
2231 % \hakyuucell{4}{1}{1}
2232 % \begin{puzzlebackground}
2233 % \fillarea{Wheat}{(1,1)--(1,4)--(2,4)--(2,1)--(1,1)}
2234 % \fillarea{HotPink!30}{(1,4)--(1,6)--(6,6)--(6,5)--(3,5)--(3,4)--(1,4)}
2235 % \fillarea{GreenYellow}{(2,4)--(3,4)--(3,5)--(5,5)--(5,4)--(4,4)--(4,3)--(2,3)--(2,4)}
2236 % \fillarea{LightBlue}{(5,5)--(6,5)--(6,3)--(4,3)--(4,4)--(5,4)--(5,5)}
2237 % \fillarea{LightSalmon!50}{(2,2)--(2,3)--(5,3)--(5,2)--(2,2)}
2238 % \fillarea{LightYellow}{(2,1)--(2,2)--(5,2)--(5,3)--(6,3)--(6,1)--(2,1)}
2239 % \end{puzzlebackground}
2240 % \end{hakyuu}
2241 % \hspace{1.5cm}
2242 % \begin{hakyuu}
2243 % \setrow{5}{2,3,6,5,4}
2244 % \setrow{4}{1,7,3,4,2}
2245 % \setrow{3}{3,1,2,1,3}
2246 % \setrow{2}{1,2,1,3,5}
2247 % \setrow{1}{2,3,4,1,2}
2248 % \begin{puzzlebackground}
2249 % \fillarea{Wheat}{(1,1)--(1,4)--(2,4)--(2,1)--(1,1)}
2250 % \fillarea{HotPink!30}{(1,4)--(1,6)--(6,6)--(6,5)--(3,5)--(3,4)--(1,4)}
2251 % \fillarea{GreenYellow}{(2,4)--(3,4)--(3,5)--(5,5)--(5,4)--(4,4)--(4,3)--(2,3)--(2,4)}
2252 % \fillarea{LightBlue}{(5,5)--(6,5)--(6,3)--(4,3)--(4,4)--(5,4)--(5,5)}
2253 % \fillarea{LightSalmon!50}{(2,2)--(2,3)--(5,3)--(5,2)--(2,2)}
2254 % \fillarea{LightYellow}{(2,1)--(2,2)--(5,2)--(5,3)--(6,3)--(6,1)--(2,1)}
2255 % \end{puzzlebackground}
2256 % \end{hakyuu}
2257 % \end{center}
2258 % \end{figure}
2259 % \iffalse
2260 %<*example>
2261 % \fi
2262 \begin{lstlisting}
2263 \begin{center}
2264 \begin{hakyuu}
2265 \hakyuucell{1}{5}{2}
2266 \hakyuucell{3}{5}{6}
2267 \hakyuucell{4}{5}{5}
2268 \hakyuucell{4}{4}{4}
2269 \hakyuucell{1}{3}{3}
2270 \hakyuucell{2}{2}{2}
2271 \hakyuucell{5}{2}{5}
2272 \hakyuucell{4}{1}{1}
2273 \begin{puzzlebackground}
2274 \fillarea{Wheat}{(1,1)--(1,4)--(2,4)--(2,1)--(1,1)}
2275 \fillarea{HotPink!30}{(1,4)--(1,6)--(6,6)--(6,5)--(3,5)
2276 --(3,4)--(1,4)}
2277 \fillarea{GreenYellow}{(2,4)--(3,4)--(3,5)--(5,5)--(5,4)
2278 --(4,4)--(4,3)--(2,3)--(2,4)}
2279 \fillarea{LightBlue}{(5,5)--(6,5)--(6,3)--(4,3)--(4,4)
2280 --(5,4)--(5,5)}
2281 \fillarea{LightSalmon!50}{(2,2)--(2,3)--(5,3)--(5,2)
2282 --(2,2)}
2283 \fillarea{LightYellow}{(2,1)--(2,2)--(5,2)--(5,3)--(6,3)
2284 --(6,1)--(2,1)}
2285 \end{puzzlebackground}
2286 \end{hakyuu}
2287 \hspace{1.5cm}
2288 \begin{hakyuu}
2289 \setrow{5}{2,3,6,5,4}
2290 \setrow{4}{1,7,3,4,2}
2291 \setrow{3}{3,1,2,1,3}
2292 \setrow{2}{1,2,1,3,5}
2293 \setrow{1}{2,3,4,1,2}
2294 \begin{puzzlebackground}
2295 \fillarea{Wheat}{(1,1)--(1,4)--(2,4)--(2,1)--(1,1)}
2296 \fillarea{HotPink!30}{(1,4)--(1,6)--(6,6)--(6,5)--(3,5)
2297 --(3,4)--(1,4)}
2298 \fillarea{GreenYellow}{(2,4)--(3,4)--(3,5)--(5,5)--(5,4)
2299 --(4,4)--(4,3)--(2,3)--(2,4)}
2300 \fillarea{LightBlue}{(5,5)--(6,5)--(6,3)--(4,3)--(4,4)
2301 --(5,4)--(5,5)}
2302 \fillarea{LightSalmon!50}{(2,2)--(2,3)--(5,3)--(5,2)
2303 --(2,2)}
2304 \fillarea{LightYellow}{(2,1)--(2,2)--(5,2)--(5,3)--(6,3)
2305 --(6,1)--(2,1)}
2306 \end{puzzlebackground}
2307 \end{hakyuu}
2308 \end{center}
2309 \end{lstlisting}
2310 % \iffalse
2311 %</example>
2312 % \fi
2313 % \subsubsection{Options}
2314 % \begin{optionlist}
2315 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2316 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2317 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2318 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2319 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2320 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2321 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2322 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2323 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2324 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2325 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2326 % \end{optionlist}
2327 %
2328 % \subsection{Hitori}
2329 % Black out some cells according to these specifications: In each row and each column a number may only occur once or can be completely blackened. The blackened cells can touch neither horizontal nor vertical. All non blackened cells must remain connected. Each number has its own color, which otherwise has no meaning.
2330 % \subsubsection{Example}
2331 % \begin{figure}[htbp]
2332 % \begin{center}
2333 % \begin{hitori}
2334 % \framepuzzle
2335 % \setcolorrow{5}{2,4,2,1,1}
2336 % \setcolorrow{4}{1,3,2,4,1}
2337 % \setcolorrow{3}{1,3,3,3,2}
2338 % \setcolorrow{2}{4,2,1,3,3}
2339 % \setcolorrow{1}{4,1,2,2,3}
2340 % \end{hitori}
2341 % \hspace{1.5cm}
2342 % \begin{hitori}
2343 % \framepuzzle
2344 % \setcolorrow{5}{2,4,0,1,0}
2345 % \setcolorrow{4}{0,3,2,4,1}
2346 % \setcolorrow{3}{1,0,3,0,2}
2347 % \setcolorrow{2}{4,2,1,3,0}
2348 % \setcolorrow{1}{0,1,0,2,3}
2349 % \end{hitori}
2350 % \end{center}
2351 % \end{figure}
2352 % \iffalse
2353 %<*example>
2354 % \fi
2355 \begin{lstlisting}
2356 \begin{center}
2357 \begin{hitori}
2358 \framepuzzle
2359 \setcolorrow{5}{2,4,2,1,1}
2360 \setcolorrow{4}{1,3,2,4,1}
2361 \setcolorrow{3}{1,3,3,3,2}
2362 \setcolorrow{2}{4,2,1,3,3}
2363 \setcolorrow{1}{4,1,2,2,3}
2364 \end{hitori}
2365 \hspace{1.5cm}
2366 \begin{hitori}
2367 \framepuzzle
2368 \setcolorrow{5}{2,4,0,1,0}
2369 \setcolorrow{4}{0,3,2,4,1}
2370 \setcolorrow{3}{1,0,3,0,2}
2371 \setcolorrow{2}{4,2,1,3,0}
2372 \setcolorrow{1}{0,1,0,2,3}
2373 \end{hitori}
2374 \end{center}
2375 \end{lstlisting}
2376 % \iffalse
2377 %</example>
2378 % \fi
2379 % \subsubsection{Options}
2380 % \begin{optionlist}
2381 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2382 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2383 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2384 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2385 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2386 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2387 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2388 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2389 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2390 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2391 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2392 % \end{optionlist}
2393 %
2394 % \subsection{Kakuro}
2395 % Enter numbers from 1 to 9 in any order into the blank cells. Here, the given horizontal and vertical sums should result. The zero does not occur. Within a summation, no number can be repeated.
2396 % \subsubsection{Example}
2397 % \definecolor{kakuro}{RGB}{155,206,167}
2398 % \kakurosetup{color=kakuro}
2399 % \begin{figure}[htbp]
2400 % \begin{center}
2401 % \begin{kakuro}
2402 % \framepuzzle
2403 % \kakurorow{5}{\Black,\KKR{23}{},\KKR{16}{},\KKR{10}{},\Black}
2404 % \kakurorow{4}{\KKR{}{14},9,1,4,\KKR{3}{}}
2405 % \kakurorow{3}{\KKR{}{16},6,5,3,2}
2406 % \kakurorow{2}{\KKR{}{14},8,3,2,1}
2407 % \kakurorow{1}{\Black,\KKR{}{8},7,1,\Black}
2408 % \end{kakuro}
2409 % \hspace{1.5cm}
2410 % \begin{kakuro}[solution]
2411 % \framepuzzle
2412 % \kakurorow{5}{\Black,\KKR{23}{},\KKR{16}{},\KKR{10}{},\Black}
2413 % \kakurorow{4}{\KKR{}{14},9,1,4,\KKR{3}{}}
2414 % \kakurorow{3}{\KKR{}{16},6,5,3,2}
2415 % \kakurorow{2}{\KKR{}{14},8,3,2,1}
2416 % \kakurorow{1}{\Black,\KKR{}{8},7,1,\Black}
2417 % \end{kakuro}
2418 % \end{center}
2419 % \end{figure}
2420 % \iffalse
2421 %<*example>
2422 % \fi
2423 \begin{lstlisting}
2424 \definecolor{kakuro}{RGB}{155,206,167}
2425 \kakurosetup{color=kakuro}
2426 \begin{center}
2427 \begin{kakuro}
2428 \framepuzzle
2429 \kakurorow{5}{\Black,\KKR{23}{},\KKR{16}{},\KKR{10}{},\Black}
2430 \kakurorow{4}{\KKR{}{14},9,1,4,\KKR{3}{}}
2431 \kakurorow{3}{\KKR{}{16},6,5,3,2}
2432 \kakurorow{2}{\KKR{}{14},8,3,2,1}
2433 \kakurorow{1}{\Black,\KKR{}{8},7,1,\Black}
2434 \end{kakuro}
2435 \hspace{1.5cm}
2436 \begin{kakuro}[solution]
2437 \framepuzzle
2438 \kakurorow{5}{\Black,\KKR{23}{},\KKR{16}{},\KKR{10}{},\Black}
2439 \kakurorow{4}{\KKR{}{14},9,1,4,\KKR{3}{}}
2440 \kakurorow{3}{\KKR{}{16},6,5,3,2}
2441 \kakurorow{2}{\KKR{}{14},8,3,2,1}
2442 \kakurorow{1}{\Black,\KKR{}{8},7,1,\Black}
2443 \end{kakuro}
2444 \end{center}
2445 \end{lstlisting}
2446 % \iffalse
2447 %</example>
2448 % \fi
2449 % \subsubsection{Options}
2450 % \begin{optionlist}
2451 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2452 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2453 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2454 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2455 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2456 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2457 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2458 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2459 % \optitem{\envoption{color}}{green}{specifies the color of the kakuro cells.}
2460 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2461 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2462 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2463 % \optitem{\envoption{solution}}{false}{You can use the solution also for the puzzle, as the numbers in the cells are only typeset with option \envoption{solution}\texttt{=true}.}
2464 % \end{optionlist}
2465 %
2466 % \subsection{Kendoku}
2467 % Fill the cells with the numbers from 1 to SIZE of the puzzle. In the top left corner of a framed area, you will find the result of the specified arithmetic function, which is applied on the entered numbers. The numbers may occur only once in each row and column. The numbers of an area may not necessarily be different when they are in different rows or columns.
2468 % \subsubsection{Example}
2469 % \begin{figure}[htbp]
2470 % \begin{center}
2471 % \begin{kendoku}
2472 % \framearea{black}{\tikzpath{1}{1}{8,8,6,2,6,2,4,4}}
2473 % \framearea{black}{\tikzpath{1}{3}{8,6,2,4}}
2474 % \framearea{black}{\tikzpath{1}{4}{8,8,6,2,2,4}}
2475 % \framearea{black}{\tikzpath{2}{2}{8,8,6,6,2,4,2,4}}
2476 % \framearea{black}{\tikzpath{2}{4}{8,8,6,2,2,4}}
2477 % \framearea{black}{\tikzpath{3}{1}{8,8,6,2,2,4}}
2478 % \framearea{black}{\tikzpath{3}{4}{8,8,6,6,2,4,2,4}}
2479 % \framearea{black}{\tikzpath{4}{1}{8,6,6,2,4,4}}
2480 % \framearea{black}{\tikzpath{4}{2}{8,6,6,2,4,4}}
2481 % \framearea{black}{\tikzpath{4}{3}{8,8,6,2,2,4}}
2482 % \framearea{black}{\tikzpath{5}{3}{8,6,2,4}}
2483 % \framearea{black}{\tikzpath{5}{4}{8,6,2,4}}
2484 % \framearea{black}{\tikzpath{5}{5}{8,6,2,4}}
2485 % \setrule{1}{2}{8\times}
2486 % \setrule{1}{3}{5}
2487 % \setrule{1}{5}{4+}
2488 % \setrule{2}{3}{60\times}
2489 % \setrule{2}{5}{2\div}
2490 % \setrule{3}{2}{2-}
2491 % \setrule{3}{5}{75\times}
2492 % \setrule{4}{1}{8+}
2493 % \setrule{4}{2}{1-}
2494 % \setrule{4}{4}{2\times}
2495 % \setrule{5}{3}{1}
2496 % \setrule{5}{5}{2}
2497 % \end{kendoku}
2498 % \hspace{1.5cm}
2499 % \begin{kendoku}
2500 % \framearea{black}{\tikzpath{1}{1}{8,8,6,2,6,2,4,4}}
2501 % \framearea{black}{\tikzpath{1}{3}{8,6,2,4}}
2502 % \framearea{black}{\tikzpath{1}{4}{8,8,6,2,2,4}}
2503 % \framearea{black}{\tikzpath{2}{2}{8,8,6,6,2,4,2,4}}
2504 % \framearea{black}{\tikzpath{2}{4}{8,8,6,2,2,4}}
2505 % \framearea{black}{\tikzpath{3}{1}{8,8,6,2,2,4}}
2506 % \framearea{black}{\tikzpath{3}{4}{8,8,6,6,2,4,2,4}}
2507 % \framearea{black}{\tikzpath{4}{1}{8,6,6,2,4,4}}
2508 % \framearea{black}{\tikzpath{4}{2}{8,6,6,2,4,4}}
2509 % \framearea{black}{\tikzpath{4}{3}{8,8,6,2,2,4}}
2510 % \framearea{black}{\tikzpath{5}{3}{8,6,2,4}}
2511 % \framearea{black}{\tikzpath{5}{4}{8,6,2,4}}
2512 % \framearea{black}{\tikzpath{5}{5}{8,6,2,4}}
2513 % \setrule{1}{2}{8\times}
2514 % \setrule{1}{3}{5}
2515 % \setrule{1}{5}{4+}
2516 % \setrule{2}{3}{60\times}
2517 % \setrule{2}{5}{2\div}
2518 % \setrule{3}{2}{2-}
2519 % \setrule{3}{5}{75\times}
2520 % \setrule{4}{1}{8+}
2521 % \setrule{4}{2}{1-}
2522 % \setrule{4}{4}{2\times}
2523 % \setrule{5}{3}{1}
2524 % \setrule{5}{5}{2}
2525 % \setrow{5}{1,4,3,5,2}
2526 % \setrow{4}{3,2,5,1,4}
2527 % \setrow{3}{5,3,4,2,1}
2528 % \setrow{2}{2,5,1,4,3}
2529 % \setrow{1}{4,1,2,3,5}
2530 % \end{kendoku}
2531 % \end{center}
2532 % \end{figure}
2533 % \iffalse
2534 %<*example>
2535 % \fi
2536 \begin{lstlisting}
2537 \begin{center}
2538 \begin{kendoku}
2539 \framearea{black}{\tikzpath{1}{1}{8,8,6,2,6,2,4,4}}
2540 \framearea{black}{\tikzpath{1}{3}{8,6,2,4}}
2541 \framearea{black}{\tikzpath{1}{4}{8,8,6,2,2,4}}
2542 \framearea{black}{\tikzpath{2}{2}{8,8,6,6,2,4,2,4}}
2543 \framearea{black}{\tikzpath{2}{4}{8,8,6,2,2,4}}
2544 \framearea{black}{\tikzpath{3}{1}{8,8,6,2,2,4}}
2545 \framearea{black}{\tikzpath{3}{4}{8,8,6,6,2,4,2,4}}
2546 \framearea{black}{\tikzpath{4}{1}{8,6,6,2,4,4}}
2547 \framearea{black}{\tikzpath{4}{2}{8,6,6,2,4,4}}
2548 \framearea{black}{\tikzpath{4}{3}{8,8,6,2,2,4}}
2549 \framearea{black}{\tikzpath{5}{3}{8,6,2,4}}
2550 \framearea{black}{\tikzpath{5}{4}{8,6,2,4}}
2551 \framearea{black}{\tikzpath{5}{5}{8,6,2,4}}
2552 \setrule{1}{2}{8\times}
2553 \setrule{1}{3}{5}
2554 \setrule{1}{5}{4+}
2555 \setrule{2}{3}{60\times}
2556 \setrule{2}{5}{2\div}
2557 \setrule{3}{2}{2-}
2558 \setrule{3}{5}{75\times}
2559 \setrule{4}{1}{8+}
2560 \setrule{4}{2}{1-}
2561 \setrule{4}{4}{2\times}
2562 \setrule{5}{3}{1}
2563 \setrule{5}{5}{2}
2564 \end{kendoku}
2565 \hspace{1.5cm}
2566 \begin{kendoku}
2567 \framearea{black}{\tikzpath{1}{1}{8,8,6,2,6,2,4,4}}
2568 \framearea{black}{\tikzpath{1}{3}{8,6,2,4}}
2569 \framearea{black}{\tikzpath{1}{4}{8,8,6,2,2,4}}
2570 \framearea{black}{\tikzpath{2}{2}{8,8,6,6,2,4,2,4}}
2571 \framearea{black}{\tikzpath{2}{4}{8,8,6,2,2,4}}
2572 \framearea{black}{\tikzpath{3}{1}{8,8,6,2,2,4}}
2573 \framearea{black}{\tikzpath{3}{4}{8,8,6,6,2,4,2,4}}
2574 \framearea{black}{\tikzpath{4}{1}{8,6,6,2,4,4}}
2575 \framearea{black}{\tikzpath{4}{2}{8,6,6,2,4,4}}
2576 \framearea{black}{\tikzpath{4}{3}{8,8,6,2,2,4}}
2577 \framearea{black}{\tikzpath{5}{3}{8,6,2,4}}
2578 \framearea{black}{\tikzpath{5}{4}{8,6,2,4}}
2579 \framearea{black}{\tikzpath{5}{5}{8,6,2,4}}
2580 \setrule{1}{2}{8\times}
2581 \setrule{1}{3}{5}
2582 \setrule{1}{5}{4+}
2583 \setrule{2}{3}{60\times}
2584 \setrule{2}{5}{2\div}
2585 \setrule{3}{2}{2-}
2586 \setrule{3}{5}{75\times}
2587 \setrule{4}{1}{8+}
2588 \setrule{4}{2}{1-}
2589 \setrule{4}{4}{2\times}
2590 \setrule{5}{3}{1}
2591 \setrule{5}{5}{2}
2592 \setrow{5}{1,4,3,5,2}
2593 \setrow{4}{3,2,5,1,4}
2594 \setrow{3}{5,3,4,2,1}
2595 \setrow{2}{2,5,1,4,3}
2596 \setrow{1}{4,1,2,3,5}
2597 \end{kendoku}
2598 \end{center}
2599 \end{lstlisting}
2600 % \iffalse
2601 %</example>
2602 % \fi
2603 % \subsubsection{Options}
2604 % \begin{optionlist}
2605 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2606 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2607 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2608 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2609 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2610 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2611 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2612 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2613 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2614 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2615 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2616 % \end{optionlist}
2617 %
2618 % \subsection{Killer Sudoku}
2619 % Fill the cells with the numbers from 1 to SIZE of the puzzle. The numbers may occur only once in each row, column and colored area if specified. In the top left corner of a framed area, you will find the sum of the entered numbers. The numbers of an area may not necessarily be different, when they are in different rows or columns. But they must be different, when additional colored areas are specified.
2620 % \subsubsection{Example}
2621 % \begin{figure}[htbp]
2622 % \begin{center}
2623 % \begin{killersudoku}[columns=4,rows=4,scale=1.11]
2624 % \framearea{black}{\tikzpath{1}{1}{8,8,6,6,2,4,2,4}}
2625 % \framearea{black}{\tikzpath{1}{3}{8,8,6,2,2,4}}
2626 % \framearea{black}{\tikzpath{2}{1}{8,6,6,6,2,4,4,4}}
2627 % \framearea{black}{\tikzpath{2}{3}{8,8,6,2,6,2,4,4}}
2628 % \framearea{black}{\tikzpath{3}{2}{8,6,8,6,2,2,4,4}}
2629 % \framearea{black}{\tikzpath{3}{4}{8,6,6,2,4,4}}
2630 % \begin{puzzlebackground}
2631 % \colorarea{orange!20}{\tikzpath{1}{1}{8,8,6,6,2,2,4,4}}
2632 % \colorarea{orange!20}{\tikzpath{3}{3}{8,8,6,6,2,2,4,4}}
2633 % \end{puzzlebackground}
2634 % \setrule{1}{2}{7}
2635 % \setrule{1}{4}{7}
2636 % \setrule{2}{1}{9}
2637 % \setrule{2}{4}{6}
2638 % \setrule{3}{4}{5}
2639 % \setrule{4}{3}{6}
2640 % \end{killersudoku}
2641 % \hspace{1.5cm}
2642 % \begin{killersudoku}[columns=4,rows=4,scale=1.11]
2643 % \framearea{black}{\tikzpath{1}{1}{8,8,6,6,2,4,2,4}}
2644 % \framearea{black}{\tikzpath{1}{3}{8,8,6,2,2,4}}
2645 % \framearea{black}{\tikzpath{2}{1}{8,6,6,6,2,4,4,4}}
2646 % \framearea{black}{\tikzpath{2}{3}{8,8,6,2,6,2,4,4}}
2647 % \framearea{black}{\tikzpath{3}{2}{8,6,8,6,2,2,4,4}}
2648 % \framearea{black}{\tikzpath{3}{4}{8,6,6,2,4,4}}
2649 % \begin{puzzlebackground}
2650 % \colorarea{orange!20}{\tikzpath{1}{1}{8,8,6,6,2,2,4,4}}
2651 % \colorarea{orange!20}{\tikzpath{3}{3}{8,8,6,6,2,2,4,4}}
2652 % \end{puzzlebackground}
2653 % \setrule{1}{2}{7}
2654 % \setrule{1}{4}{7}
2655 % \setrule{2}{1}{9}
2656 % \setrule{2}{4}{6}
2657 % \setrule{3}{4}{5}
2658 % \setrule{4}{3}{6}
2659 % \setrow{4}{3,2,4,1}
2660 % \setrow{3}{4,1,3,2}
2661 % \setrow{2}{2,4,1,3}
2662 % \setrow{1}{1,3,2,4}
2663 % \end{killersudoku}
2664 % \end{center}
2665 % \end{figure}
2666 % \iffalse
2667 %<*example>
2668 % \fi
2669 \begin{lstlisting}
2670 \begin{killersudoku}
2671 \framearea{black}{\tikzpath{1}{1}{8,8,6,6,2,4,2,4}}
2672 \framearea{black}{\tikzpath{1}{3}{8,8,6,2,2,4}}
2673 \framearea{black}{\tikzpath{2}{1}{8,6,6,6,2,4,4,4}}
2674 \framearea{black}{\tikzpath{2}{3}{8,8,6,2,6,2,4,4}}
2675 \framearea{black}{\tikzpath{3}{2}{8,6,8,6,2,2,4,4}}
2676 \framearea{black}{\tikzpath{3}{4}{8,6,6,2,4,4}}
2677 \begin{puzzlebackground}
2678 \colorarea{orange!20}{\tikzpath{1}{1}{8,8,6,6,2,2,4,4}}
2679 \colorarea{orange!20}{\tikzpath{3}{3}{8,8,6,6,2,2,4,4}}
2680 \end{puzzlebackground}
2681 \setrule{1}{2}{7}
2682 \setrule{1}{4}{7}
2683 \setrule{2}{1}{9}
2684 \setrule{2}{4}{6}
2685 \setrule{3}{4}{5}
2686 \setrule{4}{3}{6}
2687 \end{killersudoku}
2688 \hspace{1.5cm}
2689 \begin{killersudoku}
2690 \framearea{black}{\tikzpath{1}{1}{8,8,6,6,2,4,2,4}}
2691 \framearea{black}{\tikzpath{1}{3}{8,8,6,2,2,4}}
2692 \framearea{black}{\tikzpath{2}{1}{8,6,6,6,2,4,4,4}}
2693 \framearea{black}{\tikzpath{2}{3}{8,8,6,2,6,2,4,4}}
2694 \framearea{black}{\tikzpath{3}{2}{8,6,8,6,2,2,4,4}}
2695 \framearea{black}{\tikzpath{3}{4}{8,6,6,2,4,4}}
2696 \begin{puzzlebackground}
2697 \colorarea{orange!20}{\tikzpath{1}{1}{8,8,6,6,2,2,4,4}}
2698 \colorarea{orange!20}{\tikzpath{3}{3}{8,8,6,6,2,2,4,4}}
2699 \end{puzzlebackground}
2700 \setrule{1}{2}{7}
2701 \setrule{1}{4}{7}
2702 \setrule{2}{1}{9}
2703 \setrule{2}{4}{6}
2704 \setrule{3}{4}{5}
2705 \setrule{4}{3}{6}
2706 \setrow{4}{3,2,4,1}
2707 \setrow{3}{4,1,3,2}
2708 \setrow{2}{2,4,1,3}
2709 \setrow{1}{1,3,2,4}
2710 \end{killersudoku}
2711 \end{lstlisting}
2712 % \iffalse
2713 %</example>
2714 % \fi
2715 % \subsubsection{Options}
2716 % \begin{optionlist}
2717 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2718 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2719 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2720 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2721 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2722 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2723 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2724 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2725 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2726 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2727 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2728 % \end{optionlist}
2729 %
2730 % \subsection{Laser Beam}
2731 % Draw a laser beam in each grid according to the following guidelines. The beam has to enter or to leave the grid at the arrows. At each intersection, a mirror, on which the laser beam must reflect on one side, can be placed horizontally or vertically. The other side must not be touched by the beam. All locations where the laser crosses are given. The numbers to the left and above the grid indicate how many cells are traversed by the beam in the corresponding row or column. The numbers to the right and below reveal, how many mirrors are found in the intersection of the corresponding row or column.
2732 % \subsubsection{Example}
2733 % \begin{figure}[htbp]
2734 % \begin{center}
2735 % \begin{laserbeam}
2736 % \laserV{1}
2737 % \laserH{{}}
2738 % \mirrorH{{},2}
2739 % \mirrorV{{},{},{},{},{},2}
2740 % \framepuzzle[LP@c@mirror]
2741 % \placearrow{3}{1}{LeftUp}
2742 % \placearrow{6}{4}{RightUp}
2743 % \placecross{3}{3}
2744 % \end{laserbeam}
2745 % \hspace{1.5cm}
2746 % \begin{laserbeam}
2747 % \laserV{1}
2748 % \laserH{{}}
2749 % \mirrorH{{},2}
2750 % \mirrorV{{},{},{},{},{},2}
2751 % \framepuzzle[LP@c@mirror]
2752 % \placearrow{3}{1}{LeftUp}
2753 % \placearrow{6}{4}{RightUp}
2754 % \placecross{3}{3}
2755 % \placemirror{2}{2}{V}
2756 % \placemirror{4}{2}{H}
2757 % \placemirror{5}{5}{V}
2758 % \placemirror{3}{5}{H}
2759 % \begin{puzzlebackground}
2760 % \laser{\tikzpath{3}{1}{7,9,9,9,7,1,7,1,3,3,3,9,9}}
2761 % \end{puzzlebackground}
2762 % \end{laserbeam}
2763 % \end{center}
2764 % \end{figure}
2765 % \iffalse
2766 %<*example>
2767 % \fi
2768 \begin{lstlisting}
2769 \begin{center}
2770 \begin{laserbeam}
2771 \laserV{1}
2772 \laserH{{}}
2773 \mirrorH{{},2}
2774 \mirrorV{{},{},{},{},{},2}
2775 \framepuzzle[LP@c@mirror]
2776 \placearrow{3}{1}{LeftUp}
2777 \placearrow{6}{4}{RightUp}
2778 \placecross{3}{3}
2779 \end{laserbeam}
2780 \hspace{1cm}
2781 \begin{laserbeam}
2782 \laserV{1}
2783 \laserH{{}}
2784 \mirrorH{{},2}
2785 \mirrorV{{},{},{},{},{},2}
2786 \framepuzzle[LP@c@mirror]
2787 \placearrow{3}{1}{LeftUp}
2788 \placearrow{6}{4}{RightUp}
2789 \placecross{3}{3}
2790 \placemirror{2}{2}{V}
2791 \placemirror{4}{2}{H}
2792 \placemirror{5}{5}{V}
2793 \placemirror{3}{5}{H}
2794 \begin{puzzlebackground}
2795 \laser{\tikzpath{3}{1}{7,9,9,9,7,1,7,1,3,3,3,9,9}}
2796 \end{puzzlebackground}
2797 \end{laserbeam}
2798 \end{center}
2799 \end{lstlisting}
2800 % \iffalse
2801 %</example>
2802 % \fi
2803 % \subsubsection{Options}
2804 % \begin{optionlist}
2805 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2806 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2807 % \optitem{\envoption{width}}{6.5cm}{sets the width of the minipage, in which the grid is typeset.}
2808 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2809 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2810 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2811 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2812 % \optitem{\envoption{titlewidth}}{6.5cm}{specifies the width of the box the title is set in.}
2813 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2814 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2815 % \optitem{\envoption{cvoffset}}{-38pt}{sets the vertical offset of the counters in the margin.}
2816 % \end{optionlist}
2817 %
2818 % \subsection{Magic Labyrinth}
2819 % Enter the numbers 1 to N into the grid. Each number can appear only once in each column and row. Following the labyrinth from the outside inwards, then the given number sequence must be repeated continuously.
2820 % \subsubsection{Example}
2821 % \begin{figure}[htbp]
2822 % \begin{center}
2823 % \begin{magiclabyrinth}
2824 % \mlline{\xtikzpath{1}{6}{6/5,2/5,4/5,8/4,6/4,2/3,4/3,8/2,6/2,2/1,4/1}}
2825 % \setcells{1/1,2/4,4/5}{3}
2826 % \magiclabyrinthcell{4}{2}{2}
2827 % \magiclabyrinthcell{5}{4}{1}
2828 % \end{magiclabyrinth}
2829 % \hspace{1.5cm}
2830 % \begin{magiclabyrinth}
2831 % \mlline{\xtikzpath{1}{6}{6/5,2/5,4/5,8/4,6/4,2/3,4/3,8/2,6/2,2/1,4/1}}
2832 % \setrow{5}{{},1,2,3}
2833 % \setrow{4}{2,3,{},{},1}
2834 % \setrow{3}{{},{},3,1,2}
2835 % \setrow{2}{1,{},{},2,3}
2836 % \setrow{1}{3,2,1}
2837 % \end{magiclabyrinth}
2838 % \end{center}
2839 % \end{figure}
2840 % \iffalse
2841 %<*example>
2842 % \fi
2843 \begin{lstlisting}
2844 \begin{magiclabyrinth}
2845 \mlline{\xtikzpath{1}{6}{6/5,2/5,4/5,8/4,6/4,2/3,4/3,8/2,6/2,
2846 2/1,4/1}}
2847 \setcells{1/1,2/4,4/5}{3}
2848 \magiclabyrinthcell{4}{2}{2}
2849 \magiclabyrinthcell{5}{4}{1}
2850 \end{magiclabyrinth}
2851 \hspace{1.5cm}
2852 \begin{magiclabyrinth}
2853 \mlline{\xtikzpath{1}{6}{6/5,2/5,4/5,8/4,6/4,2/3,4/3,8/2,6/2,
2854 2/1,4/1}}
2855 \setrow{5}{{},1,2,3}
2856 \setrow{4}{2,3,{},{},1}
2857 \setrow{3}{{},{},3,1,2}
2858 \setrow{2}{1,{},{},2,3}
2859 \setrow{1}{3,2,1}
2860 \end{magiclabyrinth}
2861 \end{lstlisting}
2862 % \iffalse
2863 %</example>
2864 % \fi
2865 % \subsubsection{Options}
2866 % \begin{optionlist}
2867 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2868 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2869 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2870 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2871 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2872 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2873 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2874 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
2875 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
2876 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2877 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2878 % \end{optionlist}
2879 %
2880 % \subsection{Magnets}
2881 % Draw magnetic and neutral plates into the grid. The magnetic plates have a positive and a negative pole, neutral plates do not. The same poles must not touch neither horizontal nor vertical. Neutral plates may touch. The numbers to the left and above the grid indicate how many plus or minus poles are present in the respective column or row.
2882 % \subsubsection{Example}
2883 % \begin{figure}[htbp]
2884 % \begin{center}
2885 % \begin{magnets}
2886 % \minusH{2,1,2,2,1,2}
2887 % \minusV{2,1,3,1,2,1}
2888 % \plusH{2,1,2,2,2,1}
2889 % \plusV{1,2,1,3,2,1}
2890 % \magnetsH{2/1,2/4,2/5,2/6,3/2,3/3,4/1,4/4,5/5,5/6}
2891 % \magnetsV{1/1,1/3,1/5,2/2,4/5,5/2,6/1,6/3}
2892 % \MPH{2/6}
2893 % \PMH{5/5}
2894 % \MPV{6/3}
2895 % \end{magnets}
2896 % \hspace{1.5cm}
2897 % \begin{magnets}
2898 % \minusH{2,1,2,2,1,2}
2899 % \minusV{2,1,3,1,2,1}
2900 % \plusH{2,1,2,2,2,1}
2901 % \plusV{1,2,1,3,2,1}
2902 % \MPH{2/6,3/2,4/1}
2903 % \PMH{2/5,5/5,4/4,3/3}
2904 % \MPV{1/1,1/3,6/3}
2905 % \end{magnets}
2906 % \end{center}
2907 % \end{figure}
2908 % \iffalse
2909 %<*example>
2910 % \fi
2911 \begin{lstlisting}
2912 \magnetssetup{bgcolor=Teal!50}
2913 \begin{magnets}
2914 \minusH{2,1,2,2,1,2}
2915 \minusV{2,1,3,1,2,1}
2916 \plusH{2,1,2,2,2,1}
2917 \plusV{1,2,1,3,2,1}
2918 \magnetsH{2/1,2/4,2/5,2/6,3/2,3/3,4/1,4/4,5/5,5/6}
2919 \magnetsV{1/1,1/3,1/5,2/2,4/5,5/2,6/1,6/3}
2920 \MPH{2/6}
2921 \PMH{5/5}
2922 \MPV{6/3}
2923 \end{magnets}
2924 \hspace{1.5cm}
2925 \begin{magnets}
2926 \minusH{2,1,2,2,1,2}
2927 \minusV{2,1,3,1,2,1}
2928 \plusH{2,1,2,2,2,1}
2929 \plusV{1,2,1,3,2,1}
2930 \MPH{2/6,3/2,4/1}
2931 \PMH{2/5,5/5,4/4,3/3}
2932 \MPV{1/1,1/3,6/3}
2933 \end{magnets}
2934 \end{lstlisting}
2935 % \iffalse
2936 %</example>
2937 % \fi
2938 % \subsubsection{Options}
2939 % \begin{optionlist}
2940 % \optitem{\envoption{rows}}{6}{defines the number of rows in the grid.}
2941 % \optitem{\envoption{columns}}{6}{specifies the number of columns in the grid}
2942 % \optitem{\envoption{width}}{8.1cm}{sets the width of the minipage, in which the grid is typeset.}
2943 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
2944 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
2945 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
2946 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
2947 % \optitem{\envoption{titlewidth}}{8.1cm}{specifies the width of the box the title is set in.}
2948 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid for indicating the neutral areas.}
2949 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
2950 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
2951 % \end{optionlist}
2952 %
2953 % \subsection{Masyu}
2954 % Draw a line into the grid. The line can only run horizontally and vertically and must pass through all the circles. In cells with a black circle it have to turn in a 90 degree angle and go straight on for at least another cell. The line must go straight through empty circles, but turn left or right in at least one of the neighboring cells. There is no need to go through all cells.
2955 % \subsubsection{Example}
2956 % \begin{figure}[htbp]
2957 % \begin{center}
2958 % \begin{masyu}
2959 % \framepuzzle
2960 % \setcells{1/2,3/3,4/1,4/2,4/5,5/4}{\MasyuW}
2961 % \masyucell{1}{4}{\MasyuB}
2962 % \end{masyu}
2963 % \hspace{1.5cm}
2964 % \begin{masyu}
2965 % \framepuzzle
2966 % \setcells{1/2,3/3,4/1,4/2,4/5,5/4}{\MasyuW}
2967 % \masyucell{1}{4}{\MasyuB}
2968 % \masyuline{\xtikzpath{1}{1}{8/3,6/2,8/1,6/2,2/2,4/3,2/1,6/3,2/1,4/4}}
2969 % \end{masyu}
2970 % \end{center}
2971 % \end{figure}
2972 % \iffalse
2973 %<*example>
2974 % \fi
2975 \begin{lstlisting}
2976 \masyusetup{color=Teal}
2977 \begin{masyu}
2978 \framepuzzle
2979 \setcells{1/2,3/3,4/1,4/2,4/5,5/4}{\MasyuW}
2980 \masyucell{1}{4}{\MasyuB}
2981 \end{masyu}
2982 \hspace{1.5cm}
2983 \begin{masyu}
2984 \framepuzzle
2985 \setcells{1/2,3/3,4/1,4/2,4/5,5/4}{\MasyuW}
2986 \masyucell{1}{4}{\MasyuB}
2987 \masyuline{\xtikzpath{1}{1}{8/3,6/2,8/1,6/2,2/2,4/3,2/1,6/3,
2988 2/1,4/4}}
2989 \end{masyu}
2990 \end{lstlisting}
2991 % \iffalse
2992 %</example>
2993 % \fi
2994 % \subsubsection{Options}
2995 % \begin{optionlist}
2996 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
2997 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
2998 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
2999 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3000 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3001 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3002 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3003 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3004 % \optitem{\envoption{color}}{green}{sets the color of the line.}
3005 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3006 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3007 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3008 % \end{optionlist}
3009 %
3010 % \subsection{Minesweeper}
3011 % Draw a mine in some cells of the grid. The number in a cell indicates how many of the eight neighboring cells contain a mine. A numbered cell does not contain a mine.
3012 % \subsubsection{Example}
3013 % \begin{figure}[htbp]
3014 % \begin{center}
3015 % \begin{minesweeper}
3016 % \framepuzzle
3017 % \setrow{5}{{},1}
3018 % \setrow{4}{{},{},3,3}
3019 % \setrow{3}{3,{},4,2}
3020 % \setrow{2}{{},{},{},{},0}
3021 % \setrow{1}{{},2}
3022 % \end{minesweeper}
3023 % \hspace{1.5cm}
3024 % \begin{minesweeper}
3025 % \framepuzzle
3026 % \setrow{5}{{},1,{},\Mine,\Mine}
3027 % \setrow{4}{{},\Mine,3,3,\Mine}
3028 % \setrow{3}{3,\Mine,4,2}
3029 % \setrow{2}{{},\Mine,\Mine,{},0}
3030 % \setrow{1}{{},2}
3031 % \end{minesweeper}
3032 % \end{center}
3033 % \end{figure}
3034 % \iffalse
3035 %<*example>
3036 % \fi
3037 \begin{lstlisting}
3038 \begin{center}
3039 \begin{minesweeper}
3040 \framepuzzle
3041 \setrow{5}{{},1}
3042 \setrow{4}{{},{},3,3}
3043 \setrow{3}{3,{},4,2}
3044 \setrow{2}{{},{},{},{},0}
3045 \setrow{1}{{},2}
3046 \end{minesweeper}
3047 \hspace{1.5cm}
3048 \begin{minesweeper}
3049 \framepuzzle
3050 \setrow{5}{{},1,{},\Mine,\Mine}
3051 \setrow{4}{{},\Mine,3,3,\Mine}
3052 \setrow{3}{3,\Mine,4,2}
3053 \setrow{2}{{},\Mine,\Mine,{},0}
3054 \setrow{1}{{},2}
3055 \end{minesweeper}
3056 \end{center}
3057 \end{lstlisting}
3058 % \iffalse
3059 %</example>
3060 % \fi
3061 % \subsubsection{Options}
3062 % \begin{optionlist}
3063 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3064 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3065 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
3066 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3067 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3068 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3069 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3070 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3071 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3072 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3073 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3074 % \end{optionlist}
3075 %
3076 % \subsection{Nonogram}
3077 % Black out some cells of the grid. The black squares form stripes. The number, order, and length is defined by the number sequences on the top and left edge of the grid. Each number represents the length of the strip of black squares in the corresponding row or column. Two stripes are separated by at least one white square.
3078 %
3079 % \subsubsection{Example}
3080 % \begin{figure}[htbp]
3081 % \begin{center}
3082 % \begin{nonogram}[rows=10,columns=10,scale=0.35,width=4.8cm,fontsize=footnotesize,helplines=5,extracells=3]
3083 % \nonogramV{{5},{2,4},{2,6},{9},{1,7},{9},{2,1,2},{1,1},{1,4},{2}}
3084 % \nonogramH{{1},{4,1},{6,2},{7,2},{6,1},{8},{1,4,1},{2,4},{3,2},{4}}
3085 % \end{nonogram}
3086 % \hspace{1cm}
3087 % \begin{nonogram}[rows=10,columns=10,scale=0.35,width=3.8cm,solution=true,extracells=3]
3088 % \nonogramrow{10}{3/2}
3089 % \nonogramrow{9}{2/4,7/1}
3090 % \nonogramrow{8}{1/1,6/1}
3091 % \nonogramrow{7}{3/2,6/1,8/2}
3092 % \nonogramrow{6}{2/9}
3093 % \nonogramrow{5}{2/7,10/1}
3094 % \nonogramrow{4}{2/9}
3095 % \nonogramrow{3}{2/6,9/2}
3096 % \nonogramrow{2}{3/4,8/2}
3097 % \nonogramrow{1}{4/5}
3098 % \puzzlestrut
3099 % \end{nonogram}
3100 % \end{center}
3101 % \end{figure}
3102 % \iffalse
3103 %<*example>
3104 % \fi
3105 \begin{lstlisting}
3106 \begin{center}
3107 \begin{nonogram}[rows=10,columns=10,scale=0.35,width=4.8cm,
3108 fontsize=footnotesize,helplines=5,
3109 extracells=3]
3110 \nonogramV{{5},{2,4},{2,6},{9},{1,7},{9},{2,1,2},{1,1},
3111 {1,4},{2}}
3112 \nonogramH{{1},{4,1},{6,2},{7,2},{6,1},{8},{1,4,1},{2,4},
3113 {3,2},{4}}
3114 \end{nonogram}
3115 \hspace{1cm}
3116 \begin{nonogram}[rows=10,columns=10,scale=0.35,width=3.8cm,
3117 solution=true,extracells=3]
3118 \nonogramrow{10}{3/2}
3119 \nonogramrow{9}{2/4,7/1}
3120 \nonogramrow{8}{1/1,6/1}
3121 \nonogramrow{7}{3/2,6/1,8/2}
3122 \nonogramrow{6}{2/9}
3123 \nonogramrow{5}{2/7,10/1}
3124 \nonogramrow{4}{2/9}
3125 \nonogramrow{3}{2/6,9/2}
3126 \nonogramrow{2}{3/4,8/2}
3127 \nonogramrow{1}{4/5}
3128 \puzzlestrut
3129 \end{nonogram}
3130 \end{center}
3131 \end{lstlisting}
3132 % \iffalse
3133 %</example>
3134 % \fi
3135 % \subsubsection{Options}
3136 % \begin{optionlist}
3137 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3138 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3139 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
3140 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3141 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3142 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3143 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3144 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3145 % \optitem{\envoption{color}}{black}{sets the color of the lines.}
3146 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3147 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3148 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3149 % \optitem{\envoption{extracells}}{5}{sets the number of extra cells for the grid.}
3150 % \optitem{\envoption{helplines}}{5}{sets the space between thicker help lines. You can switch off help lines with \texttt{0}!}
3151 % \optitem{\envoption{solution}}{false}{will switch off extra cells if set to \texttt{true}.}
3152 % \end{optionlist}
3153 %
3154 % \subsection{Number Link}
3155 % Link all the same numbers or letters in each case by a line. The lines can run horizontally, vertically and in 90 degree angles. Each cell must be traversed by exactly one line. The lines must not intersect.
3156 %
3157 % \subsubsection{Example}
3158 % \begin{figure}[htbp]
3159 % \begin{center}
3160 % \begin{numberlink}
3161 % \framepuzzle
3162 % \numberlinkcell{2}{1}{B}
3163 % \numberlinkcell{5}{1}{C}
3164 % \numberlinkcell{2}{2}{C}
3165 % \numberlinkcell{4}{2}{D}
3166 % \numberlinkcell{3}{3}{A}
3167 % \numberlinkcell{4}{3}{E}
3168 % \numberlinkcell{1}{4}{B}
3169 % \numberlinkcell{1}{5}{A}
3170 % \numberlinkcell{3}{5}{E}
3171 % \numberlinkcell{4}{5}{D}
3172 % \end{numberlink}
3173 % \hspace{1.5cm}
3174 % \begin{numberlink}
3175 % \framepuzzle
3176 % \numberlinkcell{2}{1}{B}
3177 % \numberlinkcell{5}{1}{C}
3178 % \numberlinkcell{2}{2}{C}
3179 % \numberlinkcell{4}{2}{D}
3180 % \numberlinkcell{3}{3}{A}
3181 % \numberlinkcell{4}{3}{E}
3182 % \numberlinkcell{1}{4}{B}
3183 % \numberlinkcell{1}{5}{A}
3184 % \numberlinkcell{3}{5}{E}
3185 % \numberlinkcell{4}{5}{D}
3186 % \link{\tikzpath{4}{3}{8,4,8}}
3187 % \link{\tikzpath{2}{1}{4,8,8,8}}
3188 % \link{\tikzpath{2}{2}{6,2,6,6}}
3189 % \link{\tikzpath{1}{5}{6,2,2,6}}
3190 % \link{\tikzpath{4}{2}{6,8,8,8,4}}
3191 % \end{numberlink}
3192 % \end{center}
3193 % \end{figure}
3194 % \iffalse
3195 %<*example>
3196 % \fi
3197 \begin{lstlisting}
3198 \begin{numberlink}
3199 \framepuzzle
3200 \numberlinkcell{2}{1}{B}
3201 \numberlinkcell{5}{1}{C}
3202 \numberlinkcell{2}{2}{C}
3203 \numberlinkcell{4}{2}{D}
3204 \numberlinkcell{3}{3}{A}
3205 \numberlinkcell{4}{3}{E}
3206 \numberlinkcell{1}{4}{B}
3207 \numberlinkcell{1}{5}{A}
3208 \numberlinkcell{3}{5}{E}
3209 \numberlinkcell{4}{5}{D}
3210 \end{numberlink}
3211 \hspace{1.5cm}
3212 \begin{numberlink}
3213 \framepuzzle
3214 \numberlinkcell{2}{1}{B}
3215 \numberlinkcell{5}{1}{C}
3216 \numberlinkcell{2}{2}{C}
3217 \numberlinkcell{4}{2}{D}
3218 \numberlinkcell{3}{3}{A}
3219 \numberlinkcell{4}{3}{E}
3220 \numberlinkcell{1}{4}{B}
3221 \numberlinkcell{1}{5}{A}
3222 \numberlinkcell{3}{5}{E}
3223 \numberlinkcell{4}{5}{D}
3224 \link{\tikzpath{4}{3}{8,4,8}}
3225 \link{\tikzpath{2}{1}{4,8,8,8}}
3226 \link{\tikzpath{2}{2}{6,2,6,6}}
3227 \link{\tikzpath{1}{5}{6,2,2,6}}
3228 \link{\tikzpath{4}{2}{6,8,8,8,4}}
3229 \end{numberlink}
3230 \end{lstlisting}
3231 % \iffalse
3232 %</example>
3233 % \fi
3234 % \subsubsection{Options}
3235 % \begin{optionlist}
3236 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3237 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3238 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
3239 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3240 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3241 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3242 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3243 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3244 % \optitem{\envoption{color}}{red}{sets the color of the lines.}
3245 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3246 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3247 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3248 % \end{optionlist}
3249 %
3250 % \subsection{Resuko}
3251 % Complete the given elements in the grid to two race tracks (a race track and a much shorter test track) with pitlane and parking lot. The elements below and to the left of the grid indicate how many straights, curves and intersections are located in the respective columns and rows. The pit lane is always located next to four straights of the circuit on a free area of 1x4 cells. At the end, the parking lot is located on the only free area of 2x2 cells. Both can not be built on a gravel trap.
3252 %
3253 % \subsubsection{Example}
3254 % \begin{figure}[htbp]
3255 % \begin{center}
3256 % \begin{resuko}[width=5.2cm]
3257 % \resukocell{1}{7}{\Graveltrap}
3258 % \resukocell{4}{7}{\Graveltrap}
3259 % \resukocell{7}{3}{\Graveltrap}
3260 % \resukocell{6}{2}{\Cross}
3261 % \resukocell{8}{4}{\StraightV}
3262 % \resukocell{6}{7}{\StraightH}
3263 % \resukocell{3}{5}{\CurveBR}
3264 % \resukocell{5}{5}{\CurveTR}
3265 % \trackH{1/4/0,4/0/0,3/2/0,2/2/0,3/2/0,3/2/1,2/2/2,2/4/0}
3266 % \trackV{4/2/0,5/2/1,2/0/0,2/4/0,2/4/1,4/2/0,1/2/1,0/2/0}
3267 % \framepuzzle
3268 % \end{resuko}
3269 % \hspace{1.5cm}
3270 % \begin{resuko}
3271 % \resukocell{1}{7}{\Graveltrap}
3272 % \resukocell{4}{7}{\Graveltrap}
3273 % \resukocell{7}{3}{\Graveltrap}
3274 % \parkinglot{2}{7}
3275 % \pitlane{2}{3}{H}
3276 % \track{\tikzpath{2}{4}{6,8,6,8,4,4,4,2,2,6}}
3277 % \track{\xtikzpath{2}{1}{6/4,8/3,6/1,8/4,6/1,2/1,4/3,2/2,6/3,2/3,4/7,2/1,6/1}}
3278 % \framepuzzle
3279 % \end{resuko}
3280 % \end{center}
3281 % \end{figure}
3282 % \iffalse
3283 %<*example>
3284 % \fi
3285 \begin{lstlisting}
3286 \resukosetup{rows=8,columns=8,width=5.8cm,fontsize=Huge,
3287 scale=.708}
3288 \begin{resuko}[width=7.4cm]
3289 \resukocell{1}{7}{\Graveltrap}
3290 \resukocell{4}{7}{\Graveltrap}
3291 \resukocell{7}{3}{\Graveltrap}
3292 \resukocell{6}{2}{\Cross}
3293 \resukocell{8}{4}{\StraightV}
3294 \resukocell{6}{7}{\StraightH}
3295 \resukocell{3}{5}{\CurveBR}
3296 \resukocell{5}{5}{\CurveTR}
3297 \trackH{1/4/0,4/0/0,3/2/0,2/2/0,3/2/0,3/2/1,2/2/2,2/4/0}
3298 \trackV{4/2/0,5/2/1,2/0/0,2/4/0,2/4/1,4/2/0,1/2/1,0/2/0}
3299 \framepuzzle
3300 \end{resuko}
3301 \hspace{1.5cm}
3302 \begin{resuko}
3303 \resukocell{1}{7}{\Graveltrap}
3304 \resukocell{4}{7}{\Graveltrap}
3305 \resukocell{7}{3}{\Graveltrap}
3306 \parkinglot{2}{7}
3307 \pitlane{2}{3}{H}
3308 \track{\tikzpath{2}{4}{6,8,6,8,4,4,4,2,2,6}}
3309 \track{\xtikzpath{2}{1}{6/4,8/3,6/1,8/4,6/1,2/1,4/3,2/2,6/3,
3310 2/3,4/7,2/1,6/1}}
3311 \framepuzzle
3312 \end{resuko}
3313 \end{lstlisting}
3314 % \iffalse
3315 %</example>
3316 % \fi
3317 % \subsubsection{Options}
3318 % \begin{optionlist}
3319 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3320 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3321 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
3322 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3323 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3324 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3325 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3326 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3327 % \optitem{\envoption{color}}{blue}{sets the color of the pitlane and parking lot.}
3328 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3329 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3330 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3331 % \end{optionlist}
3332 %
3333 % \subsection{Schatzsuche}
3334 % It's a variant of Minesweeper, just with diamonds instead of mines. Draw a diamond in some cells of the grid. The number in a cell indicates how many of the eight neighboring cells contain a diamond. A numbered cell does not contain a diamond.
3335 % \subsubsection{Example}
3336 % \begin{figure}[htbp]
3337 % \begin{center}
3338 % \begin{schatzsuche}
3339 % \framepuzzle
3340 % \setrow{5}{{},1}
3341 % \setrow{4}{{},{},3,3}
3342 % \setrow{3}{3,{},4,2}
3343 % \setrow{2}{{},{},{},{},0}
3344 % \setrow{1}{{},2}
3345 % \end{schatzsuche}
3346 % \hspace{1.5cm}
3347 % \begin{schatzsuche}
3348 % \framepuzzle
3349 % \setrow{5}{{},1,{},\Diamond,\Diamond}
3350 % \setrow{4}{{},\Diamond,3,3,\Diamond}
3351 % \setrow{3}{3,\Diamond,4,2}
3352 % \setrow{2}{{},\Diamond,\Diamond,{},0}
3353 % \setrow{1}{{},2}
3354 % \end{schatzsuche}
3355 % \end{center}
3356 % \end{figure}
3357 % \iffalse
3358 %<*example>
3359 % \fi
3360 \begin{lstlisting}
3361 \begin{center}
3362 \begin{schatzsuche}
3363 \framepuzzle
3364 \setrow{5}{{},1}
3365 \setrow{4}{{},{},3,3}
3366 \setrow{3}{3,{},4,2}
3367 \setrow{2}{{},{},{},{},0}
3368 \setrow{1}{{},2}
3369 \end{schatzsuche}
3370 \hspace{1.5cm}
3371 \begin{schatzsuche}
3372 \framepuzzle
3373 \setrow{5}{{},1,{},\Diamond,\Diamond}
3374 \setrow{4}{{},\Diamond,3,3,\Diamond}
3375 \setrow{3}{3,\Diamond,4,2}
3376 \setrow{2}{{},\Diamond,\Diamond,{},0}
3377 \setrow{1}{{},2}
3378 \end{schatzsuche}
3379 \end{center}
3380 \end{lstlisting}
3381 % \iffalse
3382 %</example>
3383 % \fi
3384 %
3385 % \subsubsection{Options}
3386 % \begin{optionlist}
3387 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3388 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3389 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
3390 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3391 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3392 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3393 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3394 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3395 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3396 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3397 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3398 % \end{optionlist}
3399 %
3400 % \subsection{Skyline}
3401 % There are skyscrapers located in each cell. Try to find out the height of the skyscraper in the respective cell. There are heights of 1 to MAX in every row, every column, and in each of the two diagonals if indicated. Some cells may be empty (parks). The numbers around the grid indicate how many buildings you can see from this position when you look at the skyscraper lineup. Bear in mind that only those skyscrapers are visible which are higher than the ones in front.
3402 % \subsubsection{Example}
3403 % \begin{figure}[htbp]
3404 % \begin{center}
3405 % \begin{skyline}
3406 % \skylineB{3,{},3,1,{}}
3407 % \skylineL{{},4,3,{},{}}
3408 % \skylineT{{},{},2,{},3}
3409 % \skylineR{{},1,3,{},{}}
3410 % \skylinecell{1}{3}{2}
3411 % \skylinecell{4}{2}{3}
3412 % \end{skyline}
3413 % \hspace{1cm}
3414 % \begin{skyline}
3415 % \skylineB{3,{},3,1,{}}
3416 % \skylineL{{},4,3,{},{}}
3417 % \skylineT{{},{},2,{},3}
3418 % \skylineR{{},1,3,{},{}}
3419 % \setrow{5}{5,4,3,1,2}
3420 % \setrow{4}{4,5,1,2,3}
3421 % \setrow{3}{2,3,5,4,1}
3422 % \setrow{2}{1,2,4,3,5}
3423 % \setrow{1}{3,1,2,5,4}
3424 % \end{skyline}
3425 % \end{center}
3426 % \end{figure}
3427 % \iffalse
3428 %<*example>
3429 % \fi
3430 \begin{lstlisting}
3431 \begin{center}
3432 \begin{skyline}
3433 \skylineB{3,{},3,1,{}}
3434 \skylineL{{},4,3,{},{}}
3435 \skylineT{{},{},2,{},3}
3436 \skylineR{{},1,3,{},{}}
3437 \skylinecell{1}{3}{2}
3438 \skylinecell{4}{2}{3}
3439 \end{skyline}
3440 \hspace{1cm}
3441 \begin{skyline}
3442 \skylineB{3,{},3,1,{}}
3443 \skylineL{{},4,3,{},{}}
3444 \skylineT{{},{},2,{},3}
3445 \skylineR{{},1,3,{},{}}
3446 \setrow{5}{5,4,3,1,2}
3447 \setrow{4}{4,5,1,2,3}
3448 \setrow{3}{2,3,5,4,1}
3449 \setrow{2}{1,2,4,3,5}
3450 \setrow{1}{3,1,2,5,4}
3451 \end{skyline}
3452 \end{center}
3453 \end{lstlisting}
3454 % \iffalse
3455 %</example>
3456 % \fi
3457 % \paragraph{Variants}
3458 % \subparagraph{Skyline Sudoku}
3459 %
3460 % \begin{center}
3461 % \begin{skyline}[sudoku,scale=.4]
3462 % \skylineB{4,5,2,5,2,1,2,4,3}
3463 % \skylineL{4,2,2,2,1,3,3,3,2}
3464 % \skylineT{4,1,3,2,3,5,3,2,3}
3465 % \skylineR{3,3,1,3,4,2,3,2,4}
3466 % \setrow{9}{{},{},{},8,{},{},{},7}
3467 % \setrow{8}{{},{},4,{},{},6,{},{},8}
3468 % \setrow{7}{{},2,{},7,{},{},{},{},1}
3469 % \setrow{6}{{},{},{},{},8,2}
3470 % \setrow{5}{{},{},2,{},4,{},7}
3471 % \setrow{4}{{},{},{},3,{},{},4}
3472 % \setrow{3}{{},{},{},{},1}
3473 % \setrow{2}{{},3,{},{},{},{},1,2}
3474 % \setrow{1}{{},{},5}
3475 % \end{skyline}
3476 % \hspace{1cm}
3477 % \begin{skyline}[sudoku,scale=.4]
3478 % \skylineB{4,5,2,5,2,1,2,4,3}
3479 % \skylineL{4,2,2,2,1,3,3,3,2}
3480 % \skylineT{4,1,3,2,3,5,3,2,3}
3481 % \skylineR{3,3,1,3,4,2,3,2,4}
3482 % \setrow{9}{3,9,6,8,5,1,2,7,4}
3483 % \setrow{8}{1,7,4,9,2,6,3,5,8}
3484 % \setrow{7}{5,2,8,7,3,4,9,6,1}
3485 % \setrow{6}{7,4,3,1,8,2,6,9,5}
3486 % \setrow{5}{9,8,2,6,4,5,7,1,3}
3487 % \setrow{4}{6,5,1,3,9,7,4,8,2}
3488 % \setrow{3}{8,6,7,2,1,3,5,4,9}
3489 % \setrow{2}{4,3,9,5,6,8,1,2,7}
3490 % \setrow{1}{2,1,5,4,7,9,8,3,6}
3491 % \end{skyline}
3492 % \end{center}
3493 % \iffalse
3494 %<*example>
3495 % \fi
3496 \begin{lstlisting}
3497 \begin{center}
3498 \begin{skyline}[sudoku,scale=.4]
3499 \skylineB{4,5,2,5,2,1,2,4,3}
3500 \skylineL{4,2,2,2,1,3,3,3,2}
3501 \skylineT{4,1,3,2,3,5,3,2,3}
3502 \skylineR{3,3,1,3,4,2,3,2,4}
3503 \setrow{9}{{},{},{},8,{},{},{},7}
3504 \setrow{8}{{},{},4,{},{},6,{},{},8}
3505 \setrow{7}{{},2,{},7,{},{},{},{},1}
3506 \setrow{6}{{},{},{},{},8,2}
3507 \setrow{5}{{},{},2,{},4,{},7}
3508 \setrow{4}{{},{},{},3,{},{},4}
3509 \setrow{3}{{},{},{},{},1}
3510 \setrow{2}{{},3,{},{},{},{},1,2}
3511 \setrow{1}{{},{},5}
3512 \end{skyline}
3513 \hspace{1cm}
3514 \begin{skyline}[sudoku,scale=.4]
3515 \skylineB{4,5,2,5,2,1,2,4,3}
3516 \skylineL{4,2,2,2,1,3,3,3,2}
3517 \skylineT{4,1,3,2,3,5,3,2,3}
3518 \skylineR{3,3,1,3,4,2,3,2,4}
3519 \setrow{9}{3,9,6,8,5,1,2,7,4}
3520 \setrow{8}{1,7,4,9,2,6,3,5,8}
3521 \setrow{7}{5,2,8,7,3,4,9,6,1}
3522 \setrow{6}{7,4,3,1,8,2,6,9,5}
3523 \setrow{5}{9,8,2,6,4,5,7,1,3}
3524 \setrow{4}{6,5,1,3,9,7,4,8,2}
3525 \setrow{3}{8,6,7,2,1,3,5,4,9}
3526 \setrow{2}{4,3,9,5,6,8,1,2,7}
3527 \setrow{1}{2,1,5,4,7,9,8,3,6}
3528 \end{skyline}
3529 \end{center}
3530 \end{lstlisting}
3531 % \iffalse
3532 %</example>
3533 % \fi
3534 % \subparagraph{Skyline Sudoku (N*N)}
3535 %
3536 % \begin{center}
3537 % \begin{skyline}[rows=6,columns=6,scale=.58]
3538 % \skylineB{4,2,1,3,3,2}
3539 % \skylineL{3,3,4,3,2,1}
3540 % \skylineT{1,2,3,3,2,4}
3541 % \skylineR{4,1,2,2,2,3}
3542 % \skylinecell{2}{4}{1}
3543 % \skylinecell{4}{1}{4}
3544 % \skylinecell{5}{2}{3}
3545 % \begin{puzzlebackground}
3546 % \fillarea{Wheat}{(1,1)--(1,3)--(4,3)--(4,1)--(1,1)}
3547 % \fillarea{HotPink!30}{(1,3)--(1,7)--(4,7)--(4,6)--(2,6)
3548 % --(2,3)--(1,3)}
3549 % \fillarea{GreenYellow}{(2,3)--(2,6)--(4,6)--(4,3)--(2,3)}
3550 % \fillarea{LightBlue}{(4,1)--(7,1)--(7,5)--(6,5)--(6,2)
3551 % --(4,2)--(4,1)}
3552 % \fillarea{LightSalmon!50}{(4,7)--(4,4)--(5,4)--(5,6)--(6,6)
3553 % --(6,5)--(7,5)--(7,7)--(4,7)}
3554 % \fillarea{LightYellow}{(4,2)--(4,4)--(5,4)--(5,6)--(6,6)
3555 % --(6,2)--(4,2)}
3556 % \end{puzzlebackground}
3557 % \end{skyline}
3558 % \hspace{1cm}
3559 % \begin{skyline}[rows=6,columns=6,scale=.58]
3560 % \skylineB{4,2,1,3,3,2}
3561 % \skylineL{3,3,4,3,2,1}
3562 % \skylineT{1,2,3,3,2,4}
3563 % \skylineR{4,1,2,2,2,3}
3564 % \setrow{6}{6,3,4,1,5,2}
3565 % \setrow{5}{5,6,2,3,1,4}
3566 % \setrow{4}{2,1,3,6,4,5}
3567 % \setrow{3}{1,4,5,2,6,3}
3568 % \setrow{2}{4,2,1,5,3,6}
3569 % \setrow{1}{3,5,6,4,2,1}
3570 % \begin{puzzlebackground}
3571 % \fillarea{Wheat}{(1,1)--(1,3)--(4,3)--(4,1)--(1,1)}
3572 % \fillarea{HotPink!30}{(1,3)--(1,7)--(4,7)--(4,6)--(2,6)
3573 % --(2,3)--(1,3)}
3574 % \fillarea{GreenYellow}{(2,3)--(2,6)--(4,6)--(4,3)--(2,3)}
3575 % \fillarea{LightBlue}{(4,1)--(7,1)--(7,5)--(6,5)--(6,2)
3576 % --(4,2)--(4,1)}
3577 % \fillarea{LightSalmon!50}{(4,7)--(4,4)--(5,4)--(5,6)--(6,6)
3578 % --(6,5)--(7,5)--(7,7)--(4,7)}
3579 % \fillarea{LightYellow}{(4,2)--(4,4)--(5,4)--(5,6)--(6,6)
3580 % --(6,2)--(4,2)}
3581 % \end{puzzlebackground}
3582 % \end{skyline}
3583 % \end{center}
3584 % \iffalse
3585 %<*example>
3586 % \fi
3587 \begin{lstlisting}
3588 \begin{center}
3589 \begin{skyline}[rows=6,columns=6,scale=.58]
3590 \skylineB{4,2,1,3,3,2}
3591 \skylineL{3,3,4,3,2,1}
3592 \skylineT{1,2,3,3,2,4}
3593 \skylineR{4,1,2,2,2,3}
3594 \skylinecell{2}{4}{1}
3595 \skylinecell{4}{1}{4}
3596 \skylinecell{5}{2}{3}
3597 \begin{puzzlebackground}
3598 \fillarea{Wheat}{(1,1)--(1,3)--(4,3)--(4,1)--(1,1)}
3599 \fillarea{HotPink!30}{(1,3)--(1,7)--(4,7)--(4,6)--(2,6)
3600 --(2,3)--(1,3)}
3601 \fillarea{GreenYellow}{(2,3)--(2,6)--(4,6)--(4,3)--(2,3)}
3602 \fillarea{LightBlue}{(4,1)--(7,1)--(7,5)--(6,5)--(6,2)
3603 --(4,2)--(4,1)}
3604 \fillarea{LightSalmon!50}{(4,7)--(4,4)--(5,4)--(5,6)--(6,6)
3605 --(6,5)--(7,5)--(7,7)--(4,7)}
3606 \fillarea{LightYellow}{(4,2)--(4,4)--(5,4)--(5,6)--(6,6)
3607 --(6,2)--(4,2)}
3608 \end{puzzlebackground}
3609 \end{skyline}
3610 \hspace{1cm}
3611 \begin{skyline}[rows=6,columns=6,scale=.58]
3612 \skylineB{4,2,1,3,3,2}
3613 \skylineL{3,3,4,3,2,1}
3614 \skylineT{1,2,3,3,2,4}
3615 \skylineR{4,1,2,2,2,3}
3616 \setrow{6}{6,3,4,1,5,2}
3617 \setrow{5}{5,6,2,3,1,4}
3618 \setrow{4}{2,1,3,6,4,5}
3619 \setrow{3}{1,4,5,2,6,3}
3620 \setrow{2}{4,2,1,5,3,6}
3621 \setrow{1}{3,5,6,4,2,1}
3622 \begin{puzzlebackground}
3623 \fillarea{Wheat}{(1,1)--(1,3)--(4,3)--(4,1)--(1,1)}
3624 \fillarea{HotPink!30}{(1,3)--(1,7)--(4,7)--(4,6)--(2,6)
3625 --(2,3)--(1,3)}
3626 \fillarea{GreenYellow}{(2,3)--(2,6)--(4,6)--(4,3)--(2,3)}
3627 \fillarea{LightBlue}{(4,1)--(7,1)--(7,5)--(6,5)--(6,2)
3628 --(4,2)--(4,1)}
3629 \fillarea{LightSalmon!50}{(4,7)--(4,4)--(5,4)--(5,6)--(6,6)
3630 --(6,5)--(7,5)--(7,7)--(4,7)}
3631 \fillarea{LightYellow}{(4,2)--(4,4)--(5,4)--(5,6)--(6,6)
3632 --(6,2)--(4,2)}
3633 \end{puzzlebackground}
3634 \end{skyline}
3635 \end{center}
3636 \end{lstlisting}
3637 % \iffalse
3638 %</example>
3639 % \fi
3640 % \subsubsection{Options}
3641 % \begin{optionlist}
3642 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3643 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3644 % \optitem{\envoption{sudoku}}{false}{sets \envoption{rows} and \envoption{columns} to 9, in case of \texttt{true} is specified. Additionally the classic Sudoku grid is drawn.}
3645 % \optitem{\envoption{width}}{6.7cm}{sets the width of the minipage, in which the grid is typeset.}
3646 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3647 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3648 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3649 % \optitem{\envoption{titleindent}}{0.75cm}{defines the indent of the title.}
3650 % \optitem{\envoption{titlewidth}}{5.85cm}{specifies the width of the box the title is set in.}
3651 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3652 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3653 % \optitem{\envoption{cvoffset}}{-38pt}{sets the vertical offset of the counters in the margin.}
3654 % \end{optionlist}
3655 %
3656 % \subsection{Slitherlink}
3657 % Draw a closed line into the grid. This line must be on the existing dashed lines, but do not have to go through all grid points. If numbers are present in the grid cells, they indicate how many sides of the cell are touched by the line. The line must not touch or cross itself.
3658 % \subsubsection{Example}
3659 % \begin{figure}[htbp]
3660 % \begin{center}
3661 % \begin{slitherlink}
3662 % \setbigcell{1}{1}{4}
3663 % \slitherlinkcell{1}{3}{3}
3664 % \slitherlinkcell{3}{1}{3}
3665 % \slitherlinkcell{3}{3}{0}
3666 % \slitherlinkcell{3}{4}{3}
3667 % \slitherlinkcell{4}{4}{2}
3668 % \slitherlinkcell{5}{1}{0}
3669 % \slitherlinkcell{5}{2}{2}
3670 % \end{slitherlink}
3671 % \hspace{1.5cm}
3672 % \begin{slitherlink}
3673 % \setbigcell{1}{1}{4}
3674 % \slitherlinkcell{1}{3}{3}
3675 % \slitherlinkcell{3}{1}{3}
3676 % \slitherlinkcell{3}{3}{0}
3677 % \slitherlinkcell{3}{4}{3}
3678 % \slitherlinkcell{4}{4}{2}
3679 % \slitherlinkcell{5}{1}{0}
3680 % \slitherlinkcell{5}{2}{2}
3681 % \framearea{black}{\tikzpath{3}{1}{8,8,4,4,8,6,6,8,6,2,6,6,2,4,2,4,2,4}}
3682 % \end{slitherlink}
3683 % \end{center}
3684 % \end{figure}
3685 % \iffalse
3686 %<*example>
3687 % \fi
3688 \begin{lstlisting}
3689 \begin{center}
3690 \begin{slitherlink}
3691 \setbigcell{1}{1}{4}
3692 \slitherlinkcell{1}{3}{3}
3693 \slitherlinkcell{3}{1}{3}
3694 \slitherlinkcell{3}{3}{0}
3695 \slitherlinkcell{3}{4}{3}
3696 \slitherlinkcell{4}{4}{2}
3697 \slitherlinkcell{5}{1}{0}
3698 \slitherlinkcell{5}{2}{2}
3699 \end{slitherlink}
3700 \hspace{1.5cm}
3701 \begin{slitherlink}
3702 \setbigcell{1}{1}{4}
3703 \slitherlinkcell{1}{3}{3}
3704 \slitherlinkcell{3}{1}{3}
3705 \slitherlinkcell{3}{3}{0}
3706 \slitherlinkcell{3}{4}{3}
3707 \slitherlinkcell{4}{4}{2}
3708 \slitherlinkcell{5}{1}{0}
3709 \slitherlinkcell{5}{2}{2}
3710 \framearea{black}{\tikzpath{3}{1}{8,8,4,4,8,6,6,8,6,2,
3711 6,6,2,4,2,4,2,4}}
3712 \end{slitherlink}
3713 \end{center}
3714 \end{lstlisting}
3715 % \iffalse
3716 %</example>
3717 % \fi
3718 % \subsubsection{Options}
3719 % \begin{optionlist}
3720 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3721 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3722 % \optitem{\envoption{width}}{5.2cm}{sets the width of the minipage, in which the grid is typeset.}
3723 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3724 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3725 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3726 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3727 % \optitem{\envoption{titlewidth}}{5.2cm}{specifies the width of the box the title is set in.}
3728 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3729 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3730 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3731 % \end{optionlist}
3732 %
3733 % \subsection{Star Battle}
3734 % Enter exactly one star in each row, each column and each area of the grid. Cells with stars must not touch each other orthogonally or diagonally.
3735 %
3736 % \subsubsection{Example}
3737 % \begin{figure}[htbp]
3738 % \begin{center}
3739 % \begin{starbattle}
3740 % \framepuzzle
3741 % \framearea{black}{\tikzpath{1}{1}{8,6,8,6,6,2,6,6,2,4,4,4,4,4}}
3742 % \framearea{black}{\tikzpath{1}{2}{8,8,6,2,2,4}}
3743 % \framearea{black}{\tikzpath{1}{4}{8,8,6,6,2,6,2,2,4,4,8,4}}
3744 % \framearea{black}{\tikzpath{4}{2}{8,8,8,4,8,6,6,6,2,4,2,2,6,2,4,4}}
3745 % \framearea{black}{\tikzpath{5}{3}{8,8,6,2,2,4}}
3746 % \end{starbattle}
3747 % \hspace{1.5cm}
3748 % \begin{starbattle}
3749 % \framepuzzle
3750 % \framearea{black}{\tikzpath{1}{1}{8,6,8,6,6,2,6,6,2,4,4,4,4,4}}
3751 % \framearea{black}{\tikzpath{1}{2}{8,8,6,2,2,4}}
3752 % \framearea{black}{\tikzpath{1}{4}{8,8,6,6,2,6,2,2,4,4,8,4}}
3753 % \framearea{black}{\tikzpath{4}{2}{8,8,8,4,8,6,6,6,2,4,2,2,6,2,4,4}}
3754 % \framearea{black}{\tikzpath{5}{3}{8,8,6,2,2,4}}
3755 % \starbattlecell{1}{2}{\Star}
3756 % \starbattlecell{2}{4}{\Star}
3757 % \starbattlecell{3}{1}{\Star}
3758 % \starbattlecell{4}{5}{\Star}
3759 % \starbattlecell{5}{3}{\Star}
3760 % \end{starbattle}
3761 % \end{center}
3762 % \end{figure}
3763 % \iffalse
3764 %<*example>
3765 % \fi
3766 \begin{lstlisting}
3767 \begin{center}
3768 \begin{starbattle}
3769 \framepuzzle
3770 \framearea{black}{\tikzpath{1}{1}{8,6,8,6,6,2,6,6,2,4,4,4,
3771 4,4}}
3772 \framearea{black}{\tikzpath{1}{2}{8,8,6,2,2,4}}
3773 \framearea{black}{\tikzpath{1}{4}{8,8,6,6,2,6,2,2,4,4,8,4}}
3774 \framearea{black}{\tikzpath{4}{2}{8,8,8,4,8,6,6,6,2,4,2,2,6,
3775 2,4,4}}
3776 \framearea{black}{\tikzpath{5}{3}{8,8,6,2,2,4}}
3777 \end{starbattle}
3778 \hspace{1.5cm}
3779 \begin{starbattle}
3780 \framepuzzle
3781 \framearea{black}{\tikzpath{1}{1}{8,6,8,6,6,2,6,6,2,4,4,4,
3782 4,4}}
3783 \framearea{black}{\tikzpath{1}{2}{8,8,6,2,2,4}}
3784 \framearea{black}{\tikzpath{1}{4}{8,8,6,6,2,6,2,2,4,4,8,4}}
3785 \framearea{black}{\tikzpath{4}{2}{8,8,8,4,8,6,6,6,2,4,2,2,6,
3786 2,4,4}}
3787 \framearea{black}{\tikzpath{5}{3}{8,8,6,2,2,4}}
3788 \starbattlecell{1}{2}{\Star}
3789 \starbattlecell{2}{4}{\Star}
3790 \starbattlecell{3}{1}{\Star}
3791 \starbattlecell{4}{5}{\Star}
3792 \starbattlecell{5}{3}{\Star}
3793 \end{starbattle}
3794 \end{center}
3795 \end{lstlisting}
3796 % \iffalse
3797 %</example>
3798 % \fi
3799 % \subsubsection{Options}
3800 % \begin{optionlist}
3801 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3802 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3803 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
3804 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3805 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3806 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3807 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3808 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
3809 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3810 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3811 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3812 % \end{optionlist}
3813 %
3814 % \subsection{Stars and Arrows}
3815 % Enter a star in some empty cells of the grid. Each arrow points to at least one star and every star is referenced by at least one arrow. Arrows point to a whole row, column or diagonal, also through other stars and arrows. The numbers on the left and top of the grid indicate how many stars are located in the row or column.
3816 % \subsubsection{Example}
3817 % \begin{figure}[htbp]
3818 % \begin{center}
3819 % \begin{starsandarrows}
3820 % \framepuzzle
3821 % \starsH{1,2,3,2,0}
3822 % \starsV{1,0,3,2,2}
3823 % \setrow{5}{\RightDown,{},\LeftDown}
3824 % \setrow{4}{{},\Right,{},{},\LeftUp}
3825 % \setrow{2}{{},\Up,{},{},{}}
3826 % \setrow{1}{\RightUp,{},{},\LeftUp,\Left}
3827 % \end{starsandarrows}
3828 % \hspace{1.5cm}
3829 % \begin{starsandarrows}
3830 % \framepuzzle
3831 % \starsH{1,2,3,2,0}
3832 % \starsV{1,0,3,2,2}
3833 % \setrow{5}{\RightDown,\Star,\LeftDown,\Star}
3834 % \setrow{4}{{},\Right,\Star,\Star,\LeftUp}
3835 % \setrow{3}{\Star,\Star,\Star}
3836 % \setrow{2}{{},\Up,{},{},{}}
3837 % \setrow{1}{\RightUp,{},\Star,\LeftUp,\Left}
3838 % \end{starsandarrows}
3839 % \end{center}
3840 % \end{figure}
3841 % \iffalse
3842 %<*example>
3843 % \fi
3844 \begin{lstlisting}
3845 \begin{center}
3846 \begin{starsandarrows}
3847 \framepuzzle
3848 \starsH{1,2,3,2,0}
3849 \starsV{1,0,3,2,2}
3850 \setrow{5}{\RightDown,{},\LeftDown}
3851 \setrow{4}{{},\Right,{},{},\LeftUp}
3852 \setrow{2}{{},\Up,{},{},{}}
3853 \setrow{1}{\RightUp,{},{},\LeftUp,\Left}
3854 \end{starsandarrows}
3855 \hspace{1.5cm}
3856 \begin{starsandarrows}
3857 \framepuzzle
3858 \starsH{1,2,3,2,0}
3859 \starsV{1,0,3,2,2}
3860 \setrow{5}{\RightDown,\Star,\LeftDown,\Star}
3861 \setrow{4}{{},\Right,\Star,\Star,\LeftUp}
3862 \setrow{3}{\Star,\Star,\Star}
3863 \setrow{2}{{},\Up,{},{},{}}
3864 \setrow{1}{\RightUp,{},\Star,\LeftUp,\Left}
3865 \end{starsandarrows}
3866 \end{center}
3867 \end{lstlisting}
3868 % \iffalse
3869 %</example>
3870 % \fi
3871 % \subsubsection{Options}
3872 % \begin{optionlist}
3873 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
3874 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
3875 % \optitem{\envoption{width}}{5.9cm}{sets the width of the minipage, in which the grid is typeset.}
3876 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
3877 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3878 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3879 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3880 % \optitem{\envoption{titlewidth}}{5.9cm}{specifies the width of the box the title is set in.}
3881 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3882 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3883 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3884 % \end{optionlist}
3885 %
3886 % \subsection{Sudoku}
3887 % Well, it's Sudoku -- nothing to explain! Fill each row and column with numbers from 1 to 9.
3888 % \subsubsection{Example}
3889 % \begin{figure}[htbp]
3890 % \begin{center}
3891 % \begin{lpsudoku}
3892 % \setrow{9}{{},2,6,{},{},{},{},{},{}}
3893 % \setrow{8}{{},{},{},{},{},{},1,7,{}}
3894 % \setrow{7}{{},{},3,1,{},6,{},{},{}}
3895 % \setrow{6}{{},6,{},{},5,{},8,{},3}
3896 % \setrow{5}{{},{},9,2,6,1,7,{},{}}
3897 % \setrow{4}{5,{},4,{},8,{},{},6,{}}
3898 % \setrow{3}{{},{},{},8,{},4,3,{},{}}
3899 % \setrow{2}{{},4,8,{},{},{},{},{},{}}
3900 % \setrow{1}{{},{},{},{},{},{},9,4,{}}
3901 % \end{lpsudoku}
3902 % \hspace{1.5cm}
3903 % \begin{lpsudoku}
3904 % \setrow{9}{1,2,6,5,7,8,4,3,9}
3905 % \setrow{8}{4,8,5,9,3,2,1,7,6}
3906 % \setrow{7}{7,9,3,1,4,6,5,8,2}
3907 % \setrow{6}{2,6,1,4,5,7,8,9,3}
3908 % \setrow{5}{8,3,9,2,6,1,7,5,4}
3909 % \setrow{4}{5,7,4,3,8,9,2,6,1}
3910 % \setrow{3}{6,5,2,8,9,4,3,1,7}
3911 % \setrow{2}{9,4,8,7,1,3,6,2,5}
3912 % \setrow{1}{3,1,7,6,2,5,9,4,8}
3913 % \end{lpsudoku}
3914 % \end{center}
3915 % \end{figure}
3916 % \iffalse
3917 %<*example>
3918 % \fi
3919 \begin{lstlisting}
3920 \begin{center}
3921 \begin{lpsudoku}
3922 \setrow{9}{{},2,6,{},{},{},{},{},{}}
3923 \setrow{8}{{},{},{},{},{},{},1,7,{}}
3924 \setrow{7}{{},{},3,1,{},6,{},{},{}}
3925 \setrow{6}{{},6,{},{},5,{},8,{},3}
3926 \setrow{5}{{},{},9,2,6,1,7,{},{}}
3927 \setrow{4}{5,{},4,{},8,{},{},6,{}}
3928 \setrow{3}{{},{},{},8,{},4,3,{},{}}
3929 \setrow{2}{{},4,8,{},{},{},{},{},{}}
3930 \setrow{1}{{},{},{},{},{},{},9,4,{}}
3931 \end{lpsudoku}
3932 \hspace{1.5cm}
3933 \begin{lpsudoku}
3934 \setrow{9}{1,2,6,5,7,8,4,3,9}
3935 \setrow{8}{4,8,5,9,3,2,1,7,6}
3936 \setrow{7}{7,9,3,1,4,6,5,8,2}
3937 \setrow{6}{2,6,1,4,5,7,8,9,3}
3938 \setrow{5}{8,3,9,2,6,1,7,5,4}
3939 \setrow{4}{5,7,4,3,8,9,2,6,1}
3940 \setrow{3}{6,5,2,8,9,4,3,1,7}
3941 \setrow{2}{9,4,8,7,1,3,6,2,5}
3942 \setrow{1}{3,1,7,6,2,5,9,4,8}
3943 \end{lpsudoku}
3944 \end{lstlisting}
3945 % \iffalse
3946 %</example>
3947 % \fi
3948 % \subsubsection{Options}
3949 % \begin{optionlist}
3950 % \optitem{\envoption{width}}{9.1cm}{sets the width of the minipage, in which the grid is typeset. 9 cells of width 1cm plus a litle extra for lines.}
3951 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage. To get a width of 5cm you need to scale by $\nicefrac{5}{9}$}
3952 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
3953 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
3954 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
3955 % \optitem{\envoption{titlewidth}}{9.1cm}{specifies the width of the box the title is set in.}
3956 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
3957 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
3958 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
3959 % \end{optionlist}
3960 %
3961 % \subsubsection{Supporting \texttt{bash} scripts}
3962 % \paragraph{createlpsudoku}
3963 % The \texttt{createlpsudoku} \cite{bib:wiki:createlpsudoku} \texttt{bash} script can transform Sudoku format files into \env{lpsudoku} environments. It can process files in the so called one line 81 format\footnote{processing of several sudokus in 81 format (one in each line) is possible} (option -e (default)) and in simple sudoku format (option -s)
3964 %
3965 % \medskip
3966 % Usage: \texttt{createlpsudoku [options] [-o output] -i input}
3967 %
3968 % \medskip
3969 % It expects an input file with the option \texttt{-i}. You can specify an output file with the option \texttt{-o}. Otherwise it writes to \texttt{stdout}. Furthermore, the following options are possible:
3970 %
3971 % \medskip
3972 % \begin{tabular}{ll}
3973 % -w & write Windows line endings (CR/LF) to file \\
3974 % -v & prints version number \\
3975 % -h & prints help \\
3976 % \end{tabular}
3977 %
3978 % \paragraph{lpsmag}
3979 %
3980 % With the \texttt{lpsmag} \cite{bib:wiki:lpsmag} \texttt{bash} script you can half automatically produce a Sudoku magazine using the \env{lpsudoku} environment and the \texttt{createlpsudoku} bash script.
3981 %
3982 % \medskip
3983 % Usage: \texttt{lpsmag configfile}
3984 %
3985 % \medskip
3986 % The script needs an installed \href{http://ostermiller.org/qqwing/}{QQwing} \cite{bib:web:qqwing} and a config file for defining the magazine's contents:
3987 %
3988 % \iffalse
3989 %<*example>
3990 % \fi
3991 \begin{lstlisting}
3992 page p1 easy
3993 page p2 easy
3994 startpuzzles
3995 typesetpage p1
3996 typesetpage p2
3997 startsolutions
3998 typesetsolpage p1 p2 last
3999 \end{lstlisting}
4000 % \iffalse
4001 %</example>
4002 % \fi
4003 %
4004 % This config file will be sourced into the \texttt{lpsmag bash} script and contains calls of \texttt{lpsmag} functions. Make sure, that the config file has UNIX line endings (LF). For a detailed documentation I refer to the following \href{http://logicpuzzle.square7.de/lpsmag}{wiki} \cite{bib:wiki:lpsmag} entry.
4005 %
4006 % After running \texttt{lpsmag} you will find a \texttt{lpsmag.tex} in your working directory. Just run \texttt{pdflatex lpsmag.tex} twice and you finally get for example this \href{https://bitbucket.org/kleberj/logicpuzzle/downloads/lpsmag.pdf}{\texttt{lpsmag.pdf}}.
4007 %
4008 % \subsection{Sun and Moon}
4009 % Enter exactly one star and one dark cloud in each row and each column of the grid, so that the planets are illuminated as specified. The stars shine horizontally or vertically arbitrarily far, but not through a planet or a dark cloud.
4010 %
4011 % \subsubsection{Example}
4012 % \begin{figure}[htbp]
4013 % \begin{center}
4014 % \begin{sunandmoon}
4015 % \framepuzzle
4016 % \setrow{5}{{},{},{},{},\Moon}
4017 % \setrow{4}{{},{},\MoonTL}
4018 % \setrow{3}{\Moon}
4019 % \setrow{2}{{},\MoonR}
4020 % \setrow{1}{{},{},{},\MoonT}
4021 % \end{sunandmoon}
4022 % \hspace{1.5cm}
4023 % \begin{sunandmoon}
4024 % \framepuzzle
4025 % \setrow{5}{{},{},\Star,\Cloud,\Moon}
4026 % \setrow{4}{{},\Star,\MoonTL,{},\Cloud}
4027 % \setrow{3}{\Moon,\Cloud,{},{},\Star}
4028 % \setrow{2}{\Cloud,\MoonR,{},\Star}
4029 % \setrow{1}{\Star,{},\Cloud,\MoonT}
4030 % \end{sunandmoon}
4031 % \end{center}
4032 % \end{figure}
4033 % \iffalse
4034 %<*example>
4035 % \fi
4036 \begin{lstlisting}
4037 \begin{center}
4038 \begin{sunandmoon}
4039 \framepuzzle
4040 \setrow{5}{{},{},{},{},\Moon}
4041 \setrow{4}{{},{},\MoonTL}
4042 \setrow{3}{\Moon}
4043 \setrow{2}{{},\MoonR}
4044 \setrow{1}{{},{},{},\MoonT}
4045 \end{sunandmoon}
4046 \hspace{1.5cm}
4047 \begin{sunandmoon}
4048 \framepuzzle
4049 \setrow{5}{{},{},\Star,\Cloud,\Moon}
4050 \setrow{4}{{},\Star,\MoonTL,{},\Cloud}
4051 \setrow{3}{\Moon,\Cloud,{},{},\Star}
4052 \setrow{2}{\Cloud,\MoonR,{},\Star}
4053 \setrow{1}{\Star,{},\Cloud,\MoonT}
4054 \end{sunandmoon}
4055 \end{center}
4056 \end{lstlisting}
4057 % \iffalse
4058 %</example>
4059 % \fi
4060 % \subsubsection{Options}
4061 % \begin{optionlist}
4062 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
4063 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
4064 % \optitem{\envoption{width}}{5.1cm}{sets the width of the minipage, in which the grid is typeset.}
4065 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
4066 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
4067 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
4068 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
4069 % \optitem{\envoption{titlewidth}}{5.1cm}{specifies the width of the box the title is set in.}
4070 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
4071 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
4072 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
4073 % \end{optionlist}
4074 %
4075 % \subsection{Tents and Trees}
4076 % Draw tents in the grid. Next to each tree, a tent must be entered in a horizontally or vertically adjacent cell, which is associated with this tree. The numbers next to the grid indicate the quantity of tents in each row or column. No tent can stand directly next to another one, not even diagonally.
4077 % \subsubsection{Example}
4078 % \begin{figure}[htbp]
4079 % \begin{center}
4080 % \begin{tentsandtrees}
4081 % \framepuzzle
4082 % \tentH{1,2,1,1,2}
4083 % \tentV{2,0,2,0,3}
4084 % \setrow{4}{\Tree,{},\Tree,\Tree,\Tree}
4085 % \setrow{2}{{},\Tree}
4086 % \setrow{1}{\Tree,{},{},\Tree}
4087 % \end{tentsandtrees}
4088 % \hspace{1.5cm}
4089 % \begin{tentsandtrees}
4090 % \framepuzzle
4091 % \tentH{1,2,1,1,2}
4092 % \tentV{2,0,2,0,3}
4093 % \setrow{5}{\Tent,{},\Tent,{},\Tent,}
4094 % \setrow{4}{\Tree,{},\Tree,\Tree,\Tree}
4095 % \setrow{3}{{},\Tent,{},\Tent}
4096 % \setrow{2}{{},\Tree}
4097 % \setrow{1}{\Tree,\Tent,{},\Tree,\Tent}
4098 % \end{tentsandtrees}
4099 % \end{center}
4100 % \end{figure}
4101 % \iffalse
4102 %<*example>
4103 % \fi
4104 \begin{lstlisting}
4105 \begin{center}
4106 \begin{tentsandtrees}
4107 \framepuzzle
4108 \tentH{1,2,1,1,2}
4109 \tentV{2,0,2,0,3}
4110 \setrow{4}{\Tree,{},\Tree,\Tree,\Tree}
4111 \setrow{2}{{},\Tree}
4112 \setrow{1}{\Tree,{},{},\Tree}
4113 \end{tentsandtrees}
4114 \hspace{1.5cm}
4115 \begin{tentsandtrees}
4116 \framepuzzle
4117 \tentH{1,2,1,1,2}
4118 \tentV{2,0,2,0,3}
4119 \setrow{5}{\Tent,{},\Tent,{},\Tent,}
4120 \setrow{4}{\Tree,{},\Tree,\Tree,\Tree}
4121 \setrow{3}{{},\Tent,{},\Tent}
4122 \setrow{2}{{},\Tree}
4123 \setrow{1}{\Tree,\Tent,{},\Tree,\Tent}
4124 \end{tentsandtrees}
4125 \end{center}
4126 \end{lstlisting}
4127 % \iffalse
4128 %</example>
4129 % \fi
4130 % \subsubsection{Options}
4131 % \begin{optionlist}
4132 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
4133 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
4134 % \optitem{\envoption{width}}{5.9cm}{sets the width of the minipage, in which the grid is typeset.}
4135 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
4136 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
4137 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
4138 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
4139 % \optitem{\envoption{titlewidth}}{5.9cm}{specifies the width of the box the title is set in.}
4140 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
4141 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
4142 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
4143 % \end{optionlist}
4144 %
4145 % \subsection{Tunnel}
4146 % Determine the course of the tube. Draw the only possible connection. from the beginning to the end. The numbers indicate how many tube segments (including portals) are present in the corresponding rows and columns. The tube is one cell wide, and does not cross or touch itself!
4147 % \subsubsection{Example}
4148 % \begin{figure}[htbp]
4149 % \begin{center}
4150 % \begin{tunnel}
4151 % \framepuzzle
4152 % \tunnelH{4,3,3,3,4}
4153 % \tunnelV{5,1,5,1,5}
4154 % \portal{1}{1}
4155 % \portal{5}{5}
4156 % \end{tunnel}
4157 % \hspace{1.5cm}
4158 % \begin{tunnel}
4159 % \framepuzzle
4160 % \tunnelH{4,3,3,3,4}
4161 % \tunnelV{5,1,5,1,5}
4162 % \portal{1}{1}
4163 % \portal{5}{5}
4164 % \tube{\tikzpath{1}{1}{6,6,6,6,8,8,4,4,4,4,8,8,6,6,6,6}}
4165 % \end{tunnel}
4166 % \end{center}
4167 % \end{figure}
4168 % \iffalse
4169 %<*example>
4170 % \fi
4171 \begin{lstlisting}
4172 \begin{center}
4173 \begin{tunnel}
4174 \framepuzzle
4175 \tunnelH{4,3,3,3,4}
4176 \tunnelV{5,1,5,1,5}
4177 \portal{1}{1}
4178 \portal{5}{5}
4179 \end{tunnel}
4180 \hspace{1.5cm}
4181 \begin{tunnel}
4182 \framepuzzle
4183 \tunnelH{4,3,3,3,4}
4184 \tunnelV{5,1,5,1,5}
4185 \portal{1}{1}
4186 \portal{5}{5}
4187 \tube{\tikzpath{1}{1}{6,6,6,6,8,8,4,4,4,4,8,8,6,6,6,6}}
4188 \end{tunnel}
4189 \end{center}
4190 \end{lstlisting}
4191 % \iffalse
4192 %</example>
4193 % \fi
4194 % \subsubsection{Options}
4195 % \begin{optionlist}
4196 % \optitem{\envoption{rows}}{5}{defines the number of rows in the grid.}
4197 % \optitem{\envoption{columns}}{5}{specifies the number of columns in the grid}
4198 % \optitem{\envoption{width}}{5.9cm}{sets the width of the minipage, in which the grid is typeset.}
4199 % \optitem{\envoption{scale}}{1}{scales the size of the grid in the minipage.}
4200 % \optitem{\envoption{fontsize}}{Large}{specifies the size of the numbers next to the grid. Here, the usual \LaTeX\ sizes are used. Possible values: \texttt{tiny}, \texttt{scriptsize}, \texttt{footnotesize}, \texttt{small}, \texttt{normalsize}, \texttt{large}, \underline{\texttt{Large}}, \texttt{LARGE}, \texttt{huge}, \texttt{Huge}}
4201 % \optitem{\envoption{title}}{}{sets the title of a puzzle.}
4202 % \optitem{\envoption{titleindent}}{0cm}{defines the indent of the title.}
4203 % \optitem{\envoption{titlewidth}}{5.9cm}{specifies the width of the box the title is set in.}
4204 % \optitem{\envoption{bgcolor}}{}{sets the background color of the grid.}
4205 % \optitem{\envoption{counterstyle}}{none}{defines the counter style. Predefined styles: none, left, right}
4206 % \optitem{\envoption{cvoffset}}{-23pt}{sets the vertical offset of the counters in the margin.}
4207 % \end{optionlist}
4208 % You\IfFileExists{qrcode.png}{\marginnote{\href{https://bitbucket.org/kleberj/logicpuzzle/}{\includegraphics[height=2cm]{qrcode.png}}}[-37pt]}{} can download application examples and their solutions from the \href{https://bitbucket.org/kleberj/logicpuzzle/}{project page}. The puzzles are originally licensed under \href{http://creativecommons.org/licenses/by-nc-sa/3.0/}{\ccbyncsa}.
4209 % \section{Implemenation}
4210 %
4211 % \changes{v1.0}{2013/02/09}{first version of battleship.sty on CTAN}
4212 % \changes{v1.2}{2013/02/17}{moved code base for logic puzzles into logicpuzzle.sty}
4213 % \changes{v1.3}{2013/03/05}{added support for \texttt{bokkusu} puzzle}
4214 % \changes{v1.4}{2013/03/05}{added support for \texttt{skyline} puzzle}
4215 % \changes{v1.5}{2013/03/05}{added support for \texttt{hakyuu} puzzle}
4216 % \changes{v1.5}{2013/03/13}{added support for \texttt{skyline} and \texttt{chaossudoku} puzzles}
4217 % \changes{v1.6}{2013/03/18}{added support for \texttt{lpsudoku} puzzle}
4218 % \changes{v1.7}{2013/03/28}{added support for \texttt{ddsudoku} puzzle}
4219 % \changes{v1.7}{2013/04/03}{added support for \texttt{hitori} puzzle}
4220 % \changes{v1.8}{2013/04/09}{added support for \texttt{killersudoku} and \texttt{kendokut} puzzles}
4221 % \changes{v1.9}{2013/04/15}{added support for \texttt{slitherlink} puzzle}
4222 % \changes{v1.9}{2013/04/17}{added support for \texttt{laserbeam} puzzle}
4223 % \changes{v2.0}{2013/04/22}{added support for \texttt{minesweeper} puzzle}
4224 % \changes{v2.0}{2013/04/23}{added support for \texttt{tunnel} puzzle}
4225 % \changes{v2.0}{2013/04/30}{moved code from packages to \texttt{logicpuzzle.sty}}
4226 % \changes{v2.1}{2013/05/04}{added support for \texttt{tentsandtrees} puzzle}
4227 % \changes{v2.1}{2013/05/05}{added support for \texttt{kakuro} puzzle}
4228 % \changes{v2.1}{2013/05/06}{added support for \texttt{schatzsuche} puzzle}
4229 % \changes{v2.2}{2013/05/14}{added support for \texttt{sunandmoon} and \texttt{starsandarrows} puzzles}
4230 % \changes{v2.2}{2013/05/15}{added support for \texttt{starbattle} puzzle}
4231 % \changes{v2.2}{2013/05/16}{added support for \texttt{bridges} puzzle}
4232 % \changes{v2.3}{2013/05/27}{added support for \texttt{resuko} puzzle}
4233 % \changes{v2.3}{2013/05/28}{added support for \texttt{fourwinds} puzzle}
4234 % \changes{v2.3}{2013/05/29}{added support for \texttt{numberlink} puzzle}
4235 % \changes{v2.4}{2013/06/03}{added support for \texttt{magiclabyrinth} snd \texttt{masyu} puzzles}
4236 % \changes{v2.4}{2013/06/04}{added support for \texttt{magnets} puzzle}
4237 % \changes{v2.5}{2014/06/13}{added \texttt{LPpreset} Ti\textit{k}Z style to all puzzle environments}
4238 % \changes{v2.5}{2014/06/14}{added support for \texttt{nonogram} puzzle. Feature request by: Theresa Spannbauer}
4239 %
4240 % \subsection{\texttt{logicpuzzle.sty}}
4241 % \begin{macrocode}
4242 %<*package>
4243 \NeedsTeXFormat{LaTeX2e}%
4244 \ProvidesPackage{logicpuzzle}[2014/06/15 v2.5 logicpuzzle.sty%
4245 - Josef Kleber (C) 2013-2014]%
4246 % \end{macrocode}
4247 % \subsubsection{Package initialization}
4248 % First, we load the packages needed by \package{logicpuzzle.sty} and the Ti\textit{k}Z libraries we need.
4249 % \begin{macrocode}
4250 \RequirePackage{xkeyval}%
4251 \RequirePackage{ifthen}%
4252 \RequirePackage{ragged2e}%
4253 \RequirePackage{marginnote}%
4254 \RequirePackage{tikz}%
4255 \usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing,%
4256 calc,shapes.geometric}%
4257 % \end{macrocode}
4258 % We define a set of PGF layers for placing material on them and their order.
4259 % \begin{macrocode}
4260 \pgfdeclarelayer{LPdump}%
4261 \pgfdeclarelayer{LPbgcolor}%
4262 \pgfdeclarelayer{LPbackgroundtwo}%
4263 \pgfdeclarelayer{LPbackground}%
4264 \pgfdeclarelayer{LPforeground}%
4265 \pgfdeclarelayer{LPforegroundtwo}%
4266 \pgfsetlayers{LPdump,LPbgcolor,LPbackgroundtwo,LPbackground,main,%
4267 LPforeground,LPforegroundtwo}%
4268 %
4269 % \end{macrocode}
4270 % We also need some counters and lengths
4271 % \changes{v2.2}{2013/05/07}{reduced counters to \texttt{LP@rows} and \texttt{LP@columns} instead of \texttt{LP@XX@...}}
4272 % \begin{macrocode}
4273 \newcounter{LP@rows}%
4274 \newcounter{LP@columns}%
4275 \newcounter{LP@counter@unique}%
4276 \newcounter{LP@counti}%
4277 \newcounter{LP@countii}%
4278 \newcounter{LP@countiii}%
4279 \newcounter{LP@whiledo@i}%
4280 \newcounter{LP@whiledo@ii}%
4281 \newcounter{LP@count@ig@i}%
4282 \newcounter{LP@count@ig@ii}%
4283 \newcounter{LP@count@ig@iii}%
4284 \newcounter{LP@count@ig@iv}%
4285 \newcounter{LP@puzzlecounter}%
4286 \setcounter{LP@puzzlecounter}{1}%
4287 %
4288 \newlength\LP@length%
4289 % \end{macrocode}
4290 % We define generic macros for puzzle options and add some defaults. Furthermore we define some macros, we will use all over the package.
4291 % \begin{macrocode}
4292 \gdef\LP@rows{}%
4293 \gdef\LP@columns{}%
4294 \gdef\LP@scale{1}%
4295 \gdef\LP@color{black}%
4296 \gdef\LP@bgcolor{}%
4297 \gdef\LP@fontsize\Large%
4298 \gdef\LP@cvoffset{0pt}%
4299 %
4300 \newcommand*\LP@counterstyle{none}%
4301 \newcommand*\LP@titleformat{}%
4302 \gdef\LP@env@prefix{}%
4303 \gdef\LP@package{}%
4304 \def\LP@normallines{0.5pt}%
4305 \def\LP@thicklines{1.5pt}%
4306 \def\LP@grid@linestyle{}%
4307 \def\LP@draw@opacity{1}%
4308 \def\LP@rel@tikzpath{}%
4309 \def\LP@tracks@scale{.3}%
4310 \def\LP@fw@linestyle{-|}%
4311 \newcommand*\LP@Pfive{.5}%
4312 % \end{macrocode}
4313 % \subsubsection{Defining options}
4314 % \begin{macro}{\LP@define@key}
4315 % We define a generic command for the definition of puzzle options
4316 % with both global (for the |\puzzlesetup| commands) and local scope for the optional argument of the puzzles!
4317 %
4318 % \cs{LP@define@key}\marg{puzzle prefix}\marg{puzzle}\marg{option}\marg{default}
4319 % \begin{macrocode}
4320 \newcommand*\LP@define@key[4]%
4321 {%
4322 \expandafter\gdef\csname#1@#3\endcsname{#4}%
4323 \define@key{#2.sty}{#3}[#4]%
4324 {%
4325 \expandafter\gdef\csname#1@#3\endcsname{##1}%
4326 }%
4327 \define@key{#2}{#3}%
4328 {%
4329 \expandafter\def\csname#1@#3\endcsname{##1}%
4330 }%
4331 }%
4332 % \end{macrocode}
4333 % \end{macro}
4334 % \begin{macro}{\LP@define@choicekey@fontsize}
4335 % We do the same for the more complicated |choicekey| for the |fontsize| option.
4336 %
4337 % \cs{LP@define@choicekey@fontsize}\marg{puzzle prefix}\marg{puzzle}\marg{default}
4338 % \begin{macrocode}
4339 \newcommand*\LP@define@choicekey@fontsize[3]%
4340 {%
4341 \expandafter\gdef\csname#1@fontsize\endcsname{\Large}%
4342 \define@choicekey*{#2.sty}{fontsize}[\LP@dck@fontsize\nr]{%
4343 tiny,scriptsize,footnotesize,small,normalsize,%
4344 large,Large,LARGE,huge,Huge}[#3]%
4345 {%
4346 \ifcase\nr\relax%
4347 \expandafter\gdef\csname#1@fontsize\endcsname{\tiny}%
4348 \or%
4349 \expandafter\gdef\csname#1@fontsize\endcsname{\scriptsize}%
4350 \or%
4351 \expandafter\gdef\csname#1@fontsize\endcsname{\footnotesize}%
4352 \or%
4353 \expandafter\gdef\csname#1@fontsize\endcsname{\small}%
4354 \or%
4355 \expandafter\gdef\csname#1@fontsize\endcsname{\normalsize}%
4356 \or%
4357 \expandafter\gdef\csname#1@fontsize\endcsname{\large}%
4358 \or%
4359 \expandafter\gdef\csname#1@fontsize\endcsname{\Large}%
4360 \or%
4361 \expandafter\gdef\csname#1@fontsize\endcsname{\LARGE}%
4362 \or%
4363 \expandafter\gdef\csname#1@fontsize\endcsname{\huge}%
4364 \or%
4365 \expandafter\gdef\csname#1@fontsize\endcsname{\Huge}%
4366 \fi%
4367 }%
4368 \define@choicekey*{#2}{fontsize}[\LP@dck@fontsize\nr]{%
4369 tiny,scriptsize,footnotesize,small,normalsize,%
4370 large,Large,LARGE,huge,Huge}[#3]%
4371 {%
4372 \ifcase\nr\relax%
4373 \expandafter\def\csname#1@fontsize\endcsname{\tiny}%
4374 \or%
4375 \expandafter\def\csname#1@fontsize\endcsname{\scriptsize}%
4376 \or%
4377 \expandafter\def\csname#1@fontsize\endcsname{\footnotesize}%
4378 \or%
4379 \expandafter\def\csname#1@fontsize\endcsname{\small}%
4380 \or%
4381 \expandafter\def\csname#1@fontsize\endcsname{\normalsize}%
4382 \or%
4383 \expandafter\def\csname#1@fontsize\endcsname{\large}%
4384 \or%
4385 \expandafter\def\csname#1@fontsize\endcsname{\Large}%
4386 \or%
4387 \expandafter\def\csname#1@fontsize\endcsname{\LARGE}%
4388 \or%
4389 \expandafter\def\csname#1@fontsize\endcsname{\huge}%
4390 \or%
4391 \expandafter\def\csname#1@fontsize\endcsname{\Huge}%
4392 \fi%
4393 }%
4394 }%
4395 % \end{macrocode}
4396 % \end{macro}
4397 % \subsubsection{Defining colors}
4398 % \begin{macro}{\LP@definecolor}
4399 % We define a command for defining (rgb) colors. For other color models, use
4400 % |xcolor|'s |\definecolor| command.
4401 %
4402 % \cs{LP@definecolor}\marg{name}\marg{rgb color}
4403 % \begin{macrocode}
4404 \newcommand*\LP@definecolor[2]%
4405 {%
4406 \definecolor{#1}{rgb}{#2}%
4407 }%
4408 % \end{macrocode}
4409 % Predefined colors:
4410 % \begin{macrocode}
4411 \LP@definecolor{LP@c@i}{.9,.9,.98}%
4412 \LP@definecolor{LP@c@ii}{.688,.932,.932}%
4413 \LP@definecolor{LP@c@iii}{.88,1,1}%
4414 \LP@definecolor{LP@c@iv}{1,1,.88}%
4415 \LP@definecolor{LP@c@v}{1,.855,.725}%
4416 \LP@definecolor{LP@c@vi}{.498,1,0}%
4417 \LP@definecolor{LP@c@vii}{.53,.808,.98}%
4418 \LP@definecolor{LP@c@viii}{.196,.804,.196}%
4419 \LP@definecolor{LP@c@ix}{1,.96,.932}%
4420 \LP@definecolor{LP@c@griddots}{.25,.51,.33}%
4421 \LP@definecolor{LP@c@cross}{.25,.51,.33}%
4422 \LP@definecolor{LP@c@mirror}{.8,.8,.8}%
4423 \LP@definecolor{LP@c@tunnel}{.7,.7,.7}%
4424 \LP@definecolor{LP@c@tunnel@i}{.8,.8,.8}%
4425 \LP@definecolor{LP@c@tunnel@ii}{.5,.5,.5}%
4426 \LP@definecolor{LP@c@bridge}{1,0,0}%
4427 \colorlet{LP@c@track}{black!80}%
4428 % \end{macrocode}
4429 % \end{macro}
4430 % \subsubsection{Drawing grids}
4431 % \begin{macro}{\LP@drawgrid}
4432 % We define a command for drawing the standard grid used by all puzzles. In general,
4433 % this should be a grid with a step of 1cm and thin lines with size
4434 % (1,1) to ($|columns|+1$,$|rows|+1$). You can influence the grid by redefining
4435 % the |\LP@grid@linestyle| (default: |solid| -- maybe you want |dashed|) and |\LP@draw@opacity|
4436 % (0 (transparent) -- 1 (opaque)). They should be changed only within groups, like puzzle environment definitions.
4437 %
4438 % \cs{LP@drawgrid}\marg{xmin}\marg{ymin}\marg{xmax}\marg{ymax}\marg{step}
4439 % \begin{macrocode}
4440 \newcommand*\LP@drawgrid[5]%
4441 {%
4442 \setcounter{LP@counti}{#3}% max column
4443 \setcounter{LP@countii}{#4}% max row
4444 \stepcounter{LP@counti}%
4445 \stepcounter{LP@countii}%
4446 \draw[step=#5,line width=\LP@normallines,\LP@grid@linestyle,%
4447 draw opacity=\LP@draw@opacity]%
4448 (#1,#2) grid (\value{LP@counti},\value{LP@countii});%
4449 }%
4450 % \end{macrocode}
4451 % \end{macro}
4452 % \subsubsection{Drawing the puzzle background}
4453 % \begin{macro}{\LP@drawbackground}
4454 % For drawing the puzzle background, we simply draw a rectangle with the size
4455 % of the puzzle on the \layer{LPbgcolor} layer and fill it with \marg{bgcolor}.
4456 %
4457 % \cs{LP@drawbackground}\marg{xmin}\marg{ymin}\marg{xmax}\marg{ymax}\marg{bgcolor}
4458 % \begin{macrocode}
4459 \newcommand*\LP@drawbackground[5]%
4460 {%
4461 % \end{macrocode}
4462 % Of course, we only draw a background, if \marg{bgcolor} is not empty!
4463 % \begin{macrocode}
4464 \ifthenelse{\equal{#5}{}}%
4465 {}% no bgcolor
4466 {%
4467 \setcounter{LP@counti}{#3}% max column
4468 \setcounter{LP@countii}{#4}% max row
4469 \stepcounter{LP@counti}%
4470 \stepcounter{LP@countii}%
4471 \begin{pgfonlayer}{LPbgcolor}%
4472 \fill[color=#5] (#1,#2) rectangle%
4473 (\value{LP@counti},\value{LP@countii});%
4474 \end{pgfonlayer}%
4475 }%
4476 }%
4477 % \end{macrocode}
4478 % \end{macro}
4479 % \subsubsection{In the grid}
4480 % \changes{v1.1}{2013/02/11}{implemented \cmd\BS@ingrid\ checks if coordinate is in the grid $\rightarrow$ PackageError}
4481 % \begin{macro}{\LP@ingrid}
4482 % With this macro, we can check if the specified |column| and |row| is within
4483 % the puzzle borders. Otherwise we issue en error message. This macro can be used
4484 % by higher level commands, which try to place something in the grid.
4485 %
4486 % \cs{LP@ingrid}\marg{column}\marg{row}\marg{max column}\marg{max row}\marg{package}
4487 % \begin{macrocode}
4488 \newcommand*\LP@ingrid[5]%
4489 {%
4490 % \end{macrocode}
4491 % First, we define some counters to store the arguments.
4492 % \begin{macrocode}
4493 \setcounter{LP@count@ig@i}{#1}% column
4494 \setcounter{LP@count@ig@ii}{#2}% row
4495 \setcounter{LP@count@ig@iii}{#3}% max column
4496 \setcounter{LP@count@ig@iv}{#4}% max row
4497 % \end{macrocode}
4498 % Then, we can check, if the specified |coordinate| is within the borders of the puzzle.
4499 % \begin{macrocode}
4500 \ifnum\value{LP@count@ig@i}<1%
4501 \PackageError{#5}%
4502 {element outside of the grid}%
4503 {You tried to set an element at (#1,#2),\MessageBreak%
4504 which is outside the grid (1,1) .. (#3,#4)}%
4505 \fi%
4506 \ifnum\value{LP@count@ig@ii}<1%
4507 \PackageError{#5}%
4508 {element outside of the grid}%
4509 {You tried to set an element at (#1,#2),\MessageBreak%
4510 which is outside the grid (1,1) .. (#3,#4)}%
4511 \fi%
4512 \ifnum\value{LP@count@ig@i}>\value{LP@count@ig@iii}%
4513 \PackageError{#5}%
4514 {element outside of the grid}%
4515 {You tried to set an element at (#1,#2),\MessageBreak%
4516 which is outside the grid (1,1) .. (#3,#4)}%
4517 \fi%
4518 \ifnum\value{LP@count@ig@ii}>\value{LP@count@ig@iv}%
4519 \PackageError{#5}%
4520 {element outside of the grid}%
4521 {You tried to set an element at (#1,#2),\MessageBreak%
4522 which is outside the grid (1,1) .. (#3,#4)}%
4523 \fi%
4524 }%
4525 % \end{macrocode}
4526 % \end{macro}
4527 % \begin{macro}{\setrule}
4528 % For the \env{kendoku} and \env{killersudoku} environments, we need a command to
4529 % place a calculation rule in the top left corner of the specified cell.
4530 %
4531 % \cs{setrule}\marg{column}\marg{row}\marg{rule}
4532 % \begin{macrocode}
4533 \newcommand*\setrule[3]%
4534 {%
4535 % \end{macrocode}
4536 % First, we copy the |scale| and |bgcolor| values from the current environment.
4537 % \begin{macrocode}
4538 \LP@set@LP@scale{\LP@env@prefix}%
4539 \LP@set@LP@bgcolor{\LP@env@prefix}%
4540 % \end{macrocode}
4541 % If no |bgcolor| is specified, we use |white| for drawing our helper rectangle.
4542 % We also step our unique node counter, we need for referencing nodes between different layers.
4543 % \begin{macrocode}
4544 \ifthenelse{\equal{\LP@bgcolor}{}}%
4545 {\gdef\LP@sr@bgcolor{white}}%
4546 {\gdef\LP@sr@bgcolor{\LP@bgcolor}}%
4547 \stepcounter{LP@counter@unique}%
4548 % \end{macrocode}
4549 % First, we draw a (invisible) helper rectangle on the \layer{LPdump} layer (behind the
4550 % \layer{LPbgcolor} layer) in the node |A_\theLP@counter@unique|
4551 % \begin{macrocode}
4552 \begin{pgfonlayer}{LPdump}%
4553 \node [shape=rectangle,inner sep=0pt] (A_\theLP@counter@unique)%
4554 at (#1\LP@Pfive,#2\LP@Pfive)%
4555 {\tikz\draw[scale=\LP@scale,color=\LP@sr@bgcolor]%
4556 (0.08,0.1) rectangle (0.92,0.9);};%
4557 \end{pgfonlayer}%
4558 % \end{macrocode}
4559 % Then, we can place a visible node on the \layer{main} layer in the top left corner
4560 % of the invisible helper rectangle with the rule (size: $|\tiny|\times|scale|$).
4561 % \begin{macrocode}
4562 \node [shape=rectangle,inner sep=0pt,anchor=north west,%
4563 scale=\LP@scale,font=\tiny] at%
4564 (A_\theLP@[email protected] west) {$#3$};%
4565 }%
4566 % \end{macrocode}
4567 % \end{macro}
4568 % \begin{macro}{\LP@G@setcellcontent}
4569 % Here, we define a generic macro for placing material into nodes
4570 % placed in the bottom left corner of the grid cell. You can use
4571 % the options |vcenter| and |hcenter| in the optional argument \oarg{options}
4572 % of the macro to center the content horizontally and/or vertically.
4573 %
4574 % \cs{LP@G@setcellcontent}\oarg{options}\marg{column}\marg{row}\marg{content}
4575 % \begin{macrocode}
4576 \define@key{LP@G@setcellcontent}{vcenter}[\LP@Pfive]%
4577 {%
4578 \def\LP@scc@v{\LP@Pfive}%
4579 }%
4580 \define@key{LP@G@setcellcontent}{hcenter}[\LP@Pfive]%
4581 {%
4582 \def\LP@scc@h{\LP@Pfive}%
4583 }%
4584 %
4585 \newcommand*\LP@G@setcellcontent[4][]%
4586 {%
4587 \def\LP@scc@h{}%
4588 \def\LP@scc@v{}%
4589 \setkeys{LP@G@setcellcontent}{#1}%
4590 \node at (#2\LP@scc@h,#3\LP@scc@v){#4};%
4591 }%
4592 % \end{macrocode}
4593 % \end{macro}
4594 % \begin{macro}{\LP@setcellcontent}
4595 % For compatibility, we still provide the old |\LP@setcellcontentXY| macros.
4596 % \begin{macrocode}
4597 \newcommand*\LP@setcellcontent[3]%
4598 {%
4599 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{#3}%
4600 }%
4601 % \end{macrocode}
4602 % \end{macro}
4603 % \begin{macro}{\LP@setcellcontentC}
4604 % \begin{macrocode}
4605 \newcommand*\LP@setcellcontentC[3]%
4606 {%
4607 \LP@G@setcellcontent{#1}{#2}{#3}%
4608 }%
4609 % \end{macrocode}
4610 % \end{macro}
4611 % \begin{macro}{\LP@setcellcontentVE}
4612 % \begin{macrocode}
4613 \newcommand*\LP@setcellcontentVE[3]%
4614 {%
4615 \LP@G@setcellcontent[vcenter]{#1}{#2}{#3}%
4616 }%
4617 % \end{macrocode}
4618 % \end{macro}
4619 % \begin{macro}{\LP@setcellcontentHE}
4620 % \begin{macrocode}
4621 \newcommand*\LP@setcellcontentHE[3]%
4622 {%
4623 \LP@G@setcellcontent[hcenter]{#1}{#2}{#3}%
4624 }%
4625 % \end{macrocode}
4626 % \end{macro}
4627 % \begin{macro}{\LP@setrowcontents}
4628 % \changes{v1.3}{2013/02/26}{Bugfix: mix up column and row}
4629 % We want also be able to set the contents of a complete row.
4630 %
4631 % \cs{LP@setrowcontents}\marg{csv list}\marg{column}\marg{row}
4632 % \begin{macrocode}
4633 \newcommand*\LP@setrowcontents[3]%
4634 {%
4635 % \end{macrocode}
4636 % We copy |fontsize| from the current environment, if we want to typeset numbers or letters.
4637 % \begin{macrocode}
4638 \LP@set@LP@fontsize{\LP@env@prefix}%
4639 \setcounter{LP@counti}{#2}%
4640 \setcounter{LP@countii}{#3}%
4641 % \end{macrocode}
4642 % We loop through the list and create a centered node in cell (|column|,|row|). Finally, we step the |column| counter.
4643 % \begin{macrocode}
4644 \foreach \LP@element in {#1}%
4645 {%
4646 \LP@G@setcellcontent[vcenter,hcenter]%
4647 {\arabic{LP@counti}}{\arabic{LP@countii}}%
4648 {\LP@fontsize\LP@element}%
4649 \stepcounter{LP@counti}%
4650 }%
4651 }%
4652 % \end{macrocode}
4653 % \end{macro}
4654 % \begin{macro}{\LP@setcolumncontents}
4655 % \changes{v1.3}{2013/02/26}{Bugfix: mix up column and row}
4656 % Of course, we want to do the same for columns.
4657 %
4658 % \cs{LP@setcolumncontens}\marg{csv list}\marg{column}\marg{row}
4659 % \begin{macrocode}
4660 \newcommand*\LP@setcolumncontents[3]%
4661 {%
4662 \LP@set@LP@fontsize{\LP@env@prefix}%
4663 \setcounter{LP@counti}{#2}%
4664 \setcounter{LP@countii}{#3}%
4665 \foreach \LP@element in {#1}%
4666 {%
4667 \LP@G@setcellcontent[vcenter,hcenter]%
4668 {\arabic{LP@counti}}{\arabic{LP@countii}}%
4669 {\LP@fontsize\LP@element}%
4670 \stepcounter{LP@countii}%
4671 }%
4672 }%
4673 % \end{macrocode}
4674 % \end{macro}
4675 % \begin{macro}{\LP@setrowcontents@edge}
4676 % For environments like \env{laserbeam}, we need to typeset |row| contents on the left
4677 % border of the cell, instead of centered. Therfore, we only use |vcenter|.
4678 %
4679 % \cs{LP@setrowcontents@edge}\marg{csv list}\marg{column}\marg{row}
4680 % \begin{macrocode}
4681 \newcommand*\LP@setrowcontents@edge[3]%
4682 {%
4683 \LP@set@LP@fontsize{\LP@env@prefix}%
4684 \setcounter{LP@counti}{#2}%
4685 \setcounter{LP@countii}{#3}%
4686 \foreach \LP@element in {#1}%
4687 {%
4688 \LP@G@setcellcontent[vcenter]%
4689 {\arabic{LP@counti}}{\arabic{LP@countii}}%
4690 {\LP@fontsize\LP@element}%
4691 \stepcounter{LP@counti}%
4692 }%
4693 }%
4694 % \end{macrocode}
4695 % \end{macro}
4696 % \begin{macro}{\LP@setcolumncontents@edge}
4697 % Furthermore, we need the ability to typeset a column on the bottom border of a
4698 % cell (|hcenter|).
4699 %
4700 % \cs{LP@setcolumncontents@edge}\marg{csv list}\marg{column}\marg{row}
4701 % \begin{macrocode}
4702 \newcommand*\LP@setcolumncontents@edge[3]%
4703 {%
4704 \LP@set@LP@fontsize{\LP@env@prefix}%
4705 \setcounter{LP@counti}{#2}%
4706 \setcounter{LP@countii}{#3}%
4707 \foreach \LP@element in {#1}%
4708 {%
4709 \LP@G@setcellcontent[hcenter]%
4710 {\arabic{LP@counti}}{\arabic{LP@countii}}%
4711 {\LP@fontsize\LP@element}%
4712 \stepcounter{LP@countii}%
4713 }%
4714 }%
4715 % \end{macrocode}
4716 % \end{macro}
4717 % \begin{macro}{\setrow}
4718 % \changes{v1.4}{2013/03/05}{added \cmd\setrow}
4719 % The user command for typesetting row contents.
4720 %
4721 % \cs{setrow}\marg{row}\marg{csv list}
4722 % \begin{macrocode}
4723 \newcommand*\setrow[2]%
4724 {%
4725 % \end{macrocode}
4726 % First, we copy |scale|, which might be necessary for graphical objects, like \cs{Mine}.
4727 % Then, we hand over the arguments to the generic macro for typesetting |row| contents and start with |column| 1.
4728 % \begin{macrocode}
4729 \LP@set@LP@scale{\LP@env@prefix}%
4730 \LP@setrowcontents{#2}{1}{#1}%
4731 }%
4732 % \end{macrocode}
4733 % \end{macro}
4734 % \begin{macro}{\setcolumn}
4735 % \changes{v1.4}{2013/03/05}{added \cmd\setcolumn}
4736 % Again, we do the same for columns.
4737 %
4738 % \cs{setcolumn}\marg{column}\marg{csv list}
4739 % \begin{macrocode}
4740 \newcommand*\setcolumn[2]%
4741 {%
4742 \LP@set@LP@scale{\LP@env@prefix}%
4743 \LP@setcolumncontents{#2}{#1}{1}%
4744 }%
4745 % \end{macrocode}
4746 % \end{macro}
4747 % \begin{macro}{\setcell}
4748 % \changes{v1.4}{2013/03/06}{added \cmd\setcell}
4749 % We need to set numbers, letters or a graphical object into a central node
4750 % in grid cell (|column|,|row|)
4751 %
4752 % \cs{setcell}\marg{column}\marg{row}\marg{element}
4753 % \begin{macrocode}
4754 \newcommand*\setcell[3]%
4755 {%
4756 % \end{macrocode}
4757 % First, we copy |scale|, |fontsize|, |rows| and |columns| from the current environment.
4758 % \begin{macrocode}
4759 \LP@set@LP@scale{\LP@env@prefix}%
4760 \LP@set@LP@fontsize{\LP@env@prefix}%
4761 \LP@set@LP@rows{\LP@env@prefix}%
4762 \LP@set@LP@columns{\LP@env@prefix}%
4763 % \end{macrocode}
4764 % Then, we test if (\marg{column},\marg{row}) is within the borders of the puzzle.
4765 % Finally, we typeset \marg{element} into a central node.
4766 % \begin{macrocode}
4767 \LP@ingrid{#1}{#2}{\LP@columns}{\LP@rows}{\LP@package}%
4768 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{\LP@fontsize#3}%
4769 }%
4770 % \end{macrocode}
4771 % \end{macro}
4772 % \begin{macro}{\setcells}
4773 % \changes{v2.4}{2013/06/03}{added \cmd\setcells}
4774 % We also want to typeset the same element into several grid cells.
4775 % Therefore, we use a \marg{csv list} with the format: \marg{|column/row|, ...}
4776 %
4777 % \cs{setcells}\marg{csv list}\marg{element}
4778 % \begin{macrocode}
4779 \newcommand*\setcells[2]%
4780 {%
4781 \LP@set@LP@scale{\LP@env@prefix}%
4782 \LP@set@LP@fontsize{\LP@env@prefix}%
4783 \LP@set@LP@rows{\LP@env@prefix}%
4784 \LP@set@LP@columns{\LP@env@prefix}%
4785 \foreach \LP@sc@column/\LP@sc@row in {#1}%
4786 {%
4787 \LP@ingrid{\LP@sc@column}{\LP@sc@row}%
4788 {\LP@columns}{\LP@rows}{\LP@package}%
4789 \LP@G@setcellcontent[hcenter,vcenter]%
4790 {\LP@sc@column}{\LP@sc@row}{\LP@fontsize#2}%
4791 };%
4792 }%
4793 % \end{macrocode}
4794 % \end{macro}
4795 % \begin{macro}{\setbigcell}
4796 % For the \env{slitherlink} environment, we need to typeset a huge ($2\times 2$) grid cell.
4797 %
4798 % \cs{setbigcell}\oarg{fontsize}\marg{column}\marg{row}\marg{element}
4799 % \begin{macrocode}
4800 \newcommand*\setbigcell[4][Huge]%
4801 {%
4802 % \end{macrocode}
4803 % First, we copy |scale| and |bgcolor|. If |bgcolor| is not specified, we assume |bgcolor| is || white!
4804 % \begin{macrocode}
4805 \LP@set@LP@scale{\LP@env@prefix}%
4806 \LP@set@LP@bgcolor{\LP@env@prefix}%
4807 \ifthenelse{\equal{\LP@bgcolor}{}}%
4808 {\gdef\LP@sbc@bgcolor{white}}%
4809 {\gdef\LP@sbc@bgcolor{\LP@bgcolor}}%
4810 % \end{macrocode}
4811 % The center of ($2\times 2$) cell is the bottom left corner of ($|column|+1,|row|+1$)
4812 % \begin{macrocode}
4813 \setcounter{LP@counti}{#2}%
4814 \setcounter{LP@countii}{#3}%
4815 \stepcounter{LP@counti}%
4816 \stepcounter{LP@countii}%
4817 % \end{macrocode}
4818 % First, we 'clear' ($2\times 2$) area with |bgcolor| and respect the grid line style.
4819 % \begin{macrocode}
4820 \draw[line width=\LP@normallines,fill=\LP@sbc@bgcolor,%
4821 \LP@grid@linestyle]%
4822 (#2,#3) rectangle ++(2,2);%
4823 % \end{macrocode}
4824 % As the grid dots were drawn on the \layer{LPforeground} layer, we have to
4825 % 'overpaint' the center dot on the \layer{LPforegroundtwo} layer with |bgcolor|.
4826 % Finally, we can typeset \marg{element}.
4827 % \begin{macrocode}
4828 \begin{pgfonlayer}{LPforegroundtwo}%
4829 \fill[color=\LP@sbc@bgcolor]%
4830 (\arabic{LP@counti},\arabic{LP@countii})%
4831 circle [radius=3.5pt*\LP@scale];%
4832 \node at (\arabic{LP@counti},\arabic{LP@countii})%
4833 {\csname#1\endcsname#4};%
4834 \end{pgfonlayer}%
4835 }%
4836 % \end{macrocode}
4837 % \end{macro}
4838 % \begin{macro}{\setcolorrow}
4839 % For the \env{hitori} environment, we need to typeset row contents
4840 % with numbers associated to background colors.
4841 %
4842 % \cs{setcolorrow}\marg{row}\marg{csv list}
4843 % \begin{macrocode}
4844 \newcommand*\setcolorrow[2]%
4845 {%
4846 % \end{macrocode}
4847 % We start at |column| 1 and loop through \marg{csv list}
4848 % \begin{macrocode}
4849 \setcounter{LP@counti}{1}%
4850 \setcounter{LP@countii}{#1}%
4851 \foreach \LP@element in {#2}%
4852 {%
4853 % \end{macrocode}
4854 % If the list element is 0, we fill the cell |black| on the \layer{LPbackground} layer.
4855 % \begin{macrocode}
4856 \ifthenelse{\equal{\LP@element}{0}}%
4857 {%
4858 \gdef\LP@HT@color{black}%
4859 \begin{puzzlebackground}%
4860 \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}%
4861 \end{puzzlebackground}%
4862 }%
4863 {%
4864 % \end{macrocode}
4865 % Otherwise, we fill the cell with predefined color |LP@c@romannumber| on the
4866 % \layer{LPbackground} layer and typeset the list element into the grid cell.
4867 % \begin{macrocode}
4868 \expandafter\gdef\expandafter\LP@HT@color%
4869 {LP@c@\romannumeral\LP@element}%
4870 \begin{puzzlebackground}%
4871 \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}%
4872 \end{puzzlebackground}%
4873 \setcell{\arabic{LP@counti}}{\arabic{LP@countii}}{\LP@element}%
4874 }%
4875 \stepcounter{LP@counti}%
4876 }%
4877 }%
4878 % \end{macrocode}
4879 % \end{macro}
4880 % \begin{macro}{\setcolorcolumn}
4881 % Again, the same for columns.
4882 % \begin{macrocode}
4883 \newcommand*\setcolorcolumn[2]%
4884 {%
4885 \setcounter{LP@counti}{#1}%
4886 \setcounter{LP@countii}{1}%
4887 \foreach \LP@element in {#2}%
4888 {%
4889 \ifthenelse{\equal{\LP@element}{0}}%
4890 {%
4891 \gdef\LP@HT@color{black}%
4892 \begin{puzzlebackground}%
4893 \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}%
4894 \end{puzzlebackground}%
4895 }%
4896 {%
4897 \expandafter\gdef\expandafter\LP@HT@color%
4898 {LP@c@\romannumeral\LP@element}%
4899 \begin{puzzlebackground}%
4900 \fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}%
4901 \end{puzzlebackground}%
4902 \setcell{\arabic{LP@counti}}{\arabic{LP@countii}}{\LP@element}%
4903 }%
4904 \stepcounter{LP@countii}%
4905 }%
4906 }%
4907 % \end{macrocode}
4908 % \end{macro}
4909 % \begin{macro}{\fillcell}
4910 % \changes{v1.3}{2013/02/26}{added \cmd\LP@ingrid\ to \cmd\fillcell}
4911 % Sometimes, we need to 'blacken' a grid cell.
4912 %
4913 % \cs{fillcell}\marg{column}\marg{row}
4914 % \begin{macrocode}
4915 \newcommand*\fillcell[2]%
4916 {%
4917 \LP@set@LP@scale{\LP@env@prefix}%
4918 \LP@set@LP@color{\LP@env@prefix}%
4919 \LP@set@LP@rows{\LP@env@prefix}%
4920 \LP@set@LP@columns{\LP@env@prefix}%
4921 % \end{macrocode}
4922 % After a border check, we typeset a black block (\cs{LP@Block}) into the grid cell.
4923 % \begin{macrocode}
4924 \LP@ingrid{#1}{#2}{\LP@columns}{\LP@rows}{\LP@package}%
4925 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{\LP@Block}%
4926 }%
4927 % \end{macrocode}
4928 % \end{macro}
4929 % \begin{macro}{\fillrow}
4930 % We also want to allow the filling of (parts of a) row.
4931 %
4932 % \cs{fillrow}\marg{row}\marg{csv list}
4933 % \begin{macrocode}
4934 \newcommand*\fillrow[2]%
4935 {%
4936 \setcounter{LP@counti}{1}%
4937 \setcounter{LP@countii}{#1}%
4938 \foreach \LP@element in {#2}%
4939 {%
4940 % \end{macrocode}
4941 % We loop through the list and if |element| is 1, we fill this grid cell.
4942 % \begin{macrocode}
4943 \ifthenelse{\equal{\LP@element}{1}}%
4944 {\fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}}%
4945 {}%
4946 \stepcounter{LP@counti}%
4947 }%
4948 }%
4949 % \end{macrocode}
4950 % \end{macro}
4951 % \begin{macro}{\fillcolumn}
4952 % Again the same, for columns!
4953 %
4954 % \cs{fillcolumn}\marg{column}\marg{csv list}
4955 % \begin{macrocode}
4956 %
4957 \newcommand*\fillcolumn[2]%
4958 {%
4959 \setcounter{LP@counti}{#1}%
4960 \setcounter{LP@countii}{1}%
4961 \foreach \LP@element in {#2}%
4962 {%
4963 \ifthenelse{\equal{\LP@element}{1}}%
4964 {\fillcell{\arabic{LP@counti}}{\arabic{LP@countii}}}%
4965 {}%
4966 \stepcounter{LP@countii}%
4967 }%
4968 }%
4969 % \end{macrocode}
4970 % \end{macro}
4971 % \begin{macro}{\framearea}
4972 % \changes{v1.4}{2013/03/06}{added \cmd\framearea}
4973 % Sometimes, we need to frame a specified area.
4974 %
4975 % \cs{framearea}\marg{color}\marg{TikZ path}
4976 % \begin{macrocode}
4977 \newcommand*\framearea[2]%
4978 {%
4979 \draw[line width=\LP@thicklines,color=#1] #2;%
4980 }%
4981 % \end{macrocode}
4982 % \end{macro}
4983 % \begin{macro}{\fillarea}
4984 % \changes{v1.4}{2013/03/06}{added \cmd\fillarea}
4985 % Sometimes, we even want to fill the area.
4986 %
4987 % \cs{fillarea}\marg{color}\marg{TikZ path}
4988 % \begin{macrocode}
4989 \newcommand*\fillarea[2]%
4990 {%
4991 \draw[line width=\LP@thicklines,fill=#1] #2;%
4992 }%
4993 % \end{macrocode}
4994 % \end{macro}
4995 % \begin{macro}{\colorarea}
4996 % \changes{v1.8}{2013/04/09}{added \cmd\colorarea\ (\cmd\framearea\ without frame)}
4997 % In some cases it might be better just to fill the area without drawing a frame.
4998 %
4999 % \cs{colorarea}\marg{color}\marg{TikZ path}
5000 % \begin{macrocode}
5001 \newcommand*\colorarea[2]%
5002 {%
5003 \fill[color=#1] #2 ;%
5004 }%
5005 % \end{macrocode}
5006 % \end{macro}
5007 % \begin{macro}{\tikzpath}
5008 % Using a \marg{Tikz path} can be cumbersome. \cs{tikzpath} construct a path starting at the
5009 % bottom left corner of grid cell (|column|,|row|). If want to start in the center of the cell,
5010 % redefine \cs{LP@rel@tikzpath} to |.5| inside a group! Inside \marg{csv list of relative moves},
5011 % you can specify relative movements from one grid cell to the next based on num pad
5012 % (4 $\rightarrow$ one cell right, 2 $\rightarrow$ one cell down and 9 $\rightarrow$
5013 % one cell right up).
5014 %
5015 % \cs{tikzpath}\marg{column}\marg{row}\marg{csv list of relative movement}
5016 % \begin{macrocode}
5017 \newcommand*\tikzpath[3]%
5018 {%
5019 % \end{macrocode}
5020 % starting point
5021 % \begin{macrocode}
5022 (#1\LP@rel@tikzpath,#2\LP@rel@tikzpath)%
5023 % \end{macrocode}
5024 % We loop through the list and add a relative path segment based on the direction indicator.
5025 % \begin{macrocode}
5026 \foreach \LP@direction in {#3}%
5027 {%
5028 \ifnum\LP@direction=1%
5029 --++(-1,-1)%
5030 \fi%
5031 \ifnum\LP@direction=2%
5032 --++(0,-1)%
5033 \fi%
5034 \ifnum\LP@direction=3%
5035 --++(1,-1)%
5036 \fi%
5037 \ifnum\LP@direction=4%
5038 --++(-1,0)%
5039 \fi%
5040 \ifnum\LP@direction=6%
5041 --++(1,0)%
5042 \fi%
5043 \ifnum\LP@direction=7%
5044 --++(-1,1)%
5045 \fi%
5046 \ifnum\LP@direction=8%
5047 --++(0,1)%
5048 \fi%
5049 \ifnum\LP@direction=9%
5050 --++(1,1)%
5051 \fi%
5052 };%
5053 }%
5054 % \end{macrocode}
5055 % \end{macro}
5056 % \begin{macro}{\xtikzpath}
5057 % \cs{xtikzpath} is based on \cs{tikzpath} with a slightly different format in
5058 % \marg{csv list of relative movements}. It allows pairs of |direction/length|, e.g.
5059 % (6/2) means two cells right.
5060 %
5061 % \cs{xtikzpath}\marg{column}\marg{row}\marg{csv list of relative movements}
5062 % \begin{macrocode}
5063 \newcommand*\xtikzpath[3]%
5064 {%
5065 (#1\LP@rel@tikzpath,#2\LP@rel@tikzpath)%
5066 \foreach \LP@dir/\LP@plength in {#3}%
5067 {%
5068 \ifnum\LP@dir=1%
5069 --++(-\LP@plength,-\LP@plength)%
5070 \fi%
5071 \ifnum\LP@dir=2%
5072 --++(0,-\LP@plength)%
5073 \fi%
5074 \ifnum\LP@dir=3%
5075 --++(\LP@plength,-\LP@plength)%
5076 \fi%
5077 \ifnum\LP@dir=4%
5078 --++(-\LP@plength,0)%
5079 \fi%
5080 \ifnum\LP@dir=6%
5081 --++(\LP@plength,0)%
5082 \fi%
5083 \ifnum\LP@dir=7%
5084 --++(-\LP@plength,\LP@plength)%
5085 \fi%
5086 \ifnum\LP@dir=8%
5087 --++(0,\LP@plength)%
5088 \fi%
5089 \ifnum\LP@dir=9%
5090 --++(\LP@plength,\LP@plength)%
5091 \fi%
5092 };%
5093 }%
5094 % \end{macrocode}
5095 % \end{macro}
5096 % \begin{macro}{\filldiagonals}
5097 % For some puzzles we need colored diagonals indicating that also the diagonals are relevant,
5098 % not just rows and columns.
5099 %
5100 % \cs{filldiagonals}\oarg{color}
5101 % \begin{macrocode}
5102 \newcommand*\filldiagonals[1][yellow!20]%
5103 {%
5104 % \end{macrocode}
5105 % We copy and get |scale|, |$rows+1$| and |$columns+1$|,
5106 % \begin{macrocode}
5107 \LP@set@LP@columns{\LP@env@prefix}%
5108 \LP@set@LP@rows{\LP@env@prefix}%
5109 \LP@set@LP@scale{\LP@env@prefix}%
5110 \setcounter{LP@counti}{\LP@columns}%
5111 \setcounter{LP@countii}{\LP@rows}%
5112 \stepcounter{LP@counti}%
5113 \stepcounter{LP@countii}%
5114 % \end{macrocode}
5115 % We only color the diagonals, if the puzzle is quadratic. Otherwise, coloring diagonals
5116 % doen't make sense and we issue an error.
5117 % \begin{macrocode}
5118 \ifnum\value{LP@counti}=\value{LP@countii}%
5119 % \end{macrocode}
5120 % We color the diagonals on the \layer{LPbackground} layer and redefine \cs{LP@color}
5121 % (for \cs{LP@Block}) inside a group with local scope.
5122 % \begin{macrocode}
5123 \begin{puzzlebackground}%
5124 \def\LP@color{#1}%
5125 % \end{macrocode}
5126 % We use two counters running from (|1 .. rows|) and (|rows .. 1|) and color the cells
5127 % on the diagonals in a loop.
5128 % \begin{macrocode}
5129 \setcounter{LP@whiledo@i}{1}%
5130 \setcounter{LP@whiledo@ii}{\LP@rows}%
5131 \whiledo{\value{LP@whiledo@i}<\value{LP@counti}}%
5132 {%
5133 \LP@G@setcellcontent[hcenter,vcenter]%
5134 {\arabic{LP@whiledo@i}}{\arabic{LP@whiledo@i}}{\LP@Block}%
5135 \LP@G@setcellcontent[hcenter,vcenter]%
5136 {\arabic{LP@whiledo@i}}{\arabic{LP@whiledo@ii}}{\LP@Block}%
5137 \stepcounter{LP@whiledo@i}%
5138 \addtocounter{LP@whiledo@ii}{-1}%
5139 }%
5140 \end{puzzlebackground}%
5141 \else%
5142 \PackageError{\LP@package}%
5143 {non quadratic grid (\filldiagonals)}%
5144 {You tried to fill diagonals,\MessageBreak in a non quadratic%
5145 grid (1,1) .. (\arabic{LP@counti},\arabic{LP@countii})%
5146 \MessageBreak doesn't make sense!}%
5147 \fi%
5148 }%
5149 % \end{macrocode}
5150 % \end{macro}
5151 % \begin{macro}{\framepuzzle}
5152 % \changes{v2.3}{2013/05/28}{Bugfix: \cmd\framepuzzle\ only worked correctly for quadratic puzzles}
5153 % We might want to frame the puzzle with a thicker line.
5154 %
5155 % \cs{framepuzzle}\oarg{color}
5156 % \begin{macrocode}
5157 \newcommand*\framepuzzle[1][black]%
5158 {%
5159 \LP@set@LP@columns{\LP@env@prefix}%
5160 \LP@set@LP@rows{\LP@env@prefix}%
5161 \setcounter{LP@counti}{\LP@columns}%
5162 \setcounter{LP@countii}{\LP@rows}%
5163 \stepcounter{LP@counti}%
5164 \stepcounter{LP@countii}%
5165 % \end{macrocode}
5166 % We copied |rows| and |columns| to get the top right corner of the puzzle.
5167 % Now, we can draw the thicker lines.
5168 % \begin{macrocode}
5169 \draw[line width=\LP@thicklines,color=#1]%
5170 (1,1)--(1,\arabic{LP@countii});%
5171 \draw[line width=\LP@thicklines,color=#1]%
5172 (1,\arabic{LP@countii})--%
5173 (\arabic{LP@counti},\arabic{LP@countii});%
5174 \draw[line width=\LP@thicklines,color=#1]%
5175 (\arabic{LP@counti},\arabic{LP@countii})--%
5176 (\arabic{LP@counti},1);%
5177 \draw[line width=\LP@thicklines,color=#1]%
5178 (\arabic{LP@counti},1)--(1,1);%
5179 }%
5180 % \end{macrocode}
5181 % \end{macro}
5182 % \begin{environment}{puzzlebackground}
5183 % \changes{v1.4}{2013/03/06}{added \env{puzzlebackground}}
5184 % Sometimes, we want to move material to the \layer{LPbackground} layer.
5185 % \begin{macrocode}
5186 \newenvironment{puzzlebackground}%
5187 {%
5188 \begin{pgfonlayer}{LPbackground}%
5189 }%
5190 {%
5191 \end{pgfonlayer}%
5192 }%
5193 % \end{macrocode}
5194 % \end{environment}
5195 % \begin{environment}{puzzleforeground}
5196 % \changes{v1.4}{2013/03/06}{added \env{puzzleforeground}}
5197 % Sometimes, we want to move material to the \layer{LPforeground} layer.
5198 % \begin{macrocode}
5199 \newenvironment{puzzleforeground}%
5200 {%
5201 \begin{pgfonlayer}{LPforeground}%
5202 }%
5203 {%
5204 \end{pgfonlayer}%
5205 }%
5206 % \end{macrocode}
5207 % \end{environment}
5208 % \subsubsection{Around the grid}
5209 %
5210 % For most puzzles, we need to put numbers below, above, to the right or to the left of the puzzle.
5211 % \begin{macro}{\LP@bottomrow}
5212 % Put numbers below the puzzle.
5213 %
5214 % \cs{LP@bottomrow}\marg{csv list}
5215 % \begin{macrocode}
5216 \newcommand*\LP@bottomrow[1]%
5217 {%
5218 \LP@setrowcontents{#1}{1}{0}%
5219 }%
5220 % \end{macrocode}
5221 % \end{macro}
5222 % \begin{macro}{\LP@bottomrow@edge}
5223 % Put numbers below the puzzle, but on the edge.
5224 %
5225 % \cs{LP@bottomrow@edge}\marg{csv list}
5226 % \begin{macrocode}
5227 \newcommand*\LP@bottomrow@edge[1]%
5228 {%
5229 \LP@setrowcontents@edge{#1}{1}{0}%
5230 }%
5231 % \end{macrocode}
5232 % \end{macro}
5233 % \begin{macro}{\LP@leftcolumn}
5234 % Put numbers left to the puzzle.
5235 %
5236 % \cs{LP@leftcolumn}\marg{csv list}
5237 % \begin{macrocode}
5238 \newcommand*\LP@leftcolumn[1]%
5239 {%
5240 \LP@setcolumncontents{#1}{0}{1}%
5241 }%
5242 % \end{macrocode}
5243 % \end{macro}
5244 % \begin{macro}{\LP@toprow}
5245 % Put number on top of the puzzle.
5246 %
5247 % \cs{LP@toprow}\marg{csv list}
5248 % \begin{macrocode}
5249 \newcommand*\LP@toprow[1]%
5250 {%
5251 \LP@setrowcontents{#1}{1}{\theLP@rows}%
5252 }%
5253 % \end{macrocode}
5254 % \end{macro}
5255 % \begin{macro}{\LP@rightcolumn}
5256 % Put numbers right to the puzzle.
5257 %
5258 % \cs{LP@rightcolumn}\marg{csv list}
5259 % \begin{macrocode}
5260 \newcommand*\LP@rightcolumn[1]%
5261 {%
5262 \LP@setcolumncontents{#1}{\theLP@columns}{1}%
5263 }%
5264 % \end{macrocode}
5265 % \end{macro}
5266 % \begin{macro}{\LP@rightcolumn@edge}
5267 % Put numbers right next to the puzzle, but on the edge.
5268 %
5269 % \cs{LP@rightcolumn@rdge}\marg{csv list}
5270 % \begin{macrocode}
5271 \newcommand*\LP@rightcolumn@edge[1]%
5272 {%
5273 \LP@setcolumncontents@edge{#1}{\theLP@columns}{1}%
5274 }%
5275 % \end{macrocode}
5276 % \end{macro}
5277 % \subsubsection{Presentation}
5278 % \begin{macro}{\titleformat}
5279 % You can redefine the format of the puzzle at any time.
5280 % \begin{macrocode}
5281 \newcommand*\titleformat[1]%
5282 {%
5283 \renewcommand*\LP@titleformat{#1}%
5284 }%
5285 % \end{macrocode}
5286 % \end{macro}
5287 % We define thew default title format:
5288 % \begin{macrocode}
5289 \titleformat{\centering\Large\color{blue}}%
5290 % \end{macrocode}
5291 % \begin{macro}{\puzzlecounter}
5292 % User command to get the current puzzle counter.
5293 % \begin{macrocode}
5294 \newcommand*\puzzlecounter{\theLP@puzzlecounter}%
5295 % \end{macrocode}
5296 % \end{macro}
5297 % \begin{macro}{\setpuzzlecounter}
5298 % User command to reset the puzzle counter, e.g. before the solution section.
5299 % \begin{macrocode}
5300 \newcommand*\setpuzzlecounter[1]%
5301 {%
5302 \setcounter{LP@puzzlecounter}{#1}%
5303 }%
5304 % \end{macrocode}
5305 % \end{macro}
5306 % \begin{macro}{\LP@drawcounter}
5307 % Maybe we want to draw puzzle counter, or not (|counterstyle=none|).
5308 %
5309 % \cs{LP@drawcounter}\marg{counterstyle}
5310 % \begin{macrocode}
5311 \newcommand*\LP@drawcounter[1]%
5312 {%
5313 % \end{macrocode}
5314 % We copy |cvoffset| and execute the macro we defined for the respective |counterstyle|.
5315 % \begin{macrocode}
5316 \LP@set@LP@cvoffset{\LP@env@prefix}%
5317 \csname LP@cs@#1\endcsname%
5318 }%
5319 % \end{macrocode}
5320 % \end{macro}
5321 % \begin{macro}{\definecounterstyle}
5322 % Maybe a user want to define his/her own counter style.
5323 %
5324 % \cs{definecounterstyle}\marg{counterstyle}\marg{definition}
5325 % \begin{macrocode}
5326 \newcommand*{\definecounterstyle}[2]%
5327 {%
5328 % \end{macrocode}
5329 % We define a |counterstyle| macro and store its definition.
5330 % \begin{macrocode}
5331 \expandafter\gdef\csname LP@cs@#1\endcsname{#2}%
5332 }%
5333 % \end{macrocode}
5334 % \end{macro}
5335 % We define three predefined |counterstyle|s |none|, |left| and |right|.
5336 % \begin{macrocode}
5337 \definecounterstyle{none}{}%
5338 \definecounterstyle{left}{%
5339 \begingroup\reversemarginpar%
5340 \marginnote{%
5341 \tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,draw,%
5342 rounded corners=3pt,thick]%
5343 {\Huge\puzzlecounter};}[\LP@cvoffset]%
5344 \endgroup%
5345 }%
5346 \definecounterstyle{right}{%
5347 \marginnote{%
5348 \tikz\node[shape=rectangle,fill=yellow!40,inner sep=7pt,draw,%
5349 rounded corners=3pt,thick]%
5350 {\Huge\puzzlecounter};%
5351 }[\LP@cvoffset]%
5352 }%
5353 % \end{macrocode}
5354 % \subsubsection{Misc macros}
5355 % \begin{macro}{\LP@Block}
5356 % We define a Ti{\itshape k}Z picture with the size of a grid cell ($1cm\times 1cm$)
5357 % and fill it with |color|.
5358 % \begin{macrocode}
5359 \newcommand*\LP@Block{%
5360 \tikz[scale=\LP@scale]%
5361 \draw[line width=\LP@normallines,fill=\LP@color]%
5362 (0,0) rectangle (1,1);}%
5363 % \end{macrocode}
5364 % \end{macro}
5365 % \begin{macro}{\LP@Line}
5366 % A generic command for drawing lines with options |double|, |color| and |linewidth|.
5367 %
5368 % \cs{LP@Line}\oarg{options}\marg{TikZ path}
5369 % \begin{macrocode}
5370 \define@key{LP@Line}{double}[double]%
5371 {%
5372 \def\LP@Line@double{double}%
5373 }%
5374 %
5375 \define@key{LP@Line}{color}[LP@c@bridge]%
5376 {%
5377 \def\LP@Line@linecolor{#1}%
5378 }%
5379 %
5380 \define@key{LP@Line}{linewidth}[1mm]%
5381 {%
5382 \def\LP@Line@linewidth{#1}%
5383 }%
5384 %
5385 \newcommand*\LP@Line[2][]%
5386 {%
5387 \def\LP@Line@double{}%
5388 \def\LP@Line@linecolor{LP@c@bridge}%
5389 \def\LP@Line@linewidth{1mm}%
5390 \setkeys{LP@Line}{#1}%
5391 % \end{macrocode}
5392 % By default we draw a single 1mm wide line with color |LP@c@bridge|.%
5393 % But we can change thar with \oarg{options}.
5394 % \begin{macrocode}
5395 \LP@set@LP@scale{\LP@env@prefix}%
5396 % \end{macrocode}
5397 % Then we can draw a single or double line based on the defined options or defaults.
5398 % \begin{macrocode}
5399 \begin{pgfonlayer}{LPbackgroundtwo}%
5400 \ifthenelse{\equal{\LP@Line@double}{double}}%
5401 {\draw[double,double distance=\LP@Line@linewidth*\LP@scale,%
5402 color=\LP@Line@linecolor,%
5403 line width=\LP@Line@linewidth*\LP@scale] #2;}%
5404 {\draw[color=\LP@Line@linecolor,%
5405 line width=\LP@Line@linewidth*\LP@scale] #2;}%
5406 \end{pgfonlayer}%
5407 }%
5408 % \end{macrocode}
5409 % \end{macro}
5410 % \begin{macro}{\LP@set@LP@scale}
5411 % \begin{macrocode}
5412 \newcommand*\LP@set@LP@scale[1]%
5413 {%
5414 \expandafter\xdef\expandafter\LP@scale{\csname #1@scale\endcsname}%
5415 }%
5416 % \end{macrocode}
5417 % \end{macro}
5418 % \begin{macro}{\LP@set@LP@color}
5419 % \begin{macrocode}
5420 \newcommand*\LP@set@LP@color[1]%
5421 {%
5422 \expandafter\xdef\expandafter\LP@color{\csname #1@color\endcsname}%
5423 }%
5424 % \end{macrocode}
5425 % \end{macro}
5426 % \begin{macro}{\LP@set@LP@rows}
5427 % \begin{macrocode}
5428 \newcommand*\LP@set@LP@rows[1]%
5429 {%
5430 \expandafter\xdef\expandafter\LP@rows{\csname #1@rows\endcsname}%
5431 }%
5432 % \end{macrocode}
5433 % \end{macro}
5434 % \begin{macro}{\LP@set@LP@columns}
5435 % \begin{macrocode}
5436 \newcommand*\LP@set@LP@columns[1]%
5437 {%
5438 \expandafter\xdef\expandafter\LP@columns{\csname #1@columns\endcsname}%
5439 }%
5440 % \end{macrocode}
5441 % \end{macro}
5442 % \begin{macro}{\LP@set@LP@cvoffset}
5443 % \begin{macrocode}
5444 \newcommand*\LP@set@LP@cvoffset[1]%
5445 {%
5446 \expandafter\xdef\expandafter\LP@cvoffset{\csname #1@cvoffset\endcsname}%
5447 }%
5448 % \end{macrocode}
5449 % \end{macro}
5450 % \begin{macro}{\LP@set@LP@bgcolor}
5451 % \begin{macrocode}
5452 \newcommand*\LP@set@LP@bgcolor[1]%
5453 {%
5454 \expandafter\xdef\expandafter\LP@bgcolor{\csname #1@bgcolor\endcsname}%
5455 }%
5456 % \end{macrocode}
5457 % \end{macro}
5458 % \begin{macro}{\LP@set@LP@extracells}
5459 % \begin{macrocode}
5460 \newcommand*\LP@set@LP@extracells[1]%
5461 {%
5462 \expandafter\xdef\expandafter\LP@extracells{\csname #1@extracells\endcsname}%
5463 }%
5464 % \end{macrocode}
5465 % \end{macro}
5466 % \begin{macro}{\LP@set@LP@fontsize}
5467 % \begin{macrocode}
5468 \newcommand*\LP@set@LP@fontsize[1]%
5469 {%
5470 % can't expand \Large
5471 \expandafter\gdef\expandafter\LP@fontsize{\csname #1@fontsize\endcsname}%
5472 }%
5473 % \end{macrocode}
5474 % \end{macro}
5475 % \begin{macro}{\LP@set@env@prefix}
5476 % \begin{macrocode}
5477 \newcommand*\LP@set@env@prefix[1]%
5478 {%
5479 \gdef\LP@env@prefix{#1}%
5480 }%
5481 % \end{macrocode}
5482 % \end{macro}
5483 % \begin{macro}{\LP@set@package}
5484 % \begin{macrocode}
5485 \newcommand*\LP@set@package[1]%
5486 {%
5487 \gdef\LP@package{#1}%
5488 }%
5489 % \end{macrocode}
5490 % \end{macro}
5491 % \begin{macro}{\setgridlinestyle}
5492 % \begin{macrocode}
5493 \newcommand*\setgridlinestyle[1]%
5494 {%
5495 \def\LP@grid@linestyle{#1}%
5496 }%
5497 % \end{macrocode}
5498 % \end{macro}
5499 % \begin{macro}{\setnormallinewidth}
5500 % \begin{macrocode}
5501 \newcommand*\setnormallinewidth[1]%
5502 {%
5503 \def\LP@normallines{#1}%
5504 }%
5505 % \end{macrocode}
5506 % \end{macro}
5507 % \begin{macro}{\setthicklinewidth}
5508 % \begin{macrocode}
5509 \newcommand*\setthicklinewidth[1]%
5510 {%
5511 \def\LP@thicklines{#1}%
5512 }%
5513 % \end{macrocode}
5514 % \end{macro}
5515 % \begin{macro}{\puzzlestrut}
5516 % \begin{macrocode}
5517 \newcommand*\puzzlestrut%
5518 {%
5519 \LP@set@LP@rows{\LP@env@prefix}%
5520 \ifthenelse{\equal{\LP@package}{nonogram}}%
5521 {%
5522 \LP@set@LP@extracells{\LP@env@prefix}%
5523 \setcounter{LP@counti}{\LP@rows}% max row
5524 \stepcounter{LP@counti}%
5525 \addtocounter{LP@counti}{\LP@NG@extracells}%
5526 \draw[line width=\LP@thicklines, transparent]%
5527 (1,1) -- (1,\arabic{LP@counti});%
5528 }{}%
5529 }%
5530 % \end{macrocode}
5531 % \end{macro}
5532 % \begin{macro}{\setTikZpreset}
5533 % \begin{macrocode}
5534 \newcommand*\setTikZpreset[1]%
5535 {%
5536 \tikzset{%
5537 LPpreset/.style={#1}%
5538 }%
5539 }%
5540 %
5541 \setTikZpreset{line cap=rect,line join=round}%
5542 % \end{macrocode}
5543 % \end{macro}
5544 % \begin{environment}{logicpuzzle}
5545 % \begin{macrocode}
5546 \newcommand*\LP@LP@init@prefix{LP@LP}%
5547 \newcommand*\LP@LP@init@package{logicpuzzle}%
5548 %
5549 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5550 {rows}{5}%
5551 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5552 {columns}{5}%
5553 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5554 {scale}{1}%
5555 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5556 {counterstyle}{none}%
5557 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5558 {color}{}%
5559 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5560 {bgcolor}{}%
5561 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5562 {width}{5.1cm}%
5563 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5564 {cvoffset}{-23pt}%
5565 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5566 {title}{}%
5567 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5568 {titleindent}{0cm}%
5569 \LP@define@key{\LP@LP@init@prefix}{\LP@LP@init@package}%
5570 {titlewidth}{5.1cm}%
5571 \LP@define@choicekey@fontsize{\LP@LP@init@prefix}%
5572 {\LP@LP@init@package}{Large}%
5573 %
5574 \ExecuteOptionsX{rows,columns,width,fontsize,scale,bgcolor%
5575 ,cvoffset,counterstyle,title,titleindent,titlewidth}%
5576 %
5577 \ProcessOptionsX\relax%
5578 %
5579 \let\logicpuzzlecell\setcell%
5580 %
5581 \newcommand*\logicpuzzlesetup[1]%
5582 {%
5583 \setkeys{logicpuzzle.sty}{#1}%
5584 }%
5585 %
5586 \newenvironment{logicpuzzle}[1][]%
5587 {%
5588 \setkeys{logicpuzzle}{#1}%
5589 \LP@set@package{logicpuzzle}%
5590 \LP@set@env@prefix{LP@LP}%
5591 \setcounter{LP@rows}{\LP@LP@rows}%
5592 \setcounter{LP@columns}{\LP@LP@columns}%
5593 \stepcounter{LP@rows}%
5594 \stepcounter{LP@columns}%
5595 \begin{minipage}[t]{\LP@LP@width}%
5596 \ifthenelse{\equal{\LP@LP@title}{}}%
5597 {\par\enspace\par}% empty
5598 {\enspace\par\noindent\hspace{\LP@LP@titleindent}%
5599 \parbox{\LP@LP@titlewidth}{\strut\LP@titleformat\LP@LP@title}%
5600 \vspace{3mm}\par}%
5601 \begin{tikzpicture}[scale=\LP@LP@scale]%
5602 \LP@drawbackground{1}{1}{\LP@LP@columns}{\LP@LP@rows}%
5603 {\LP@LP@bgcolor}%
5604 \LP@drawgrid{1}{1}{\LP@LP@columns}{\LP@LP@rows}{1cm}%
5605 }%
5606 {%
5607 \end{tikzpicture}%
5608 \LP@drawcounter{\LP@LP@counterstyle}%
5609 \stepcounter{LP@puzzlecounter}%
5610 \end{minipage}%
5611 }%
5612 %
5613 \RequirePackage{lpenv}%
5614 % \end{macrocode}
5615 % \end{environment}
5616 %
5617 % \begin{macrocode}
5618 %</package>
5619 % \end{macrocode}
5620 % \subsection{lpenv.sty}
5621 % Here's just a flat copy of \package{lpenv.sty}! The code for the puzzles are more or less simple copy \& paste.
5622 % Take a look at section 1 for a detailed explanation of code needed for a puzzle environment.
5623 % \begin{macrocode}
5624 %<*lpenv>
5625 % \end{macrocode}
5626 % \begin{macrocode}
5627 %
5628 % battleship environment and options
5629 %
5630 \newcommand*\LP@BS@init@prefix{LP@BS}%
5631 \newcommand*\LP@BS@init@package{battleship}%
5632 %
5633 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{rows}{5}%
5634 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{columns}{5}%
5635 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{shipcolor}{green}%
5636 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{scale}{1}%
5637 % \end{macrocode}
5638 % \changes{v1.2}{2013/02/18}{added option \texttt{counterstyle}}
5639 % \begin{macrocode}
5640 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{counterstyle}{none}%
5641 % \end{macrocode}
5642 % \changes{v1.2}{2013/02/17}{added option \texttt{bgcolor}}
5643 % \begin{macrocode}
5644 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{bgcolor}{}%
5645 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{width}{6cm}%
5646 % \end{macrocode}
5647 % \changes{v1.3}{2013/02/27}{added option cvoffset}
5648 % \begin{macrocode}
5649 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{cvoffset}{-23pt}%
5650 % \end{macrocode}
5651 % \changes{v1.2}{2013/02/18}{added option \texttt{title}}
5652 % \begin{macrocode}
5653 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{title}{}%
5654 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{titleindent}{0.75cm}%
5655 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{titlewidth}{5.15cm}%
5656 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{sbindent}{0.75cm}%
5657 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{sbwidth}{5.15cm}%
5658 \LP@define@key{\LP@BS@init@prefix}{\LP@BS@init@package}{sbshipscale}{1}%
5659 \LP@define@choicekey@fontsize{\LP@BS@init@prefix}{\LP@BS@init@package}{{Large}}%
5660 %
5661 \gdef\LP@BS@shipbox{}%
5662 \tikzstyle{island} = [fill=yellow!30,draw, decorate, decoration={random steps,segment length=2.7pt,amplitude=1.7pt}]%
5663 %
5664 \newcommand*\Ship{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor] (0,0) circle (1);}%
5665 \newcommand*\ShipC{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill=\LP@BS@shipcolor] (0,0)--(0,2)--(2,2)--(2,0)--cycle;}%
5666 \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);}%
5667 \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);}%
5668 \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);}%
5669 \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);}%
5670 \newcommand*\Island{\tikz[scale=\LP@BS@scale]\draw[scale=.36,island] (0,0) rectangle (2,2);}%
5671 \newcommand*\Water{\tikz[scale=\LP@BS@scale]\draw[scale=.36,fill,blue!40] (1,1) circle (0.2);}%
5672 % versions for \shipbox without second scale
5673 \newcommand*\@Ship{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor] (0,0) circle (1);}%
5674 \newcommand*\@ShipC{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor] (0,0)--(0,2)--(2,2)--(2,0)--cycle;}%
5675 \newcommand*\@ShipT{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](2,1)--(2,0)--(0,0)--(0,1) arc (180:0:1);}%
5676 \newcommand*\@ShipB{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](2,1)--(2,2)--(0,2)--(0,1) arc (180:360:1);}%
5677 \newcommand*\@ShipL{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](1,2)--(2,2)--(2,0)--(1,0) arc (270:90:1);}%
5678 \newcommand*\@ShipR{\tikz\draw[scale=.144,fill=\LP@BS@shipcolor](1,2)--(0,2)--(0,0)--(1,0) arc (270:450:1);}%
5679 %
5680 \newcommand*\LP@BS@printship[1]%
5681 {%
5682 \ifthenelse{\equal{#1}{1}}{\scalebox{\LP@BS@sbshipscale}{\@Ship}\space\allowbreak}{}%
5683 \ifthenelse{\equal{#1}{2}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipR}\space\allowbreak}{}%
5684 \ifthenelse{\equal{#1}{3}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5685 \ifthenelse{\equal{#1}{4}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5686 \ifthenelse{\equal{#1}{5}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5687 \ifthenelse{\equal{#1}{6}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5688 \ifthenelse{\equal{#1}{7}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5689 \ifthenelse{\equal{#1}{8}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5690 \ifthenelse{\equal{#1}{9}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5691 \ifthenelse{\equal{#1}{10}}{\scalebox{\LP@BS@sbshipscale}{\@ShipL\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipC\,\@ShipR}\space\allowbreak}{}%
5692 }%
5693 %
5694 \newcommand*\LP@BS@printshipbox[1]%
5695 {%
5696 % no {#1}! to avoid expansion
5697 \foreach \LP@element in #1%
5698 {%
5699 \LP@BS@printship{\LP@element}%
5700 }%
5701 }%
5702 %
5703 \newcommand*\shipH[1]%
5704 {%
5705 \LP@setrowcontents{#1}{1}{\value{LP@rows}}%
5706 }%
5707 %
5708 \newcommand*\shipV[1]%
5709 {%
5710 \LP@setcolumncontents{#1}{0}{1}%
5711 }%
5712 % \end{macrocode}
5713 % \changes{v1.1}{2013/02/12}{renamed \cmd\ship\ $\rightarrow$ \cmd\placesegment}
5714 % \begin{macrocode}
5715 \newcommand*\placesegment[3]%
5716 {%
5717 \LP@ingrid{#1}{#2}{\LP@BS@columns}{\LP@BS@rows}{battleship}%
5718 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{#3}%
5719 }%
5720 %
5721 \let\ship\placesegment%
5722 % \end{macrocode}
5723 % \changes{v1.1}{2013/02/12}{added \cmd\placeisland}
5724 % \begin{macrocode}
5725 \newcommand*\placeisland[2]%
5726 {%
5727 \LP@ingrid{#1}{#2}{\LP@BS@columns}{\LP@BS@rows}{battleship}%
5728 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{\Island}%
5729 }%
5730 % \end{macrocode}
5731 % \changes{v1.1}{2013/02/12}{added \cmd\placewater}
5732 % \begin{macrocode}
5733 \newcommand*\placewater[2]%
5734 {%
5735 \LP@ingrid{#1}{#2}{\LP@BS@columns}{\LP@BS@rows}{battleship}%
5736 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{\Water}%
5737 }%
5738 %
5739 \newcommand*\shipbox[2][]%
5740 {%
5741 \setkeys{shipbox}{#1}%
5742 \gdef\LP@BS@shipbox{#2}%
5743 }%
5744 % \end{macrocode}
5745 % \changes{v1.1}{2013/02/11}{implemented \cmd\placeship; placement of a complete ship}
5746 % \begin{macrocode}
5747 \newcommand*\placeship[4]%
5748 {%
5749 \setcounter{LP@counti}{#4}% length
5750 \ifnum\value{LP@counti}<1%
5751 \PackageError{battleship}%
5752 {ship length < 1}%
5753 {The length of your ship should be at least 1}%
5754 \fi%
5755 \ifnum\value{LP@counti}>10%
5756 \PackageError{battleship}%
5757 {ship length > 10}%
5758 {The supported max length of ships is 10!}%
5759 \fi%
5760 \ifnum\value{LP@counti}=1%
5761 \placesegment{#2}{#3}{\Ship}%
5762 \else%
5763 \setcounter{LP@whiledo@i}{\value{LP@counti}}%
5764 \addtocounter{LP@whiledo@i}{-2}% length of middle ship
5765 \ifthenelse{\equal{#1}{V}}%
5766 {%
5767 \placesegment{#2}{#3}{\ShipB}%
5768 \setcounter{LP@countii}{#3}%
5769 \whiledo{\value{LP@whiledo@i}>0}%
5770 {%
5771 \addtocounter{LP@whiledo@i}{-1}%
5772 \stepcounter{LP@countii}%
5773 \placesegment{#2}{\theLP@countii}{\ShipC}%
5774 }%
5775 \stepcounter{LP@countii}%
5776 \placesegment{#2}{\theLP@countii}{\ShipT}%
5777 }%
5778 {%
5779 \ifthenelse{\equal{#1}{H}}%
5780 {%
5781 \placesegment{#2}{#3}{\ShipL}%
5782 \setcounter{LP@counti}{#2}%
5783 \whiledo{\value{LP@whiledo@i}>0}%
5784 {%
5785 \addtocounter{LP@whiledo@i}{-1}%
5786 \stepcounter{LP@counti}%
5787 \placesegment{\theLP@counti}{#3}{\ShipC}%
5788 }%
5789 \stepcounter{LP@counti}%
5790 \placesegment{\theLP@counti}{#3}{\ShipR}%
5791 }%
5792 {\PackageError{battleship}%
5793 {invalid direction (H/V)}%
5794 {You can place your ship only\MessageBreak%
5795 horizontally (H) or vertically (V)!}%
5796 }%
5797 }%
5798 \fi%
5799 }%
5800 %
5801 % \end{macrocode}
5802 % \changes{v1.1}{2013/02/10}{added \cmd\battleshipsetup\ for resetting global options}
5803 % \begin{macrocode}
5804 \newcommand*\battleshipsetup[1]%
5805 {%
5806 \setkeys{battleship.sty}{#1}%
5807 }%
5808 %
5809 % \end{macrocode}
5810 % \changes{v1.2}{2013/02/19}{added \cmd\classicgame\ for drawing game sheets for classic Battleship}
5811 % \begin{macrocode}
5812 \newcommand{\classicgame}[1]%
5813 {%
5814 \begin{center}%
5815 \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]%
5816 \shipV{J,I,H,G,F,E,D,C,B,A}%
5817 \shipH{1,2,3,4,5,6,7,8,9,10}%
5818 \shipbox{#1}%
5819 \end{battleship}%
5820 \hspace{1cm}%
5821 \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]%
5822 \shipV{J,I,H,G,F,E,D,C,B,A}%
5823 \shipH{1,2,3,4,5,6,7,8,9,10}%
5824 \end{battleship}%
5825 \end{center}%
5826 \par\vspace{1cm}%
5827 \begin{center}%
5828 \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]%
5829 \shipV{J,I,H,G,F,E,D,C,B,A}%
5830 \shipH{1,2,3,4,5,6,7,8,9,10}%
5831 \shipbox{#1}%
5832 \end{battleship}%
5833 \hspace{1cm}%
5834 \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]%
5835 \shipV{J,I,H,G,F,E,D,C,B,A}%
5836 \shipH{1,2,3,4,5,6,7,8,9,10}%
5837 \end{battleship}%
5838 \end{center}%
5839 }%
5840 % \end{macrocode}
5841 % \begin{environment}{battleship}
5842 % \begin{macrocode}
5843 \newenvironment{battleship}[1][]%
5844 {%
5845 \setkeys{battleship}{#1}%
5846 \LP@set@package{battleship}%
5847 \LP@set@env@prefix{LP@BS}%
5848 \shipbox{}% clear shipbox
5849 \setcounter{LP@rows}{\LP@BS@rows}%
5850 \setcounter{LP@columns}{\LP@BS@columns}%
5851 \stepcounter{LP@rows}%
5852 \stepcounter{LP@columns}%
5853 \begin{minipage}[t]{\LP@BS@width}%
5854 \ifthenelse{\equal{\LP@BS@title}{}}%
5855 {\par\enspace\par}% empty
5856 {\enspace\par\noindent\hspace{\LP@BS@titleindent}\parbox{\LP@BS@titlewidth}{\strut\LP@titleformat\LP@BS@title}\vspace{3mm}\par}%
5857 \begin{tikzpicture}[LPpreset,scale=\LP@BS@scale]%
5858 \LP@drawbackground{1}{1}{\LP@BS@columns}{\LP@BS@rows}{\LP@BS@bgcolor}%
5859 \LP@drawgrid{1}{1}{\LP@BS@columns}{\LP@BS@rows}{1cm}%
5860 }%
5861 {%
5862 \end{tikzpicture}%
5863 \LP@drawcounter{\LP@BS@counterstyle}%
5864 \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}%
5865 \stepcounter{LP@puzzlecounter}%
5866 \end{minipage}%
5867 }%
5868 % \end{macrocode}
5869 % \end{environment}
5870 % \changes{v1.3}{2013/02/28}{added support for bokkusu puzzle}
5871 % \begin{macrocode}
5872 %
5873 % bokkusu environment and options
5874 %
5875 \newcommand*\LP@BK@init@prefix{LP@BK}%
5876 \newcommand*\LP@BK@init@package{bokkusu}%
5877 %
5878 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{rows}{5}%
5879 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{columns}{5}%
5880 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{scale}{1}%
5881 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{counterstyle}{none}%
5882 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{color}{black}%
5883 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{bgcolor}{}%
5884 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{width}{6.7cm}%
5885 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{cvoffset}{-38pt}%
5886 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{title}{}%
5887 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{titleindent}{0.75cm}%
5888 \LP@define@key{\LP@BK@init@prefix}{\LP@BK@init@package}{titlewidth}{5.85cm}%
5889 \LP@define@choicekey@fontsize{\LP@BK@init@prefix}{\LP@BK@init@package}{Large}%
5890 %
5891 \let\valueH\LP@bottomrow%
5892 \let\valueV\LP@leftcolumn%
5893 \let\sumH\LP@toprow%
5894 \let\sumV\LP@rightcolumn%
5895 %
5896 \newcommand*\bokkususetup[1]%
5897 {%
5898 \setkeys{bokkusu.sty}{#1}%
5899 }%
5900 % \end{macrocode}
5901 % \begin{environment}{bokkusu}
5902 % \begin{macrocode}
5903 \newenvironment{bokkusu}[1][]%
5904 {%
5905 \setkeys{bokkusu}{#1}%
5906 \LP@set@package{bokkusu}%
5907 \LP@set@env@prefix{LP@BK}%
5908 \setcounter{LP@rows}{\LP@BK@rows}%
5909 \setcounter{LP@columns}{\LP@BK@columns}%
5910 \stepcounter{LP@rows}%
5911 \stepcounter{LP@columns}%
5912 \begin{minipage}[t]{\LP@BK@width}%
5913 \ifthenelse{\equal{\LP@BK@title}{}}%
5914 {\par\enspace\par}% empty
5915 {\enspace\par\noindent\hspace{\LP@BK@titleindent}\parbox{\LP@BK@titlewidth}{\strut\LP@titleformat\LP@BK@title}\vspace{3mm}\par}%
5916 \begin{tikzpicture}[LPpreset,scale=\LP@BK@scale]%
5917 \LP@drawbackground{1}{1}{\LP@BK@columns}{\LP@BK@rows}{\LP@BK@bgcolor}%
5918 \LP@drawgrid{1}{1}{\LP@BK@columns}{\LP@BK@rows}{1cm}%
5919 }%
5920 {%
5921 \end{tikzpicture}%
5922 \LP@drawcounter{\LP@BK@counterstyle}%
5923 \stepcounter{LP@puzzlecounter}%
5924 \end{minipage}%
5925 }%
5926 % \end{macrocode}
5927 % \end{environment}
5928 % \begin{macrocode}
5929 %
5930 % bridges environment and options
5931 %
5932 \newcommand*\LP@BG@init@prefix{LP@BG}%
5933 \newcommand*\LP@BG@init@package{bridges}%
5934 %
5935 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{rows}{5}%
5936 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{columns}{5}%
5937 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{scale}{1}%
5938 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{counterstyle}{none}%
5939 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{grid}{dashed}%
5940 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{bgcolor}{}%
5941 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{color}{green}%
5942 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{width}{6.1cm}%
5943 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{cvoffset}{-23pt}%
5944 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{title}{}%
5945 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{titleindent}{0cm}%
5946 \LP@define@key{\LP@BG@init@prefix}{\LP@BG@init@package}{titlewidth}{6.1cm}%
5947 \LP@define@choicekey@fontsize{\LP@BG@init@prefix}{\LP@BG@init@package}{Large}%
5948 %
5949 \let\bridgescell\setcell%
5950 %
5951 \newcommand*\bridgessetup[1]%
5952 {%
5953 \setkeys{bridges.sty}{#1}%
5954 }%
5955 % \end{macrocode}
5956 % \begin{macro}{\bridgesrow}
5957 % For the \env{bridges} environment, we need a special row command for drawing
5958 % the islands with the numbers of bridges.
5959 %
5960 % \cs{bridgesrow}\marg{row}\marg{csv list}
5961 % \begin{macrocode}
5962 \newcommand*\bridgesrow[2]%
5963 {%
5964 \setcounter{LP@counti}{1}%
5965 \setcounter{LP@countii}{#1}%
5966 \LP@set@LP@fontsize{\LP@env@prefix}%
5967 \LP@set@LP@color{\LP@env@prefix}%
5968 \foreach \LP@element in {#2}%
5969 {%
5970 % \end{macrocode}
5971 % We loop through the list anf if |element| is not empty, we draw an island
5972 % (circle filled with |bgcolor|) and typeset the number of bridges into to center of the circle.
5973 % \begin{macrocode}
5974 \ifthenelse{\equal{\LP@element}{}}%
5975 {}%
5976 {%
5977 \draw[fill=\LP@color] (\arabic{LP@counti},\arabic{LP@countii})%
5978 circle (0.5cm);%
5979 \node[scale=\LP@scale,font=\LP@fontsize] at%
5980 (\arabic{LP@counti},\arabic{LP@countii}){\LP@element};%
5981 }%
5982 \stepcounter{LP@counti}%
5983 };%
5984 }%
5985 % \end{macrocode}
5986 % \end{macro}
5987 % \begin{macro}{\bridgescolumn}
5988 % And again, for columns!
5989 % \begin{macrocode}
5990 \newcommand*\bridgescolumn[2]%
5991 {%
5992 \setcounter{LP@counti}{#1}%
5993 \setcounter{LP@countii}{1}%
5994 \LP@set@LP@fontsize{\LP@env@prefix}%
5995 \LP@set@LP@color{\LP@env@prefix}%
5996 \foreach \LP@element in {#2}%
5997 {%
5998 \ifthenelse{\equal{\LP@element}{}}%
5999 {}%
6000 {%
6001 \draw[fill=\LP@color] (\arabic{LP@counti},\arabic{LP@countii})%
6002 circle (0.5cm);%
6003 \node[scale=\LP@scale,font=\LP@fontsize]%
6004 at (\arabic{LP@counti},\arabic{LP@countii})%
6005 {\LP@element};%
6006 }%
6007 \stepcounter{LP@countii}%
6008 };%
6009 }%
6010 % \end{macrocode}
6011 % \end{macro}
6012 % \begin{macro}{\bridge}
6013 % For the \env{bridges} environment, we need to draw bridges.
6014 % Keep in mind that you can influence the appearance of the brigde with the options
6015 % |double|, |color| and |linewidth|.
6016 %
6017 % \cs{bridge}\oarg{options}\marg{Tikz path}
6018 % \begin{macrocode}
6019 \newcommand*\bridge[2][]%
6020 {%
6021 \LP@Line[#1]{#2}%
6022 }%
6023 % \end{macrocode}
6024 % \end{macro}
6025 % \begin{environment}{bridges}
6026 % \begin{macrocode}
6027 \newenvironment{bridges}[1][]%
6028 {%
6029 \setkeys{bridges}{#1}%
6030 \LP@set@package{bridges}%
6031 \LP@set@env@prefix{LP@BG}%
6032 \setcounter{LP@rows}{\LP@BG@rows}%
6033 \setcounter{LP@columns}{\LP@BG@columns}%
6034 \stepcounter{LP@rows}%
6035 \stepcounter{LP@columns}%
6036 \begin{minipage}[t]{\LP@BG@width}%
6037 \ifthenelse{\equal{\LP@BG@title}{}}%
6038 {\par\enspace\par}% empty
6039 {\enspace\par\noindent\hspace{\LP@BG@titleindent}\parbox{\LP@BG@titlewidth}{\strut\LP@titleformat\LP@BG@title}\vspace{3mm}\par}%
6040 \begin{tikzpicture}[LPpreset,scale=\LP@BG@scale]%
6041 \LP@drawbackground{1}{1}{\LP@BG@columns}{\LP@BG@rows}{\LP@BG@bgcolor}%
6042 \ifthenelse{\equal{\LP@BG@grid}{none}}%
6043 {}%
6044 {%
6045 \ifthenelse{\equal{\LP@BG@grid}{dashed}}%
6046 {%
6047 \setgridlinestyle{dashed}%
6048 \LP@drawgrid{1}{1}{\LP@BG@columns}{\LP@BG@rows}{1cm}%
6049 }%
6050 {%
6051 \LP@drawgrid{1}{1}{\LP@BG@columns}{\LP@BG@rows}{1cm}%
6052 }%
6053 }%
6054 }%
6055 {%
6056 \end{tikzpicture}%
6057 \LP@drawcounter{\LP@BG@counterstyle}%
6058 \stepcounter{LP@puzzlecounter}%
6059 \end{minipage}%
6060 }%
6061 % \end{macrocode}
6062 % \end{environment}
6063 % \begin{macrocode}
6064 %
6065 % chaossudoku environment and options
6066 %
6067 \newcommand*\LP@CS@init@prefix{LP@CS}%
6068 \newcommand*\LP@CS@init@package{chaossudoku}%
6069 %
6070 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{rows}{5}%
6071 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{columns}{5}%
6072 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{scale}{1}%
6073 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{counterstyle}{none}%
6074 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{bgcolor}{}%
6075 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{width}{5.1cm}%
6076 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{cvoffset}{-23pt}%
6077 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{title}{}%
6078 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{titleindent}{0cm}%
6079 \LP@define@key{\LP@CS@init@prefix}{\LP@CS@init@package}{titlewidth}{5.1cm}%
6080 \LP@define@choicekey@fontsize{\LP@CS@init@prefix}{\LP@CS@init@package}{Large}%
6081 %
6082 \let\chaossudokucell\setcell%
6083 %
6084 \newcommand*\chaossudokusetup[1]%
6085 {%
6086 \setkeys{chaossudoku.sty}{#1}%
6087 }%
6088 % \end{macrocode}
6089 % \begin{environment}{chaossudoku}
6090 % \begin{macrocode}
6091 \newenvironment{chaossudoku}[1][]%
6092 {%
6093 \setkeys{chaossudoku}{#1}%
6094 \LP@set@package{chaossudoku}%
6095 \LP@set@env@prefix{LP@CS}%
6096 \setcounter{LP@rows}{\LP@CS@rows}%
6097 \setcounter{LP@columns}{\LP@CS@columns}%
6098 \stepcounter{LP@rows}%
6099 \stepcounter{LP@columns}%
6100 \begin{minipage}[t]{\LP@CS@width}%
6101 \ifthenelse{\equal{\LP@CS@title}{}}%
6102 {\par\enspace\par}% empty
6103 {\enspace\par\noindent\hspace{\LP@CS@titleindent}\parbox{\LP@CS@titlewidth}{\strut\LP@titleformat\LP@CS@title}\vspace{3mm}\par}%
6104 \begin{tikzpicture}[LPpreset,scale=\LP@CS@scale]%
6105 \LP@drawbackground{1}{1}{\LP@CS@columns}{\LP@CS@rows}{\LP@CS@bgcolor}%
6106 \LP@drawgrid{1}{1}{\LP@CS@columns}{\LP@CS@rows}{1cm}%
6107 }%
6108 {%
6109 \end{tikzpicture}%
6110 \LP@drawcounter{\LP@CS@counterstyle}%
6111 \stepcounter{LP@puzzlecounter}%
6112 \end{minipage}%
6113 }%
6114 % \end{macrocode}
6115 % \end{environment}
6116 % \begin{macrocode}
6117 %
6118 % ddsudoku environment and options
6119 %
6120 \newcommand*\LP@DDS@init@prefix{LP@DDS}%
6121 \newcommand*\LP@DDS@init@package{ddsudoku}%
6122 %
6123 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{rows}{5}%
6124 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{columns}{5}%
6125 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{scale}{1}%
6126 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{counterstyle}{none}%
6127 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{bgcolor}{}%
6128 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{width}{5.1cm}%
6129 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{cvoffset}{-23pt}%
6130 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{title}{}%
6131 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{titleindent}{0cm}%
6132 \LP@define@key{\LP@DDS@init@prefix}{\LP@DDS@init@package}{titlewidth}{5.1cm}%
6133 \LP@define@choicekey@fontsize{\LP@DDS@init@prefix}{\LP@DDS@init@package}{Large}%
6134 %
6135 \let\ddsudokucell\setcell%
6136 %
6137 \newcommand*\ddsudokusetup[1]%
6138 {%
6139 \setkeys{ddsudoku.sty}{#1}%
6140 }%
6141 % \end{macrocode}
6142 % \begin{environment}{ddsudoku}
6143 % \begin{macrocode}
6144 \newenvironment{ddsudoku}[1][]%
6145 {%
6146 \setkeys{ddsudoku}{#1}%
6147 \LP@set@package{ddsudoku}%
6148 \LP@set@env@prefix{LP@DDS}%
6149 \setcounter{LP@rows}{\LP@DDS@rows}%
6150 \setcounter{LP@columns}{\LP@DDS@columns}%
6151 \stepcounter{LP@rows}%
6152 \stepcounter{LP@columns}%
6153 \begin{minipage}[t]{\LP@DDS@width}%
6154 \ifthenelse{\equal{\LP@DDS@title}{}}%
6155 {\par\enspace\par}% empty
6156 {\enspace\par\noindent\hspace{\LP@DDS@titleindent}\parbox{\LP@DDS@titlewidth}{\strut\LP@titleformat\LP@DDS@title}\vspace{3mm}\par}%
6157 \begin{tikzpicture}[LPpreset,scale=\LP@DDS@scale]%
6158 \LP@drawbackground{1}{1}{\LP@DDS@columns}{\LP@DDS@rows}{\LP@DDS@bgcolor}%
6159 \LP@drawgrid{1}{1}{\LP@DDS@columns}{\LP@DDS@rows}{1cm}%
6160 }%
6161 {%
6162 \end{tikzpicture}%
6163 \LP@drawcounter{\LP@DDS@counterstyle}%
6164 \stepcounter{LP@puzzlecounter}%
6165 \end{minipage}%
6166 }%
6167 % \end{macrocode}
6168 % \end{environment}
6169 % \begin{macrocode}
6170 %
6171 % fourwinds environment and options
6172 %
6173 \newcommand*\LP@FW@init@prefix{LP@FW}%
6174 \newcommand*\LP@FW@init@package{fourwinds}%
6175 %
6176 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{rows}{5}%
6177 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{columns}{5}%
6178 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{scale}{1}%
6179 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{counterstyle}{none}%
6180 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{bgcolor}{}%
6181 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{color}{blue}%
6182 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{width}{5.1cm}%
6183 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{cvoffset}{-23pt}%
6184 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{title}{}%
6185 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{titleindent}{0cm}%
6186 \LP@define@key{\LP@FW@init@prefix}{\LP@FW@init@package}{titlewidth}{5.1cm}%
6187 \LP@define@choicekey@fontsize{\LP@FW@init@prefix}{\LP@FW@init@package}{Large}%
6188 %
6189 \newcommand*\fourwindscell[4]%
6190 {%
6191 \LP@set@LP@fontsize{\LP@env@prefix}%
6192 \LP@set@LP@color{\LP@env@prefix}%
6193 \LP@set@LP@bgcolor{\LP@env@prefix}%
6194 \LP@set@LP@scale{\LP@env@prefix}%
6195 \ifthenelse{\equal{\LP@bgcolor}{}}%
6196 {\gdef\LP@c@bg@fw{white}}%
6197 {\gdef\LP@c@bg@fw{\LP@bgcolor}}%
6198 \foreach \LP@fw@dir/\LP@fw@length in {#4}%
6199 {%
6200 \begin{pgfonlayer}{LPbackgroundtwo}%
6201 \def\LP@rel@tikzpath{.5}%
6202 \draw[\LP@fw@linestyle,color=\LP@color,line width=.1cm*\LP@scale,shorten >=-3mm*\LP@scale]%
6203 \xtikzpath{#1}{#2}{\LP@fw@dir/\LP@fw@length};%
6204 \end{pgfonlayer}%
6205 };%
6206 \begin{puzzlebackground}%
6207 \node[fill=\LP@c@bg@fw,font=\LP@fontsize] at (#1.5,#2.5) {#3};%
6208 \end{puzzlebackground}%
6209 }%
6210 %
6211 \newcommand*\fourwindssetup[1]%
6212 {%
6213 \setkeys{fourwinds.sty}{#1}%
6214 }%
6215 % \end{macrocode}
6216 % \begin{environment}{fourwinds}
6217 % \begin{macrocode}
6218 \newenvironment{fourwinds}[1][]%
6219 {%
6220 \setkeys{fourwinds}{#1}%
6221 \LP@set@package{fourwinds}%
6222 \LP@set@env@prefix{LP@FW}%
6223 \setcounter{LP@rows}{\LP@FW@rows}%
6224 \setcounter{LP@columns}{\LP@FW@columns}%
6225 \stepcounter{LP@rows}%
6226 \stepcounter{LP@columns}%
6227 \begin{minipage}[t]{\LP@FW@width}%
6228 \ifthenelse{\equal{\LP@FW@title}{}}%
6229 {\par\enspace\par}% empty
6230 {\enspace\par\noindent\hspace{\LP@FW@titleindent}\parbox{\LP@FW@titlewidth}{\strut\LP@titleformat\LP@FW@title}\vspace{3mm}\par}%
6231 \begin{tikzpicture}[LPpreset,scale=\LP@FW@scale]%
6232 \LP@drawbackground{1}{1}{\LP@FW@columns}{\LP@FW@rows}{\LP@FW@bgcolor}%
6233 \LP@drawgrid{1}{1}{\LP@FW@columns}{\LP@FW@rows}{1cm}%
6234 }%
6235 {%
6236 \end{tikzpicture}%
6237 \LP@drawcounter{\LP@FW@counterstyle}%
6238 \stepcounter{LP@puzzlecounter}%
6239 \end{minipage}%
6240 }%
6241 % \end{macrocode}
6242 % \end{environment}
6243 % \begin{macrocode}
6244 %
6245 % hakyuu environment and options
6246 %
6247 \newcommand*\LP@HY@init@prefix{LP@HY}%
6248 \newcommand*\LP@HY@init@package{hakyuu}%
6249 %
6250 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{rows}{5}%
6251 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{columns}{5}%
6252 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{scale}{1}%
6253 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{counterstyle}{none}%
6254 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{bgcolor}{}%
6255 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{width}{5.1cm}%
6256 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{cvoffset}{-23pt}%
6257 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{title}{}%
6258 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{titleindent}{0cm}%
6259 \LP@define@key{\LP@HY@init@prefix}{\LP@HY@init@package}{titlewidth}{5.1cm}%
6260 \LP@define@choicekey@fontsize{\LP@HY@init@prefix}{\LP@HY@init@package}{Large}%
6261 %
6262 \let\hakyuucell\setcell%
6263 %
6264 \newcommand*\hakyuusetup[1]%
6265 {%
6266 \setkeys{hakyuu.sty}{#1}%
6267 }%
6268 % \end{macrocode}
6269 % \begin{environment}{hakyuu}
6270 % \begin{macrocode}
6271 \newenvironment{hakyuu}[1][]%
6272 {%
6273 \setkeys{hakyuu}{#1}%
6274 \LP@set@package{hakyuu}%
6275 \LP@set@env@prefix{LP@HY}%
6276 \setcounter{LP@rows}{\LP@HY@rows}%
6277 \setcounter{LP@columns}{\LP@HY@columns}%
6278 \stepcounter{LP@rows}%
6279 \stepcounter{LP@columns}%
6280 \begin{minipage}[t]{\LP@HY@width}%
6281 \ifthenelse{\equal{\LP@HY@title}{}}%
6282 {\par\enspace\par}% empty
6283 {\enspace\par\noindent\hspace{\LP@HY@titleindent}\parbox{\LP@HY@titlewidth}{\strut\LP@titleformat\LP@HY@title}\vspace{3mm}\par}%
6284 \begin{tikzpicture}[LPpreset,scale=\LP@HY@scale]%
6285 \LP@drawbackground{1}{1}{\LP@HY@columns}{\LP@HY@rows}{\LP@HY@bgcolor}%
6286 \LP@drawgrid{1}{1}{\LP@HY@columns}{\LP@HY@rows}{1cm}%
6287 }%
6288 {%
6289 \end{tikzpicture}%
6290 \LP@drawcounter{\LP@HY@counterstyle}%
6291 \stepcounter{LP@puzzlecounter}%
6292 \end{minipage}%
6293 }%
6294 % \end{macrocode}
6295 % \end{environment}
6296 % \begin{macrocode}
6297 %
6298 % hitori environment and options
6299 %
6300 \newcommand*\LP@HT@init@prefix{LP@HT}%
6301 \newcommand*\LP@HT@init@package{hitori}%
6302 %
6303 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{rows}{5}%
6304 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{columns}{5}%
6305 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{scale}{1}%
6306 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{counterstyle}{none}%
6307 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{bgcolor}{}%
6308 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{width}{5.1cm}%
6309 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{cvoffset}{-23pt}%
6310 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{title}{}%
6311 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{titleindent}{0cm}%
6312 \LP@define@key{\LP@HT@init@prefix}{\LP@HT@init@package}{titlewidth}{5.1cm}%
6313 \LP@define@choicekey@fontsize{\LP@HT@init@prefix}{\LP@HT@init@package}{Large}%
6314 %
6315 \let\hitoricell\setcell%
6316 %
6317 \newcommand*\hitorisetup[1]%
6318 {%
6319 \setkeys{hitori.sty}{#1}%
6320 }%
6321 % \end{macrocode}
6322 % \begin{environment}{hitori}
6323 % \begin{macrocode}
6324 \newenvironment{hitori}[1][]%
6325 {%
6326 \setkeys{hitori}{#1}%
6327 \LP@set@package{hitori}%
6328 \LP@set@env@prefix{LP@HT}%
6329 \setcounter{LP@rows}{\LP@HT@rows}%
6330 \setcounter{LP@columns}{\LP@HT@columns}%
6331 \stepcounter{LP@rows}%
6332 \stepcounter{LP@columns}%
6333 \begin{minipage}[t]{\LP@HT@width}%
6334 \ifthenelse{\equal{\LP@HT@title}{}}%
6335 {\par\enspace\par}% empty
6336 {\enspace\par\noindent\hspace{\LP@HT@titleindent}\parbox{\LP@HT@titlewidth}{\strut\LP@titleformat\LP@HT@title}\vspace{3mm}\par}%
6337 \begin{tikzpicture}[LPpreset,scale=\LP@HT@scale]%
6338 \LP@drawbackground{1}{1}{\LP@HT@columns}{\LP@HT@rows}{\LP@HT@bgcolor}%
6339 \LP@drawgrid{1}{1}{\LP@HT@columns}{\LP@HT@rows}{1cm}%
6340 }%
6341 {%
6342 \end{tikzpicture}%
6343 \LP@drawcounter{\LP@HT@counterstyle}%
6344 \stepcounter{LP@puzzlecounter}%
6345 \end{minipage}%
6346 }%
6347 % \end{macrocode}
6348 % \end{environment}
6349 % \begin{macrocode}
6350 %
6351 % kakuro environment and options
6352 %
6353 \newcommand*\LP@KKR@init@prefix{LP@KKR}%
6354 \newcommand*\LP@KKR@init@package{kakuro}%
6355 %
6356 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{rows}{5}%
6357 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{columns}{5}%
6358 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{scale}{1}%
6359 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{counterstyle}{none}%
6360 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{bgcolor}{}%
6361 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{color}{green}%
6362 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{width}{5.1cm}%
6363 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{cvoffset}{-23pt}%
6364 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{title}{}%
6365 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{titleindent}{0cm}%
6366 \LP@define@key{\LP@KKR@init@prefix}{\LP@KKR@init@package}{titlewidth}{5.1cm}%
6367 \LP@define@choicekey@fontsize{\LP@KKR@init@prefix}{\LP@KKR@init@package}{Large}%
6368 %
6369 \newif\ifLP@KKR@solution\LP@KKR@solutionfalse%
6370 %
6371 \define@choicekey*{kakuro.sty}{solution}[\LP@KKR@solution\nr]{true,false}[true]%
6372 {%
6373 \ifcase\nr\relax%
6374 \renewcommand*\LP@KKR@solution{true}%
6375 \LP@KKR@solutiontrue%
6376 \or%
6377 \renewcommand*\LP@KKR@solution{false}%
6378 \LP@KKR@solutionfalse%
6379 \fi%
6380 }%
6381 %
6382 \define@choicekey*{kakuro}{solution}[\LP@KKR@solution\nr]{true,false}[true]%
6383 {%
6384 \ifcase\nr\relax%
6385 \renewcommand*\LP@KKR@solution{true}%
6386 \LP@KKR@solutiontrue%
6387 \or%
6388 \renewcommand*\LP@KKR@solution{false}%
6389 \LP@KKR@solutionfalse%
6390 \fi%
6391 }%
6392 %
6393 \let\kakurocell\setcell%
6394 %
6395 \newcommand*\kakurosetup[1]%
6396 {%
6397 \setkeys{kakuro.sty}{#1}%
6398 }%
6399 % \end{macrocode}
6400 % \begin{macro}{\LP@KKR@print@element}
6401 % For the \env{kakuro} environment, we need to typeset numbers and special
6402 % Kakuro cells (\cs{KKR}).
6403 %
6404 % \cs{LP@KKR@print@element}\marg{element}
6405 % \begin{macrocode}
6406 \def\LP@KKR@print@element#1%
6407 {%
6408 % \end{macrocode}
6409 % First, we test if \marg{element} is a number and typeset \marg{element}
6410 % into the grid cell, if we are in solution mode. Otherwise, we execute the \cs{KKR} command.
6411 % \begin{macrocode}
6412 \if!\ifnum9<1#1!\else_\fi%
6413 \ifLP@KKR@solution%
6414 \setcell{\arabic{LP@counti}}{\arabic{LP@countii}}{#1}%
6415 \else%
6416 \fi%
6417 \else%
6418 #1%
6419 \fi%
6420 }%
6421 % \end{macrocode}
6422 % \end{macro}
6423 % \begin{macro}{\kakurorow}
6424 % For the \env{kakuro} environment, we need special row and column commands, which
6425 % can also handle the \cs{KKR} commands.
6426 % \begin{macrocode}
6427 \newcommand*\kakurorow[2]%
6428 {%
6429 \setcounter{LP@counti}{1}%
6430 \setcounter{LP@countii}{#1}%
6431 \foreach \LP@element in {#2}%
6432 {%
6433 \LP@KKR@print@element{\LP@element}%
6434 \stepcounter{LP@counti}%
6435 };%
6436 }%
6437 % \end{macrocode}
6438 % \end{macro}
6439 % \begin{macro}{\kakurocolumn}
6440 % \begin{macrocode}
6441 \newcommand*\kakurocolumn[2]%
6442 {%
6443 \setcounter{LP@counti}{#1}%
6444 \setcounter{LP@countii}{1}%
6445 \foreach \LP@element in {#2}%
6446 {%
6447 \LP@KKR@print@element{\LP@element}%
6448 \stepcounter{LP@countii}%
6449 };%
6450 }%
6451 % \end{macrocode}
6452 % \end{macro}
6453 % \begin{macro}{\KKR}
6454 % For the \env{kakuro} environment, we need to draw complex kakuro cells. They consist of
6455 % a diagonally divided cell with the sums of the cells below and right of the current cell.
6456 % They also have a special background color.
6457 %
6458 % \cs{KKR}\marg{vertical sum}\marg{horizontal sum}
6459 % \begin{macrocode}
6460 \newcommand*\KKR[2]%
6461 {%
6462 % \end{macrocode}
6463 % First of all, we copy |scale|, |bgcolor| and |color|.
6464 % \begin{macrocode}
6465 \LP@set@LP@scale{\LP@env@prefix}%
6466 \LP@set@LP@bgcolor{\LP@env@prefix}%
6467 \LP@set@LP@color{\LP@env@prefix}%
6468 % \end{macrocode}
6469 % If |bgcolor| is undefined, we assume |white|.
6470 % \begin{macrocode}
6471 \ifthenelse{\equal{\LP@bgcolor}{}}%
6472 {\gdef\LP@sr@bgcolor{white}}%
6473 {\gdef\LP@sr@bgcolor{\LP@bgcolor}}%
6474 % \end{macrocode}
6475 % To get unique node names, we step our |unique| counter.
6476 % \begin{macrocode}
6477 \stepcounter{LP@counter@unique}%
6478 % \end{macrocode}
6479 % In a first step, we draw a rectangular helper node in |bgcolor| color on the \layer{LPdump} layer.
6480 % \begin{macrocode}
6481 \begin{pgfonlayer}{LPdump}%
6482 \node [shape=rectangle,inner sep=0pt] (A_\theLP@counter@unique)%
6483 at (\arabic{LP@counti}\LP@Pfive,\arabic{LP@countii}\LP@Pfive)%
6484 {\tikz\draw[scale=\LP@scale,color=\LP@sr@bgcolor]%
6485 (0.08,0.1) rectangle (0.92,0.9);};%
6486 \end{pgfonlayer}%
6487 % \end{macrocode}
6488 % In the second step, we fill the cell with |color| color and draw a diagonal line.
6489 % \begin{macrocode}
6490 \begin{puzzlebackground}%
6491 \fill[color=\LP@color]%
6492 (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,1);%
6493 \draw[line width=\LP@normallines]%
6494 (\arabic{LP@counti},\arabic{LP@countii}) -- ++(0,1) -- ++(1,-1);%
6495 \end{puzzlebackground}%
6496 % \end{macrocode}
6497 % Finally, we use the corners of the helper node to place the sums.
6498 % \begin{macrocode}
6499 \node [shape=rectangle,inner sep=0pt,anchor=south west,%
6500 scale=\LP@scale,font=\small]%
6501 at (A_\theLP@[email protected] west) {#1};%
6502 \node [shape=rectangle,inner sep=0pt,anchor=north east,%
6503 scale=\LP@scale,font=\small]%
6504 at (A_\theLP@[email protected] east) {#2};%
6505 }%
6506 % \end{macrocode}
6507 % \end{macro}
6508 % \begin{macro}{\Black}
6509 % Sometimes, we need black cells.
6510 % \begin{macrocode}
6511 \newcommand*\Black%
6512 {%
6513 \LP@set@LP@scale{\LP@env@prefix}%
6514 \begin{puzzlebackground}%
6515 \fill[color=black]%
6516 (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,1);%
6517 \end{puzzlebackground}%
6518 }%
6519 % \end{macrocode}
6520 % \end{macro}
6521 % \begin{environment}{kakuro}
6522 % \begin{macrocode}
6523 \newenvironment{kakuro}[1][]%
6524 {%
6525 \setkeys{kakuro}{#1}%
6526 \LP@set@package{kakuro}%
6527 \LP@set@env@prefix{LP@KKR}%
6528 \setcounter{LP@rows}{\LP@KKR@rows}%
6529 \setcounter{LP@columns}{\LP@KKR@columns}%
6530 \stepcounter{LP@rows}%
6531 \stepcounter{LP@columns}%
6532 \begin{minipage}[t]{\LP@KKR@width}%
6533 \ifthenelse{\equal{\LP@KKR@title}{}}%
6534 {\par\enspace\par}% empty
6535 {\enspace\par\noindent\hspace{\LP@KKR@titleindent}\parbox{\LP@KKR@titlewidth}{\strut\LP@titleformat\LP@KKR@title}\vspace{3mm}\par}%
6536 \begin{tikzpicture}[LPpreset,scale=\LP@KKR@scale]%
6537 \LP@drawbackground{1}{1}{\LP@KKR@columns}{\LP@KKR@rows}{\LP@KKR@bgcolor}%
6538 \LP@drawgrid{1}{1}{\LP@KKR@columns}{\LP@KKR@rows}{1cm}%
6539 }%
6540 {%
6541 \end{tikzpicture}%
6542 \LP@drawcounter{\LP@KKR@counterstyle}%
6543 \stepcounter{LP@puzzlecounter}%
6544 \end{minipage}%
6545 }%
6546 % \end{macrocode}
6547 % \end{environment}
6548 % \begin{macrocode}
6549 %
6550 % kendoku environment and options
6551 %
6552 \newcommand*\LP@KD@init@prefix{LP@KD}%
6553 \newcommand*\LP@KD@init@package{kendoku}%
6554 %
6555 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{rows}{5}%
6556 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{columns}{5}%
6557 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{scale}{1}%
6558 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{counterstyle}{none}%
6559 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{bgcolor}{}%
6560 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{width}{5.1cm}%
6561 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{cvoffset}{-23pt}%
6562 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{title}{}%
6563 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{titleindent}{0cm}%
6564 \LP@define@key{\LP@KD@init@prefix}{\LP@KD@init@package}{titlewidth}{5.1cm}%
6565 \LP@define@choicekey@fontsize{\LP@KD@init@prefix}{\LP@KD@init@package}{Large}%
6566 %
6567 \let\kendokucell\setcell%
6568 %
6569 \newcommand*\kendokusetup[1]%
6570 {%
6571 \setkeys{kendoku.sty}{#1}%
6572 }%
6573 % \end{macrocode}
6574 % \begin{environment}{kendoku}
6575 % \begin{macrocode}
6576 \newenvironment{kendoku}[1][]%
6577 {%
6578 \setkeys{kendoku}{#1}%
6579 \LP@set@package{kendoku}%
6580 \LP@set@env@prefix{LP@KD}%
6581 \setcounter{LP@rows}{\LP@KD@rows}%
6582 \setcounter{LP@columns}{\LP@KD@columns}%
6583 \stepcounter{LP@rows}%
6584 \stepcounter{LP@columns}%
6585 \begin{minipage}[t]{\LP@KD@width}%
6586 \ifthenelse{\equal{\LP@KD@title}{}}%
6587 {\par\enspace\par}% empty
6588 {\enspace\par\noindent\hspace{\LP@KD@titleindent}\parbox{\LP@KD@titlewidth}{\strut\LP@titleformat\LP@KD@title}\vspace{3mm}\par}%
6589 \begin{tikzpicture}[LPpreset,scale=\LP@KD@scale]%
6590 \LP@drawbackground{1}{1}{\LP@KD@columns}{\LP@KD@rows}{\LP@KD@bgcolor}%
6591 \LP@drawgrid{1}{1}{\LP@KD@columns}{\LP@KD@rows}{1cm}%
6592 }%
6593 {%
6594 \end{tikzpicture}%
6595 \LP@drawcounter{\LP@KD@counterstyle}%
6596 \stepcounter{LP@puzzlecounter}%
6597 \end{minipage}%
6598 }%
6599 % \end{macrocode}
6600 % \end{environment}
6601 % \begin{macrocode}
6602 %
6603 % killersudoku environment and options
6604 %
6605 \newcommand*\LP@KSDK@init@prefix{LP@KSDK}%
6606 \newcommand*\LP@KSDK@init@package{killersudoku}%
6607 %
6608 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{rows}{5}%
6609 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{columns}{5}%
6610 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{scale}{1}%
6611 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{counterstyle}{none}%
6612 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{bgcolor}{}%
6613 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{width}{5.1cm}%
6614 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{cvoffset}{-23pt}%
6615 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{title}{}%
6616 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{titleindent}{0cm}%
6617 \LP@define@key{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{titlewidth}{5.1cm}%
6618 \LP@define@choicekey@fontsize{\LP@KSDK@init@prefix}{\LP@KSDK@init@package}{Large}%
6619 %
6620 \let\killersudokucell\setcell%
6621 %
6622 \newcommand*\killersudokusetup[1]%
6623 {%
6624 \setkeys{killersudoku.sty}{#1}%
6625 }%
6626 % \end{macrocode}
6627 % \begin{environment}{killersudoku}
6628 % \begin{macrocode}
6629 \newenvironment{killersudoku}[1][]%
6630 {%
6631 \setkeys{killersudoku}{#1}%
6632 \LP@set@package{killersudoku}%
6633 \LP@set@env@prefix{LP@KSDK}%
6634 \setcounter{LP@rows}{\LP@KSDK@rows}%
6635 \setcounter{LP@columns}{\LP@KSDK@columns}%
6636 \stepcounter{LP@rows}%
6637 \stepcounter{LP@columns}%
6638 \begin{minipage}[t]{\LP@KSDK@width}%
6639 \ifthenelse{\equal{\LP@KSDK@title}{}}%
6640 {\par\enspace\par}% empty
6641 {\enspace\par\noindent\hspace{\LP@KSDK@titleindent}\parbox{\LP@KSDK@titlewidth}{\strut\LP@titleformat\LP@KSDK@title}\vspace{3mm}\par}%
6642 \begin{tikzpicture}[LPpreset,scale=\LP@KSDK@scale]%
6643 \LP@drawbackground{1}{1}{\LP@KSDK@columns}{\LP@KSDK@rows}{\LP@KSDK@bgcolor}%
6644 \LP@drawgrid{1}{1}{\LP@KSDK@columns}{\LP@KSDK@rows}{1cm}%
6645 }%
6646 {%
6647 \end{tikzpicture}%
6648 \LP@drawcounter{\LP@KSDK@counterstyle}%
6649 \stepcounter{LP@puzzlecounter}%
6650 \end{minipage}%
6651 }%
6652 % \end{macrocode}
6653 % \end{environment}
6654 % \begin{macrocode}
6655 %
6656 % laserbeam environment and options
6657 %
6658 \newcommand*\LP@LB@init@prefix{LP@LB}%
6659 \newcommand*\LP@LB@init@package{laserbeam}%
6660 %
6661 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{rows}{5}%
6662 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{columns}{5}%
6663 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{scale}{1}%
6664 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{counterstyle}{none}%
6665 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{bgcolor}{}%
6666 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{width}{6.5cm}%
6667 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{cvoffset}{-38pt}%
6668 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{title}{}%
6669 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{titleindent}{0cm}%
6670 \LP@define@key{\LP@LB@init@prefix}{\LP@LB@init@package}{titlewidth}{6.5cm}%
6671 \LP@define@choicekey@fontsize{\LP@LB@init@prefix}{\LP@LB@init@package}{Large}%
6672 %
6673 \let\laserH\LP@toprow%
6674 \let\laserV\LP@leftcolumn%
6675 \let\mirrorH\LP@bottomrow@edge%
6676 \let\mirrorV\LP@rightcolumn@edge%
6677 %
6678 \newcommand*\laser[2][red]%
6679 {%
6680 % avoid little laser peaks outside grid
6681 \clip (1,1) rectangle (\arabic{LP@columns},\arabic{LP@rows});%
6682 \framearea{#1}{#2}%
6683 }%
6684 %
6685 \newcommand*\laserbeamsetup[1]%
6686 {%
6687 \setkeys{laserbeam.sty}{#1}%
6688 }%
6689 % \end{macrocode}
6690 % \begin{macro}{\placecross}
6691 % Place a cross in the bottom left corner of the grid cell.
6692 %
6693 % \cs{placecross}\marg{column}\marg{row}
6694 % \begin{macrocode}
6695 \newcommand*\placecross[2]%
6696 {%
6697 \LP@G@setcellcontent{#1}{#2}{\LP@Cross}%
6698 }%
6699 % \end{macrocode}
6700 % \end{macro}
6701 % \begin{macro}{\placemirror}
6702 % Place a mirror in the bottom left corner of the grid cell.
6703 %
6704 % \cs{placemirror}\marg{column}\marg{row}
6705 % \begin{macrocode}
6706 \newcommand*\placemirror[3]%
6707 {%
6708 \LP@G@setcellcontent{#1}{#2}{\LP@Mirror{#3}}%
6709 }%
6710 % \end{macrocode}
6711 % \end{macro}
6712 % \begin{macro}{\placearrow}
6713 % Place an arrow in the bottom left corner of the grid cell.
6714 % \marg{direction} may be: |RightUp|, |LeftUp|, |LeftDown| or |RightDown|
6715 %
6716 % \cs{placearrow}\marg{column}\marg{row}\marg{direction}
6717 % \begin{macrocode}
6718 \newcommand*\placearrow[3]%
6719 {%
6720 \LP@G@setcellcontent{#1}{#2}{\LP@Arrow{#3}}%
6721 }%
6722 % \end{macrocode}
6723 % \end{macro}
6724 % \begin{macro}{\LP@Arrow}
6725 % We define a Ti{\itshape k}Z picture for an arrow in four directions:
6726 % |RightUp|, |LeftUp|, |LeftDown| or |RightDown|
6727 % \begin{macrocode}
6728 \newcommand*\LP@Arrow[1]%
6729 {%
6730 \LP@set@LP@scale{\LP@env@prefix}%
6731 \def\LP@rotate{45}%
6732 \ifthenelse{\equal{#1}{LeftUp}}{\def\LP@rotate{135}}{}%
6733 \ifthenelse{\equal{#1}{LeftDown}}{\def\LP@rotate{225}}{}%
6734 \ifthenelse{\equal{#1}{RightDown}}{\def\LP@rotate{315}}{}%
6735 % \end{macrocode}
6736 % We define the line width of the arrow base on |scale|. Line widths are absolut and not
6737 % influenced by a |scale| factor of the picture.
6738 % \begin{macrocode}
6739 \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}%
6740 \tikz\draw[->,line width=\LPlinewidth,%
6741 rotate=\LP@rotate,scale=\LP@scale]%
6742 (0.1,.5) -- (0.9,.5);%
6743 }%
6744 % \end{macrocode}
6745 % \end{macro}
6746 % \begin{macro}{\LP@Cross}
6747 % We define a Ti{\itshape k}Z picture of a cross.
6748 % \begin{macrocode}
6749 \newcommand*\LP@Cross%
6750 {%
6751 \LP@set@LP@scale{\LP@env@prefix}%
6752 \begin{tikzpicture}%
6753 % \end{macrocode}
6754 % We ensure that the cross is on top of all elements on the \layer{main} layer.
6755 % \begin{macrocode}
6756 \begin{pgfonlayer}{LPforeground}%
6757 \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}%
6758 % \end{macrocode}
6759 % For drawing the cross we defined a line width. Now we can draw the cross with the
6760 % predefined color |LP@c@cross|.
6761 % \begin{macrocode}
6762 \draw[line width=\LPlinewidth,scale=\LP@scale,color=LP@c@cross]%
6763 (.35,.35) -- (0.65,.65) -- (.5,.5) -- (.65,.35)-- (.35,.65);%
6764 \end{pgfonlayer}%
6765 \end{tikzpicture}%
6766 }%
6767 % \end{macrocode}
6768 % \end{macro}
6769 % \begin{macro}{\LP@Mirror}
6770 % We define a Ti{\itshape k}Z picture for a mirror.
6771 %
6772 % \cs{LP@Mirror}\marg{direction}
6773 % \begin{macrocode}
6774 \newcommand*\LP@Mirror[1]%
6775 {%
6776 % \end{macrocode}
6777 % Based on \marg{direction}, we define the angle of the mirror.
6778 % \begin{macrocode}
6779 \def\LP@rotate{0}%
6780 \ifthenelse{\equal{#1}{V}}{\def\LP@rotate{90}}{}%
6781 \LP@set@LP@scale{\LP@env@prefix}%
6782 \begin{tikzpicture}%
6783 % \end{macrocode}
6784 % Mirrors should be on to of everything, therefore we draw them on the
6785 % \layer{LPforegroundtwo} layer and use the predefined color |LP@c@mirror|.
6786 % \begin{macrocode}
6787 \begin{pgfonlayer}{LPforegroundtwo}%
6788 \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}%
6789 \draw[line width=\LPlinewidth,scale=\LP@scale,%
6790 color=LP@c@mirror,rotate=\LP@rotate]%
6791 (.35,.5) -- (0.65,.5);%
6792 \end{pgfonlayer}%
6793 \end{tikzpicture}%
6794 }%
6795 % \end{macrocode}
6796 % \end{macro}
6797 % \begin{environment}{laserbeam}
6798 % \begin{macrocode}
6799 \newenvironment{laserbeam}[1][]%
6800 {%
6801 \setkeys{laserbeam}{#1}%
6802 \LP@set@package{laserbeam}%
6803 \LP@set@env@prefix{LP@LB}%
6804 \setcounter{LP@rows}{\LP@LB@rows}%
6805 \setcounter{LP@columns}{\LP@LB@columns}%
6806 \stepcounter{LP@rows}%
6807 \stepcounter{LP@columns}%
6808 \begin{minipage}[t]{\LP@LB@width}%
6809 \ifthenelse{\equal{\LP@LB@title}{}}%
6810 {\par\enspace\par}% empty
6811 {\enspace\par\noindent\hspace{\LP@LB@titleindent}\parbox{\LP@LB@titlewidth}{\strut\LP@titleformat\LP@LB@title}\vspace{3mm}\par}%
6812 \begin{tikzpicture}[LPpreset,scale=\LP@LB@scale]%
6813 \LP@drawbackground{1}{1}{\LP@LB@columns}{\LP@LB@rows}{\LP@LB@bgcolor}%
6814 \LP@drawgrid{1}{1}{\LP@LB@columns}{\LP@LB@rows}{1cm}%
6815 }%
6816 {%
6817 \end{tikzpicture}%
6818 \LP@drawcounter{\LP@LB@counterstyle}%
6819 \stepcounter{LP@puzzlecounter}%
6820 \end{minipage}%
6821 }%
6822 % \end{macrocode}
6823 % \end{environment}
6824 % \begin{macrocode}
6825 %
6826 % lpsudoku environment and options
6827 %
6828 \newcommand*\LP@SDK@init@prefix{LP@SDK}%
6829 \newcommand*\LP@SDK@init@package{lpsudoku}%
6830 %
6831 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{rows}{9}%
6832 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{columns}{9}%
6833 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{scale}{1}%
6834 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{counterstyle}{none}%
6835 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{bgcolor}{}%
6836 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{width}{9.1cm}%
6837 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{cvoffset}{-23pt}%
6838 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{title}{}%
6839 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{titleindent}{0cm}%
6840 \LP@define@key{\LP@SDK@init@prefix}{\LP@SDK@init@package}{titlewidth}{9.1cm}%
6841 \LP@define@choicekey@fontsize{\LP@SDK@init@prefix}{\LP@SDK@init@package}{Large}%
6842 %
6843 \let\lpsudokucell\setcell%
6844 %
6845 \newcommand*\lpsudokusetup[1]%
6846 {%
6847 \setkeys{lpsudoku.sty}{#1}%
6848 }%
6849 % \end{macrocode}
6850 % \begin{macro}{\LP@drawsudokugrid}
6851 % For the \env{lpsudoku} and \env{skyscrapers} environments, we need to add the typical
6852 % thick Sudoku lines to the standard grid.
6853 % \begin{macrocode}
6854 \newcommand*\LP@drawsudokugrid%
6855 {%
6856 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6857 (1,1) -- (1,10);%
6858 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6859 (4,1) -- (4,10);%
6860 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6861 (7,1) -- (7,10);%
6862 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6863 (10,1) -- (10,10);%
6864 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6865 (1,1) -- (10,1);%
6866 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6867 (1,4) -- (10,4);%
6868 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6869 (1,7) -- (10,7);%
6870 \draw[line width=\LP@thicklines,draw opacity=\LP@draw@opacity]%
6871 (1,10) -- (10,10);%
6872 }%
6873 % \end{macrocode}
6874 % \end{macro}
6875 % \begin{macro}{\LP@magnetsgrid}
6876 % For the \env{magnets} environment, we need to add some lines to the
6877 % standard grid.
6878 % \begin{macrocode}
6879 \newcommand*\LP@magnetsgrid%
6880 {%
6881 % \end{macrocode}
6882 % First, we copy the values of |fontsize|, |columns| and |rows| from
6883 % the environment we are in at the moment. Then, we step |columns| and
6884 % |rows| to get the upper right grid coordinate.
6885 % \begin{macrocode}
6886 \LP@set@LP@fontsize{\LP@env@prefix}%
6887 \LP@set@LP@columns{\LP@env@prefix}%
6888 \LP@set@LP@rows{\LP@env@prefix}%
6889 \setcounter{LP@counti}{\LP@columns}% max column
6890 \setcounter{LP@countii}{\LP@rows}% max row
6891 \stepcounter{LP@counti}%
6892 \stepcounter{LP@countii}%
6893 % \end{macrocode}
6894 % Now, we can draw the additional lines and the |+| and |-| signs.
6895 % \begin{macrocode}
6896 \draw[step=1cm,line width=\LP@normallines]%
6897 (-1,1) grid (1,\arabic{LP@countii});%
6898 \draw[step=1cm,line width=\LP@normallines]%
6899 (1,\arabic{LP@countii}) grid ++(\LP@columns,2);%
6900 \draw[line width=\LP@normallines]%
6901 (0,\arabic{LP@countii}) -- ++(0,1) -- ++(1,0);%
6902 \draw[line width=\LP@thicklines]%
6903 (-1,1) rectangle (1,\arabic{LP@countii});%
6904 \draw[line width=\LP@thicklines]%
6905 (1,\arabic{LP@countii}) rectangle ++(\LP@columns,2);%
6906 \draw[line width=\LP@thicklines]%
6907 (1,\arabic{LP@countii}) rectangle ++(-2,2);%
6908 \node[font=\LP@fontsize\bfseries] at (0.5,\arabic{LP@counti}.5)%
6909 {$-$};%
6910 \stepcounter{LP@counti}%
6911 \node[font=\LP@fontsize\bfseries] at (-0.5,\arabic{LP@counti}.5)%
6912 {$+$};%
6913 }%
6914 % \end{macrocode}
6915 % \end{macro}
6916 % \begin{environment}{lpsudoku}
6917 % \begin{macrocode}
6918 \newenvironment{lpsudoku}[1][]%
6919 {%
6920 \setkeys{lpsudoku}{#1}%
6921 \LP@set@package{lpsudoku}%
6922 \LP@set@env@prefix{LP@SDK}%
6923 \setcounter{LP@rows}{\LP@SDK@rows}%
6924 \setcounter{LP@columns}{\LP@SDK@columns}%
6925 \stepcounter{LP@rows}%
6926 \stepcounter{LP@columns}%
6927 \begin{minipage}[t]{\LP@SDK@width}%
6928 \ifthenelse{\equal{\LP@SDK@title}{}}%
6929 {\par\enspace\par}% empty
6930 {\enspace\par\noindent\hspace{\LP@SDK@titleindent}\parbox{\LP@SDK@titlewidth}{\strut\LP@titleformat\LP@SDK@title}\vspace{3mm}\par}%
6931 \begin{tikzpicture}[LPpreset,scale=\LP@SDK@scale]%
6932 \LP@drawbackground{1}{1}{\LP@SDK@columns}{\LP@SDK@rows}{\LP@SDK@bgcolor}%
6933 \LP@drawgrid{1}{1}{\LP@SDK@columns}{\LP@SDK@rows}{1cm}%
6934 \LP@drawsudokugrid%
6935 }%
6936 {%
6937 \end{tikzpicture}%
6938 \LP@drawcounter{\LP@SDK@counterstyle}%
6939 \stepcounter{LP@puzzlecounter}%
6940 \end{minipage}%
6941 }%
6942 % \end{macrocode}
6943 % \end{environment}
6944 % \begin{macrocode}
6945 %
6946 % magiclabyrinth environment and options
6947 %
6948 \newcommand*\LP@ML@init@prefix{LP@ML}%
6949 \newcommand*\LP@ML@init@package{magiclabyrinth}%
6950 %
6951 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{rows}{5}%
6952 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{columns}{5}%
6953 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{scale}{1}%
6954 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{counterstyle}{none}%
6955 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{bgcolor}{}%
6956 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{width}{5.1cm}%
6957 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{cvoffset}{-23pt}%
6958 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{title}{}%
6959 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{titleindent}{0cm}%
6960 \LP@define@key{\LP@ML@init@prefix}{\LP@ML@init@package}{titlewidth}{5.1cm}%
6961 \LP@define@choicekey@fontsize{\LP@ML@init@prefix}{\LP@ML@init@package}{Large}%
6962 %
6963 \let\magiclabyrinthcell\setcell%
6964 %
6965 \newcommand*\magiclabyrinthsetup[1]%
6966 {%
6967 \setkeys{magiclabyrinth.sty}{#1}%
6968 }%
6969 % \end{macrocode}
6970 % \begin{macro}{\mlline}
6971 % \begin{macrocode}
6972 \newcommand*\mlline[1]%
6973 {%
6974 \draw[color=black, line width=\LP@thicklines] #1;%
6975 }%
6976 % \end{macrocode}
6977 % \end{macro}
6978 % \begin{macro}{\MasyuW}
6979 % \begin{macrocode}
6980 \newcommand*\MasyuW%
6981 {%
6982 \begin{tikzpicture}[scale=0.7*\LP@scale]%
6983 \draw[color=black,fill=white] (0.5,0.5) circle (0.5cm);%
6984 \end{tikzpicture}%
6985 }%
6986 % \end{macrocode}
6987 % \end{macro}
6988 % \begin{environment}{magiclabyrinth}
6989 % \begin{macrocode}
6990 \newenvironment{magiclabyrinth}[1][]%
6991 {%
6992 \setkeys{magiclabyrinth}{#1}%
6993 \LP@set@package{magiclabyrinth}%
6994 \LP@set@env@prefix{LP@ML}%
6995 \setcounter{LP@rows}{\LP@ML@rows}%
6996 \setcounter{LP@columns}{\LP@ML@columns}%
6997 \stepcounter{LP@rows}%
6998 \stepcounter{LP@columns}%
6999 \begin{minipage}[t]{\LP@ML@width}%
7000 \ifthenelse{\equal{\LP@ML@title}{}}%
7001 {\par\enspace\par}% empty
7002 {\enspace\par\noindent\hspace{\LP@ML@titleindent}\parbox{\LP@ML@titlewidth}{\strut\LP@titleformat\LP@ML@title}\vspace{3mm}\par}%
7003 \begin{tikzpicture}[LPpreset,scale=\LP@ML@scale]%
7004 \LP@drawbackground{1}{1}{\LP@ML@columns}{\LP@ML@rows}{\LP@ML@bgcolor}%
7005 \LP@drawgrid{1}{1}{\LP@ML@columns}{\LP@ML@rows}{1cm}%
7006 }%
7007 {%
7008 \end{tikzpicture}%
7009 \LP@drawcounter{\LP@ML@counterstyle}%
7010 \stepcounter{LP@puzzlecounter}%
7011 \end{minipage}%
7012 }%
7013 % \end{macrocode}
7014 % \end{environment}
7015 % \begin{macrocode}
7016 %
7017 % magnets environment and options
7018 %
7019 \newcommand*\LP@MN@init@prefix{LP@MN}%
7020 \newcommand*\LP@MN@init@package{magnets}%
7021 %
7022 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{rows}{6}%
7023 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{columns}{6}%
7024 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{scale}{1}%
7025 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{counterstyle}{none}%
7026 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{bgcolor}{}%
7027 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{width}{8.1cm}%
7028 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{cvoffset}{-23pt}%
7029 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{title}{}%
7030 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{titleindent}{0cm}%
7031 \LP@define@key{\LP@MN@init@prefix}{\LP@MN@init@package}{titlewidth}{8.1cm}%
7032 \LP@define@choicekey@fontsize{\LP@MN@init@prefix}{\LP@MN@init@package}{Large}%
7033 %
7034 \let\magnetscell\setcell%
7035 %
7036 \let\minusH\LP@toprow%
7037 \let\minusV\LP@leftcolumn%
7038 %
7039 \newcommand*\plusV[1]%
7040 {%
7041 \LP@set@LP@fontsize{\LP@env@prefix}%
7042 \setcounter{LP@counti}{1}%
7043 \foreach \LP@element in{#1}%
7044 {%
7045 \node at (-0.5,\arabic{LP@counti}\LP@Pfive){\LP@fontsize\LP@element};%
7046 \stepcounter{LP@counti}%
7047 };%
7048 }%
7049 %
7050 \newcommand*\plusH[1]%
7051 {%
7052 \LP@set@LP@fontsize{\LP@env@prefix}%
7053 \LP@set@LP@rows{\LP@env@prefix}%
7054 \setcounter{LP@counti}{1}%
7055 \setcounter{LP@countii}{\LP@rows}%
7056 \addtocounter{LP@countii}{2}%
7057 \foreach \LP@element in{#1}%
7058 {%
7059 \node at (\arabic{LP@counti}\LP@Pfive,\arabic{LP@countii}\LP@Pfive){\LP@fontsize\LP@element};%
7060 \stepcounter{LP@counti}%
7061 };%
7062 }%
7063 %
7064 \newcommand*\magnetssetup[1]%
7065 {%
7066 \setkeys{magnets.sty}{#1}%
7067 }%
7068 % \end{macrocode}
7069 % \begin{macro}{\PMH}
7070 % \begin{macrocode}
7071 \newcommand*\PMH[1]%
7072 {%
7073 \LP@set@LP@fontsize{\LP@env@prefix}%
7074 \foreach \LP@fe@column/\LP@fe@row in {#1}%
7075 {%
7076 \setcounter{LP@counti}{\LP@fe@column}%
7077 \setcounter{LP@countii}{\LP@fe@row}%
7078 \draw[line width=\LP@thicklines,fill=white]%
7079 (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(2,1);%
7080 \node[font=\LP@fontsize\bfseries]%
7081 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};%
7082 \stepcounter{LP@counti}%
7083 \node[font=\LP@fontsize\bfseries]%
7084 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};%
7085 };%
7086 }%
7087 % \end{macrocode}
7088 % \end{macro}
7089 % \begin{macro}{\MPH}
7090 % \begin{macrocode}
7091 \newcommand*\MPH[1]%
7092 {%
7093 \LP@set@LP@fontsize{\LP@env@prefix}%
7094 \foreach \LP@fe@column/\LP@fe@row in {#1}%
7095 {%
7096 \setcounter{LP@counti}{\LP@fe@column}%
7097 \setcounter{LP@countii}{\LP@fe@row}%
7098 \draw[line width=\LP@thicklines,fill=white]%
7099 (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(2,1);%
7100 \node[font=\LP@fontsize\bfseries]%
7101 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};%
7102 \stepcounter{LP@counti}%
7103 \node[font=\LP@fontsize\bfseries]%
7104 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};%
7105 };%
7106 }%
7107 % \end{macrocode}
7108 % \end{macro}
7109 % \begin{macro}{\PMV}
7110 % \begin{macrocode}
7111 \newcommand*\PMV[1]%
7112 {%
7113 \LP@set@LP@fontsize{\LP@env@prefix}%
7114 \foreach \LP@fe@column/\LP@fe@row in {#1}%
7115 {%
7116 \setcounter{LP@counti}{\LP@fe@column}%
7117 \setcounter{LP@countii}{\LP@fe@row}%
7118 \draw[line width=\LP@thicklines,fill=white]%
7119 (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,2);%
7120 \node[font=\LP@fontsize\bfseries]%
7121 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};%
7122 \stepcounter{LP@countii}%
7123 \node[font=\LP@fontsize\bfseries]%
7124 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};%
7125 };%
7126 }%
7127 % \end{macrocode}
7128 % \end{macro}
7129 % \begin{macro}{\MPV}
7130 % \begin{macrocode}
7131 \newcommand*\MPV[1]%
7132 {%
7133 \LP@set@LP@fontsize{\LP@env@prefix}%
7134 \foreach \LP@fe@column/\LP@fe@row in {#1}%
7135 {%
7136 \setcounter{LP@counti}{\LP@fe@column}%
7137 \setcounter{LP@countii}{\LP@fe@row}%
7138 \draw[line width=\LP@thicklines,fill=white]%
7139 (\arabic{LP@counti},\arabic{LP@countii}) rectangle ++(1,2);%
7140 \node[font=\LP@fontsize\bfseries]%
7141 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$-$};%
7142 \stepcounter{LP@countii}%
7143 \node[font=\LP@fontsize\bfseries]%
7144 at (\arabic{LP@counti}.5,\arabic{LP@countii}.5) {$+$};%
7145 };%
7146 }%
7147 % \end{macrocode}
7148 % \end{macro}
7149 % \begin{macro}{\magnetsH}
7150 % \begin{macrocode}
7151 \newcommand*\magnetsH[1]%
7152 {%
7153 \foreach \LP@fe@column/\LP@fe@row in {#1}%
7154 {%
7155 \draw[line width=\LP@thicklines,fill=white]%
7156 (\LP@fe@column,\LP@fe@row) rectangle ++(2,1);%
7157 };%
7158 }%
7159 % \end{macrocode}
7160 % \end{macro}
7161 % \begin{macro}{\magnetsV}
7162 % \begin{macrocode}
7163 \newcommand*\magnetsV[1]%
7164 {%
7165 \foreach \LP@fe@column/\LP@fe@row in {#1}%
7166 {%
7167 \draw[line width=\LP@thicklines,fill=white]%
7168 (\LP@fe@column,\LP@fe@row) rectangle ++(1,2);%
7169 };%
7170 }%
7171 % \end{macrocode}
7172 % \end{macro}
7173 % \begin{environment}{magnets}
7174 % \begin{macrocode}
7175 \newenvironment{magnets}[1][]%
7176 {%
7177 \setkeys{magnets}{#1}%
7178 \LP@set@package{magnets}%
7179 \LP@set@env@prefix{LP@MN}%
7180 \setcounter{LP@rows}{\LP@MN@rows}%
7181 \setcounter{LP@columns}{\LP@MN@columns}%
7182 \stepcounter{LP@rows}%
7183 \stepcounter{LP@columns}%
7184 \begin{minipage}[t]{\LP@MN@width}%
7185 \ifthenelse{\equal{\LP@MN@title}{}}%
7186 {\par\enspace\par}% empty
7187 {\enspace\par\noindent\hspace{\LP@MN@titleindent}\parbox{\LP@MN@titlewidth}{\strut\LP@titleformat\LP@MN@title}\vspace{3mm}\par}%
7188 \begin{tikzpicture}[LPpreset,scale=\LP@MN@scale]%
7189 \LP@drawbackground{1}{1}{\LP@MN@columns}{\LP@MN@rows}{\LP@MN@bgcolor}%
7190 \LP@drawgrid{1}{1}{\LP@MN@columns}{\LP@MN@rows}{1cm}%
7191 \LP@magnetsgrid%
7192 \framepuzzle%
7193 }%
7194 {%
7195 \end{tikzpicture}%
7196 \LP@drawcounter{\LP@MN@counterstyle}%
7197 \stepcounter{LP@puzzlecounter}%
7198 \end{minipage}%
7199 }%
7200 % \end{macrocode}
7201 % \end{environment}
7202 % \begin{macrocode}
7203 %
7204 % masyu environment and options
7205 %
7206 \newcommand*\LP@MY@init@prefix{LP@MY}%
7207 \newcommand*\LP@MY@init@package{masyu}%
7208 %
7209 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{rows}{5}%
7210 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{columns}{5}%
7211 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{scale}{1}%
7212 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{counterstyle}{none}%
7213 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{color}{green}%
7214 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{bgcolor}{}%
7215 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{width}{5.1cm}%
7216 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{cvoffset}{-23pt}%
7217 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{title}{}%
7218 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{titleindent}{0cm}%
7219 \LP@define@key{\LP@MY@init@prefix}{\LP@MY@init@package}{titlewidth}{5.1cm}%
7220 \LP@define@choicekey@fontsize{\LP@MY@init@prefix}{\LP@MY@init@package}{Large}%
7221 %
7222 \let\masyucell\setcell%
7223 %
7224 \newcommand*\masyusetup[1]%
7225 {%
7226 \setkeys{masyu.sty}{#1}%
7227 }%
7228 % \end{macrocode}
7229 % \begin{macro}{\MasyuB}
7230 % \begin{macrocode}
7231 \newcommand*\MasyuB%
7232 {%
7233 \begin{tikzpicture}[scale=0.7*\LP@scale]%
7234 \fill[color=black] (0.5,0.5) circle (0.5cm);%
7235 \end{tikzpicture}%
7236 }%
7237 % \end{macrocode}
7238 % \end{macro}
7239 % \begin{macro}{\masyuline}
7240 % \begin{macrocode}
7241 \newcommand*\masyuline[1]%
7242 {%
7243 \LP@set@LP@color{\LP@env@prefix}%
7244 \begin{puzzleforeground}%
7245 \bgroup%
7246 \def\LP@rel@tikzpath{.5}%
7247 \draw[color=\LP@color, line width=\LP@thicklines] #1;%
7248 \egroup%
7249 \end{puzzleforeground}%
7250 }%
7251 % \end{macrocode}
7252 % \end{macro}
7253 % \begin{environment}{masyu}
7254 % \begin{macrocode}
7255 \newenvironment{masyu}[1][]%
7256 {%
7257 \setkeys{masyu}{#1}%
7258 \LP@set@package{masyu}%
7259 \LP@set@env@prefix{LP@MY}%
7260 \setcounter{LP@rows}{\LP@MY@rows}%
7261 \setcounter{LP@columns}{\LP@MY@columns}%
7262 \stepcounter{LP@rows}%
7263 \stepcounter{LP@columns}%
7264 \begin{minipage}[t]{\LP@MY@width}%
7265 \ifthenelse{\equal{\LP@MY@title}{}}%
7266 {\par\enspace\par}% empty
7267 {\enspace\par\noindent\hspace{\LP@MY@titleindent}\parbox{\LP@MY@titlewidth}{\strut\LP@titleformat\LP@MY@title}\vspace{3mm}\par}%
7268 \begin{tikzpicture}[LPpreset,scale=\LP@MY@scale]%
7269 \LP@drawbackground{1}{1}{\LP@MY@columns}{\LP@MY@rows}{\LP@MY@bgcolor}%
7270 \LP@drawgrid{1}{1}{\LP@MY@columns}{\LP@MY@rows}{1cm}%
7271 }%
7272 {%
7273 \end{tikzpicture}%
7274 \LP@drawcounter{\LP@MY@counterstyle}%
7275 \stepcounter{LP@puzzlecounter}%
7276 \end{minipage}%
7277 }%
7278 % \end{macrocode}
7279 % \end{environment}
7280 % \begin{macrocode}
7281 %
7282 % minesweeper environment and options
7283 %
7284 \newcommand*\LP@MS@init@prefix{LP@MS}%
7285 \newcommand*\LP@MS@init@package{minesweeper}%
7286 %
7287 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{rows}{5}%
7288 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{columns}{5}%
7289 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{scale}{1}%
7290 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{counterstyle}{none}%
7291 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{bgcolor}{}%
7292 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{width}{5.1cm}%
7293 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{cvoffset}{-23pt}%
7294 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{title}{}%
7295 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{titleindent}{0cm}%
7296 \LP@define@key{\LP@MS@init@prefix}{\LP@MS@init@package}{titlewidth}{5.1cm}%
7297 \LP@define@choicekey@fontsize{\LP@MS@init@prefix}{\LP@MS@init@package}{Large}%
7298 %
7299 \let\minesweepercell\setcell%
7300 %
7301 \newcommand*\minesweepersetup[1]%
7302 {%
7303 \setkeys{minesweeper.sty}{#1}%
7304 }%
7305 % \end{macrocode}
7306 % \begin{macro}{\LP@Mine}
7307 % We define a Ti{\itshape k}Z picture for a mine.
7308 % \begin{macrocode}
7309 \newcommand*\LP@Mine%
7310 {%
7311 \begin{tikzpicture}[scale=\LP@scale]%
7312 % \end{macrocode}
7313 % We simply draw a shaded ball with four spikes.
7314 % \begin{macrocode}
7315 \fill[color=black] (.2,.5) -- (.5,.6) -- (.5,.4) -- cycle;%
7316 \fill[color=black] (.8,.5) -- (.5,.6) -- (.5,.4) -- cycle;%
7317 \fill[color=black] (.5,.8) -- (.4,.5) -- (.6,.5) -- cycle;%
7318 \fill[color=black] (.5,.2) -- (.4,.5) -- (.6,.5) -- cycle;%
7319 \shade[ball color=black] (.5,.5) circle (.225cm);%
7320 \end{tikzpicture}%
7321 }%
7322 % \end{macrocode}
7323 % \end{macro}
7324 % \begin{macro}{\Mine}
7325 % A user command for mines.
7326 % \begin{macrocode}
7327 \let\Mine\LP@Mine%
7328 % \end{macrocode}
7329 % \end{macro}
7330 % \begin{environment}{minesweeper}
7331 % \begin{macrocode}
7332 \newenvironment{minesweeper}[1][]%
7333 {%
7334 \setkeys{minesweeper}{#1}%
7335 \LP@set@package{minesweeper}%
7336 \LP@set@env@prefix{LP@MS}%
7337 \setcounter{LP@rows}{\LP@MS@rows}%
7338 \setcounter{LP@columns}{\LP@MS@columns}%
7339 \stepcounter{LP@rows}%
7340 \stepcounter{LP@columns}%
7341 \begin{minipage}[t]{\LP@MS@width}%
7342 \ifthenelse{\equal{\LP@MS@title}{}}%
7343 {\par\enspace\par}% empty
7344 {\enspace\par\noindent\hspace{\LP@MS@titleindent}\parbox{\LP@MS@titlewidth}{\strut\LP@titleformat\LP@MS@title}\vspace{3mm}\par}%
7345 \begin{tikzpicture}[LPpreset,scale=\LP@MS@scale]%
7346 \LP@drawbackground{1}{1}{\LP@MS@columns}{\LP@MS@rows}{\LP@MS@bgcolor}%
7347 \LP@drawgrid{1}{1}{\LP@MS@columns}{\LP@MS@rows}{1cm}%
7348 }%
7349 {%
7350 \end{tikzpicture}%
7351 \LP@drawcounter{\LP@MS@counterstyle}%
7352 \stepcounter{LP@puzzlecounter}%
7353 \end{minipage}%
7354 }%
7355 % \end{macrocode}
7356 % \end{environment}
7357 % \begin{macrocode}
7358 %
7359 % nonogram environment and options
7360 %
7361 \newcommand*\LP@NG@init@prefix{LP@NG}%
7362 \newcommand*\LP@NG@init@package{nonogram}%
7363 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{rows}{5}%
7364 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{columns}{5}%
7365 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{extracells}{5}%
7366 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{helplines}{5}%
7367 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{solution}{false}%
7368 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{scale}{1}%
7369 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{counterstyle}{none}%
7370 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{bgcolor}{}%
7371 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{color}{black}%
7372 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{width}{5.1cm}%
7373 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{cvoffset}{-23pt}%
7374 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{title}{}%
7375 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{titleindent}{0cm}%
7376 \LP@define@key{\LP@NG@init@prefix}{\LP@NG@init@package}{titlewidth}{5.1cm}%
7377 \LP@define@choicekey@fontsize{\LP@NG@init@prefix}{\LP@NG@init@package}{Large}%
7378 %
7379 % \end{macrocode}
7380 % \begin{macro}{\nonogramrow}
7381 % \begin{macrocode}
7382 \newcommand*\nonogramrow[2]%
7383 {%
7384 \foreach \LP@fe@column/\LP@fe@length in {#2}%
7385 {%
7386 \setcounter{LP@whiledo@i}{\LP@fe@length}%
7387 \setcounter{LP@countiii}{\LP@fe@column}%
7388 \whiledo{\value{LP@whiledo@i}>0}%
7389 {%
7390 \fillcell{\arabic{LP@countiii}}{#1}%
7391 \addtocounter{LP@countiii}{1}%
7392 \addtocounter{LP@whiledo@i}{-1}%
7393 }%
7394 };%
7395 }%
7396 % \end{macrocode}
7397 % \end{macro}
7398 % \begin{macro}{\nonogramcolumn}
7399 % \begin{macrocode}
7400 \newcommand*\nonogramcolumn[2]%
7401 {%
7402 \foreach \LP@fe@row/\LP@fe@length in {#2}%
7403 {%
7404 \setcounter{LP@whiledo@i}{\LP@fe@length}%
7405 \setcounter{LP@countiii}{\LP@fe@row}%
7406 \whiledo{\value{LP@whiledo@i}>0}%
7407 {%
7408 \fillcell{#1}{\arabic{LP@countiii}}%
7409 \addtocounter{LP@countiii}{1}%
7410 \addtocounter{LP@whiledo@i}{-1}%
7411 }%
7412 };%
7413 }%
7414 % \end{macrocode}
7415 % \end{macro}
7416 % \begin{macro}{\nonogramV}
7417 % \begin{macrocode}
7418 \newcommand*\nonogramV[1]%
7419 {%
7420 \LP@set@LP@fontsize{\LP@env@prefix}%
7421 \setcounter{LP@whiledo@i}{0}%
7422 \foreach \LP@line in {#1}%
7423 {%
7424 \setcounter{LP@countiii}{0}%
7425 \addtocounter{LP@whiledo@i}{1}%
7426 \foreach \LP@element in \LP@line%
7427 {%
7428 \ifthenelse{\value{LP@countiii}=0}%
7429 {%
7430 {\LP@fontsize\node at (0.5,\arabic{LP@whiledo@i}.5){\LP@element};}%
7431 }%
7432 {%
7433 \ifthenelse{\value{LP@countiii}=-1}%
7434 {%
7435 {\LP@fontsize\node at (-0.5,\arabic{LP@whiledo@i}.5){\LP@element};}%
7436 }%
7437 {%
7438 \addtocounter{LP@countiii}{1}%
7439 {\LP@fontsize\node at%
7440 (\arabic{LP@countiii}.5,\arabic{LP@whiledo@i}.5){\LP@element};}%
7441 \addtocounter{LP@countiii}{-1}%
7442 }%
7443 }%
7444 \addtocounter{LP@countiii}{-1}%
7445 }%
7446 };%
7447 }%
7448 % \end{macrocode}
7449 % \end{macro}
7450 % \begin{macro}{\nonogramH}
7451 % \begin{macrocode}
7452 \newcommand*\nonogramH[1]%
7453 {%
7454 \setcounter{LP@whiledo@i}{0}%
7455 \foreach \LP@line in {#1}%
7456 {%
7457 \setcounter{LP@countiii}{\LP@rows}%
7458 \addtocounter{LP@countiii}{1}%
7459 \addtocounter{LP@whiledo@i}{1}%
7460 \foreach \LP@element in \LP@line%
7461 {%
7462 {\LP@fontsize\node at%
7463 (\arabic{LP@whiledo@i}.5,\arabic{LP@countiii}.5){\LP@element};}%
7464 \addtocounter{LP@countiii}{1}%
7465 }%
7466 };%
7467 }%
7468 % \end{macrocode}
7469 % \end{macro}
7470 % \begin{macro}{\LP@nonogramgrid}
7471 % \begin{macrocode}
7472 \newcommand*\LP@nonogramgrid%
7473 {%
7474 \LP@set@LP@columns{\LP@env@prefix}%
7475 \LP@set@LP@rows{\LP@env@prefix}%
7476 \setcounter{LP@counti}{\LP@columns}% max column
7477 \setcounter{LP@countii}{\LP@rows}% max row
7478 \setcounter{LP@countiii}{\LP@NG@extracells}%
7479 \stepcounter{LP@counti}%
7480 \stepcounter{LP@countii}%
7481 \addtocounter{LP@countiii}{-1}%
7482 \setcounter{LP@whiledo@i}{1}%
7483 \setcounter{LP@whiledo@ii}{\LP@NG@extracells}%
7484 \addtocounter{LP@whiledo@ii}{\arabic{LP@countii}}%
7485 \setcounter{LP@countiii}{\arabic{LP@countii}}%
7486 \addtocounter{LP@countiii}{\LP@NG@extracells}%
7487 \addtocounter{LP@counti}{1}%
7488 \whiledo{\value{LP@whiledo@i}<\value{LP@counti}}%
7489 {%
7490 \draw[line width=\LP@normallines]%
7491 (\arabic{LP@whiledo@i},1) --%
7492 (\arabic{LP@whiledo@i},\arabic{LP@countiii});%
7493 \addtocounter{LP@whiledo@i}{1}%
7494 }%
7495 \addtocounter{LP@counti}{-1}%
7496 \setcounter{LP@whiledo@i}{1}%
7497 \setcounter{LP@whiledo@ii}{-\LP@NG@extracells}%
7498 \addtocounter{LP@whiledo@ii}{1}%
7499 \addtocounter{LP@countii}{1}%
7500 \whiledo{\value{LP@whiledo@i}<\value{LP@countii}}%
7501 {%
7502 \draw[line width=\LP@normallines]%
7503 (\arabic{LP@whiledo@ii},\arabic{LP@whiledo@i}) --%
7504 (\arabic{LP@counti},\arabic{LP@whiledo@i});%
7505 \addtocounter{LP@whiledo@i}{1}%
7506 }%
7507 \addtocounter{LP@countii}{-1}%
7508 \setcounter{LP@countiii}{\LP@NG@helplines}%
7509 \ifthenelse{\arabic{LP@countiii}>0}%
7510 {%
7511 \setcounter{LP@whiledo@i}{1}%
7512 \addtocounter{LP@whiledo@i}{\LP@NG@helplines}%
7513 \setcounter{LP@whiledo@ii}{\LP@NG@extracells}%
7514 \addtocounter{LP@whiledo@ii}{\arabic{LP@countii}}%
7515 \setcounter{LP@countiii}{\arabic{LP@countii}}%
7516 \addtocounter{LP@countiii}{\LP@NG@extracells}%
7517 \whiledo{\value{LP@whiledo@i}<\value{LP@counti}}%
7518 {%
7519 \draw[line width=\LP@thicklines]%
7520 (\arabic{LP@whiledo@i},1) --%
7521 (\arabic{LP@whiledo@i},\arabic{LP@countiii});%
7522 \addtocounter{LP@whiledo@i}{\LP@NG@helplines}%
7523 }%
7524 \draw[line width=\LP@thicklines] (1,1) -- (1,\arabic{LP@countiii});%
7525 \draw[line width=\LP@thicklines]%
7526 (\arabic{LP@counti},1) --%
7527 (\arabic{LP@counti},\arabic{LP@countiii});%
7528 \setcounter{LP@whiledo@i}{1}%
7529 \addtocounter{LP@whiledo@i}{\LP@NG@helplines}%
7530 \setcounter{LP@whiledo@ii}{-\LP@NG@extracells}%
7531 \addtocounter{LP@whiledo@ii}{1}%
7532 \whiledo{\value{LP@whiledo@i}<\value{LP@countii}}%
7533 {%
7534 \draw[line width=\LP@thicklines]%
7535 (\arabic{LP@whiledo@ii},\arabic{LP@whiledo@i}) --%
7536 (\arabic{LP@counti},\arabic{LP@whiledo@i});%
7537 \addtocounter{LP@whiledo@i}{\LP@NG@helplines}%
7538 }%
7539 \draw[line width=\LP@thicklines]%
7540 (\arabic{LP@whiledo@ii},1) -- (\arabic{LP@counti},1);%
7541 \draw[line width=\LP@thicklines]%
7542 (\arabic{LP@whiledo@ii},\arabic{LP@countii}) --%
7543 (\arabic{LP@counti},\arabic{LP@countii});%
7544 }%
7545 {}%
7546 }%
7547 % \end{macrocode}
7548 % \end{macro}
7549 % \begin{macro}{\nonogramsetup}
7550 % \begin{macrocode}
7551 \newcommand*\nonogramsetup[1]%
7552 {%
7553 \setkeys{nonogram.sty}{#1}%
7554 }%
7555 % \end{macrocode}
7556 % \end{macro}
7557 % \begin{environment}{nonogram}
7558 % \begin{macrocode}
7559 \newenvironment{nonogram}[1][]%
7560 {%
7561 \setkeys{nonogram}{#1}%
7562 \LP@set@package{nonogram}%
7563 \LP@set@env@prefix{LP@NG}%
7564 \setcounter{LP@rows}{\LP@NG@rows}%
7565 \setcounter{LP@columns}{\LP@NG@columns}%
7566 \stepcounter{LP@rows}%
7567 \stepcounter{LP@columns}%
7568 \begin{minipage}[t]{\LP@NG@width}%
7569 \ifthenelse{\equal{\LP@NG@title}{}}%
7570 {\par\enspace\par}% empty
7571 {\enspace\par\noindent\hspace{\LP@NG@titleindent}\parbox{\LP@NG@titlewidth}{\strut\LP@titleformat\LP@NG@title}\vspace{3mm}\par}%
7572 \begin{tikzpicture}[LPpreset,scale=\LP@NG@scale]%
7573 \LP@drawbackground{1}{1}{\LP@NG@columns}{\LP@NG@rows}{\LP@NG@bgcolor}%
7574 \LP@drawgrid{1}{1}{\LP@NG@columns}{\LP@NG@rows}{1cm}%
7575 \framepuzzle%
7576 \ifthenelse{\equal{\LP@NG@solution}{false}}%
7577 {%
7578 \LP@nonogramgrid%
7579 }%
7580 {}%
7581 }%
7582 {%
7583 \end{tikzpicture}%
7584 \LP@drawcounter{\LP@NG@counterstyle}%
7585 \stepcounter{LP@puzzlecounter}%
7586 \end{minipage}%
7587 }%
7588 % \end{macrocode}
7589 % \end{environment}
7590 % \begin{macrocode}
7591 %
7592 % numberlink environment and options
7593 %
7594 \newcommand*\LP@NL@init@prefix{LP@NL}%
7595 \newcommand*\LP@NL@init@package{numberlink}%
7596 %
7597 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{rows}{5}%
7598 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{columns}{5}%
7599 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{scale}{1}%
7600 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{counterstyle}{none}%
7601 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{bgcolor}{}%
7602 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{color}{red}%
7603 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{width}{5.1cm}%
7604 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{cvoffset}{-23pt}%
7605 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{title}{}%
7606 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{titleindent}{0cm}%
7607 \LP@define@key{\LP@NL@init@prefix}{\LP@NL@init@package}{titlewidth}{5.1cm}%
7608 \LP@define@choicekey@fontsize{\LP@NL@init@prefix}{\LP@NL@init@package}{Large}%
7609 %
7610 \newcommand*\numberlinkcell[3]%
7611 {%
7612 \fourwindscell{#1}{#2}{#3}{}%
7613 }%
7614 %
7615 %
7616 \newcommand*\numberlinksetup[1]%
7617 {%
7618 \setkeys{numberlink.sty}{#1}%
7619 }%
7620 % \end{macrocode}
7621 % \begin{macro}{\link}
7622 % \begin{macrocode}
7623 \newcommand*\link[2][]%
7624 {%
7625 \LP@set@LP@color{\LP@env@prefix}%
7626 \bgroup%
7627 \def\LP@rel@tikzpath{.5}%
7628 \LP@Line[color=\LP@color,#1]{#2}%
7629 \egroup%
7630 }%
7631 % \end{macrocode}
7632 % \end{macro}
7633 % \begin{environment}{numberlink}
7634 % \begin{macrocode}
7635 \newenvironment{numberlink}[1][]%
7636 {%
7637 \setkeys{numberlink}{#1}%
7638 \LP@set@package{numberlink}%
7639 \LP@set@env@prefix{LP@NL}%
7640 \setcounter{LP@rows}{\LP@NL@rows}%
7641 \setcounter{LP@columns}{\LP@NL@columns}%
7642 \stepcounter{LP@rows}%
7643 \stepcounter{LP@columns}%
7644 \begin{minipage}[t]{\LP@NL@width}%
7645 \ifthenelse{\equal{\LP@NL@title}{}}%
7646 {\par\enspace\par}% empty
7647 {\enspace\par\noindent\hspace{\LP@NL@titleindent}\parbox{\LP@NL@titlewidth}{\strut\LP@titleformat\LP@NL@title}\vspace{3mm}\par}%
7648 \begin{tikzpicture}[LPpreset,scale=\LP@NL@scale]%
7649 \LP@drawbackground{1}{1}{\LP@NL@columns}{\LP@NL@rows}{\LP@NL@bgcolor}%
7650 \LP@drawgrid{1}{1}{\LP@NL@columns}{\LP@NL@rows}{1cm}%
7651 }%
7652 {%
7653 \end{tikzpicture}%
7654 \LP@drawcounter{\LP@NL@counterstyle}%
7655 \stepcounter{LP@puzzlecounter}%
7656 \end{minipage}%
7657 }%
7658 % \end{macrocode}
7659 % \end{environment}
7660 % \begin{macrocode}
7661 %
7662 % resuko environment and options
7663 %
7664 \newcommand*\LP@RSK@init@prefix{LP@RSK}%
7665 \newcommand*\LP@RSK@init@package{resuko}%
7666 %
7667 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{rows}{5}%
7668 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{columns}{5}%
7669 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{scale}{1}%
7670 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{counterstyle}{none}%
7671 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{bgcolor}{}%
7672 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{color}{blue}%
7673 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{width}{5.1cm}%
7674 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{cvoffset}{-23pt}%
7675 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{title}{}%
7676 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{titleindent}{0cm}%
7677 \LP@define@key{\LP@RSK@init@prefix}{\LP@RSK@init@package}{titlewidth}{5.1cm}%
7678 \LP@define@choicekey@fontsize{\LP@RSK@init@prefix}{\LP@RSK@init@package}{Large}%
7679 %
7680 \let\resukocell\setcell%
7681 %
7682 \newcommand*\resukosetup[1]%
7683 {%
7684 \setkeys{resuko.sty}{#1}%
7685 }%
7686 % \end{macrocode}
7687 % \begin{macro}{\LP@trackC}
7688 % For the \env{resuko} environment, we need to draw differnt tiles of track segments.
7689 % First, we start with a curve from the bottom to the left.
7690 % \begin{macrocode}
7691 \newcommand*\LP@trackC%
7692 {%
7693 \LP@set@LP@scale{\LP@env@prefix}%
7694 \begin{tikzpicture}[scale=\LP@scale]%
7695 \pgfsetcornersarced{\pgfpoint{4mm*\LP@scale}{4mm*\LP@scale}}%
7696 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7697 (0,.5)--(.5,.5)--(.5,0);%
7698 \end{tikzpicture}%
7699 }%
7700 % \end{macrocode}
7701 % \end{macro}
7702 % \begin{macro}{\LP@G@trackC}
7703 % A generic command for drawing track curves with a rotation \oarg{angle}.
7704 %
7705 % \cs{LP@G@trackC}\oarg{angle}
7706 % \begin{macrocode}
7707 \newcommand*\LP@G@trackC[1][0]%
7708 {%
7709 \LP@set@LP@scale{\LP@env@prefix}%
7710 % \end{macrocode}
7711 % We draw a Ti\textit{k}Z picture and apply a rotation.
7712 % \begin{macrocode}
7713 \begin{tikzpicture}[scale=\LP@scale,rotate=#1]%
7714 % \end{macrocode}
7715 % We want tiles fitting into a cell, so we clip the picture. Furthermore, we
7716 % want rounded corners for the race track, of course!
7717 % \begin{macrocode}
7718 \clip (0,0) rectangle (1,1);%
7719 \pgfsetcornersarced{\pgfpoint{4mm*\LP@scale}{4mm*\LP@scale}}%
7720 % \end{macrocode}
7721 % Then we draw a track curve from the bottom to the left. Rotation applies
7722 % for the complete picture!
7723 % \begin{macrocode}
7724 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7725 (0,.5)--(.5,.5)--(.5,0);%
7726 \end{tikzpicture}%
7727 }%
7728 % \end{macrocode}
7729 % \end{macro}
7730 % \begin{macro}{\CurveBL}
7731 % \begin{macrocode}
7732 \let\CurveBL\LP@G@trackC%
7733 % \end{macrocode}
7734 % \end{macro}
7735 % \begin{macro}{\CurveBR}
7736 % \begin{macrocode}
7737 \newcommand*\CurveBR{\LP@G@trackC[90]}%
7738 % \end{macrocode}
7739 % \end{macro}
7740 % \begin{macro}{\CurveTR}
7741 % \begin{macrocode}
7742 \newcommand*\CurveTR{\LP@G@trackC[180]}%
7743 % \end{macrocode}
7744 % \end{macro}
7745 % \begin{macro}{\CurveTL}
7746 % \begin{macrocode}
7747 \newcommand*\CurveTL{\LP@G@trackC[270]}%
7748 % \end{macrocode}
7749 % \end{macro}
7750 % \begin{macro}{\LP@trackS}
7751 % Of course, we also need straights.
7752 % \begin{macrocode}
7753 \newcommand*\LP@trackS%
7754 {%
7755 \LP@set@LP@scale{\LP@env@prefix}%
7756 \begin{tikzpicture}[scale=\LP@scale]%
7757 \draw[draw opacity=0] (.2,0) -- (.8,1);%
7758 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7759 (.5,0)--(.5,1);%
7760 \end{tikzpicture}%
7761 }%
7762 % \end{macrocode}
7763 % \end{macro}
7764 % \begin{macro}{\LP@G@trackS}
7765 % We need horizontal and vertical straights, therefore we allow an rotate angle.
7766 %
7767 % \cs{LP@G@trackS}\oarg{angle}
7768 % \begin{macrocode}
7769 \newcommand*\LP@G@trackS[1][0]%
7770 {%
7771 \LP@set@LP@scale{\LP@env@prefix}%
7772 \begin{tikzpicture}[scale=\LP@scale,rotate=#1]%
7773 \clip (0,0) rectangle (1,1);%
7774 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7775 (.5,0)--(.5,1);%
7776 \end{tikzpicture}%
7777 }%
7778 % \end{macrocode}
7779 % \end{macro}
7780 % \begin{macro}{\StraightV}
7781 % \begin{macrocode}
7782 \newcommand*\StraightV{\LP@G@trackS}%
7783 % \end{macrocode}
7784 % \end{macro}
7785 % \begin{macro}{\StraightH}
7786 % \begin{macrocode}
7787 \newcommand*\StraightH{\LP@G@trackS[90]}%
7788 % \end{macrocode}
7789 % \end{macro}
7790 % \begin{macro}{\Straight}
7791 % \begin{macrocode}
7792 \let\Straight\StraightV%
7793 % \end{macrocode}
7794 % \end{macro}
7795 % \begin{macro}{\LP@trackCR}
7796 % Crossings are needed as well!
7797 % \begin{macrocode}
7798 \newcommand*\LP@trackCR%
7799 {%
7800 \LP@set@LP@scale{\LP@env@prefix}%
7801 \begin{tikzpicture}[scale=\LP@scale]%
7802 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7803 (0,0.5)--(1,.5);%
7804 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7805 (0.5,0)--(.5,.2);%
7806 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7807 (0.5,1)--(.5,.8);%
7808 \end{tikzpicture}%
7809 }%
7810 % \end{macrocode}
7811 % \end{macro}
7812 % \begin{macro}{\LP@G@trackCR}
7813 % Same game again, we need also rotated versions.
7814 % \begin{macrocode}
7815 \newcommand*\LP@G@trackCR[1][0]%
7816 {%
7817 \LP@set@LP@scale{\LP@env@prefix}%
7818 \begin{tikzpicture}[scale=\LP@scale,rotate=#1]%
7819 \clip (0,0) rectangle (1,1);%
7820 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7821 (0,0.5)--(1,.5);%
7822 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7823 (0.5,0)--(.5,.2);%
7824 \draw[color=LP@c@track, line width=.3cm*\LP@scale]%
7825 (0.5,1)--(.5,.8);%
7826 \end{tikzpicture}%
7827 }%
7828 %
7829 \newcommand*\CrossH{\LP@G@trackCR}%
7830 \newcommand*\CrossV{\LP@G@trackCR[90]}%
7831 \let\Cross\CrossH%
7832 % \end{macrocode}
7833 % \end{macro}
7834 % \begin{macro}{\LP@graveltrap}
7835 % We also need a gravel trap.
7836 %
7837 % \begin{macrocode}
7838 \newcommand*\LP@graveltrap%
7839 {%
7840 \LP@set@LP@scale{\LP@env@prefix}%
7841 \begin{tikzpicture}[scale=\LP@scale]%
7842 \clip (0,0) rectangle (1,1);%
7843 \fill[color=LP@c@track] (.5,.5) circle (.1cm);%
7844 \end{tikzpicture}%
7845 }%
7846 %
7847 \let\Graveltrap\LP@graveltrap%
7848 % \end{macrocode}
7849 % \end{macro}
7850 % \begin{macro}{\parkinglot}
7851 % And a parking lot!
7852 % \begin{macrocode}
7853 \newcommand*\parkinglot[2]%
7854 {%
7855 \LP@set@LP@scale{\LP@env@prefix}%
7856 \LP@set@LP@color{\LP@env@prefix}%
7857 \LP@set@LP@bgcolor{\LP@env@prefix}%
7858 \LP@set@LP@fontsize{\LP@env@prefix}%
7859 \ifthenelse{\equal{\LP@color}{}}%
7860 {\gdef\LP@c@parkinglot{black}}%
7861 {\gdef\LP@c@parkinglot{\LP@color}}%
7862 \ifthenelse{\equal{\LP@bgcolor}{}}%
7863 {\gdef\LP@c@bg@parkinglot{white}}%
7864 {\gdef\LP@c@bg@parkinglot{\LP@bgcolor}}%
7865 \setcounter{LP@counti}{#1}%
7866 \setcounter{LP@countii}{#2}%
7867 \stepcounter{LP@counti}%
7868 \stepcounter{LP@countii}%
7869 \draw[color=\LP@c@parkinglot,line width=\LP@normallines,%
7870 fill=\LP@c@bg@parkinglot] (#1,#2) rectangle ++(2,2);%
7871 \node[color=\LP@c@parkinglot,font=\sffamily\bfseries\LP@fontsize]%
7872 at (\arabic{LP@counti},\arabic{LP@countii}){P};%
7873 }%
7874 % \end{macrocode}
7875 % \end{macro}
7876 % \begin{macro}{\pitlane}
7877 % And finally, the pitlane!
7878 % \begin{macrocode}
7879 \newcommand*\pitlane[3]%
7880 {%
7881 \LP@set@LP@scale{\LP@env@prefix}%
7882 \LP@set@LP@color{\LP@env@prefix}%
7883 \ifthenelse{\equal{\LP@color}{}}%
7884 {\gdef\LP@c@pitlane{black}}%
7885 {\gdef\LP@c@pitlane{\LP@color}}%
7886 \ifthenelse{\equal{#3}{V}}%
7887 {\draw[color=black,line width=\LP@normallines,fill=\LP@c@pitlane]%
7888 (#1,#2) rectangle ++(1,4);}%
7889 {\draw[color=black,line width=\LP@normallines,fill=\LP@c@pitlane]%
7890 (#1,#2) rectangle ++(4,1);}%
7891 }%
7892 % \end{macrocode}
7893 % \end{macro}
7894 % \begin{macro}{\LP@trackline}
7895 % This macro provides the "box" placed next to the grid, showing the
7896 % straights, curves and crossings, which are needed in that line!
7897 %
7898 % \cs{LP@trackline}\marg{\string# straights}\marg{\string# curves}\marg{\string# crossings}
7899 % \begin{macrocode}
7900 \newcommand*\LP@trackline[3]%
7901 {%
7902 \LP@set@LP@scale{\LP@env@prefix}%
7903 \pgfmathsetlength{\LP@length}{.1cm*\LP@scale}%
7904 \scalebox{\LP@tracks@scale}%
7905 {%
7906 \hspace{\LP@length}%
7907 \setcounter{LP@whiledo@i}{#1}%
7908 \whiledo{\arabic{LP@whiledo@i}>0}%
7909 {%
7910 \LP@trackS%
7911 \addtocounter{LP@whiledo@i}{-1}%
7912 }%
7913 \setcounter{LP@whiledo@i}{#2}%
7914 \whiledo{\arabic{LP@whiledo@i}>0}%
7915 {%
7916 \LP@trackC%
7917 \addtocounter{LP@whiledo@i}{-1}%
7918 }%
7919 \hspace{\LP@length}%
7920 \setcounter{LP@whiledo@i}{#3}%
7921 \whiledo{\arabic{LP@whiledo@i}>0}%
7922 {%
7923 \LP@trackCR%
7924 \addtocounter{LP@whiledo@i}{-1}%
7925 }%
7926 }%
7927 }%
7928 % \end{macrocode}
7929 % \end{macro}
7930 % \begin{macro}{\trackV}
7931 % This macro places the vertical track lines and expects a csv list
7932 % in the format straights/curves/crossings!
7933 %
7934 % \cs{trackV}\marg{csv list}
7935 % \begin{macrocode}
7936 \newcommand*\trackV[1]%
7937 {%
7938 \LP@set@LP@columns{\LP@env@prefix}%
7939 \setcounter{LP@counti}{\LP@columns}%
7940 \stepcounter{LP@counti}%
7941 \setcounter{LP@countii}{1}%
7942 \foreach \LP@c@straight/\LP@c@curve/\LP@c@cross in {#1}%
7943 {%
7944 \node[anchor=west] at (\arabic{LP@counti},\arabic{LP@countii}.5)%
7945 {\LP@trackline{\LP@c@straight}{\LP@c@curve}{\LP@c@cross}};%
7946 \stepcounter{LP@countii}%
7947 };%
7948 }%
7949 % \end{macrocode}
7950 % \end{macro}
7951 % \begin{macro}{\trackH}
7952 % The same for the horizontal track lines!
7953 %
7954 % \cs{trackH}\marg{csv list}
7955 % \begin{macrocode}
7956 \newcommand*\trackH[1]%
7957 {%
7958 \setcounter{LP@counti}{1}%
7959 \setcounter{LP@countii}{1}%
7960 \foreach \LP@c@straight/\LP@c@curve/\LP@c@cross in {#1}%
7961 {%
7962 \node[anchor=west,rotate=-90]%
7963 at (\arabic{LP@counti}.5,\arabic{LP@countii})%
7964 {\LP@trackline{\LP@c@straight}{\LP@c@curve}{\LP@c@cross}};%
7965 \stepcounter{LP@counti}%
7966 };%
7967 }%
7968 % \end{macrocode}
7969 % \end{macro}
7970 % \begin{macro}{\track}
7971 % We still need to draw the race track. The used decoration - which allows
7972 % automatic over-/underbridges - was provided by
7973 % \href{http://tex.stackexchange.com/users/3708/frederic}{Frédéric} in this
7974 % \href{http://tex.stackexchange.com/questions/115923/crossing-paths-in-tikz-without-intersection}{question}!
7975 %
7976 % \cs{track}\marg{Ti\textit{k}z path}
7977 % \begin{macrocode}
7978 \newcommand*\track[1]%
7979 {%
7980 \LP@set@LP@scale{\LP@env@prefix}%
7981 \LP@set@LP@bgcolor{\LP@env@prefix}%
7982 \ifthenelse{\equal{\LP@bgcolor}{}}%
7983 {\gdef\LP@c@bg@track{white}}%
7984 {\gdef\LP@c@bg@track{\LP@bgcolor}}%
7985 \bgroup%
7986 \def\LP@rel@tikzpath{.5}%
7987 \begin{pgfonlayer}{LPbackgroundtwo}%
7988 \pgfsetcornersarced{\pgfpoint{4.9mm*\LP@scale}{4.9mm*\LP@scale}}%
7989 \draw[decorate,decoration={show path construction,%
7990 lineto code={%
7991 \draw [\LP@c@bg@track,line width=0.15cm*\LP@scale,%
7992 double=LP@c@track,double distance=.3cm*\LP@scale]%
7993 (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);},%
7994 curveto code={%
7995 \draw [LP@c@track,line width=0.3cm*\LP@scale]%
7996 (\tikzinputsegmentfirst) .. controls%
7997 (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)%
7998 ..(\tikzinputsegmentlast);}}] #1;%
7999 \end{pgfonlayer}%
8000 \egroup%
8001 }%
8002 % \end{macrocode}
8003 % \end{macro}
8004 % \begin{environment}{resuko}
8005 % \begin{macrocode}
8006 \newenvironment{resuko}[1][]%
8007 {%
8008 \setkeys{resuko}{#1}%
8009 \LP@set@package{resuko}%
8010 \LP@set@env@prefix{LP@RSK}%
8011 \setcounter{LP@rows}{\LP@RSK@rows}%
8012 \setcounter{LP@columns}{\LP@RSK@columns}%
8013 \stepcounter{LP@rows}%
8014 \stepcounter{LP@columns}%
8015 \begin{minipage}[t]{\LP@RSK@width}%
8016 \ifthenelse{\equal{\LP@RSK@title}{}}%
8017 {\par\enspace\par}% empty
8018 {\enspace\par\noindent\hspace{\LP@RSK@titleindent}\parbox{\LP@RSK@titlewidth}{\strut\LP@titleformat\LP@RSK@title}\vspace{3mm}\par}%
8019 \begin{tikzpicture}[LPpreset,scale=\LP@RSK@scale]%
8020 \LP@drawbackground{1}{1}{\LP@RSK@columns}{\LP@RSK@rows}{\LP@RSK@bgcolor}%
8021 \LP@drawgrid{1}{1}{\LP@RSK@columns}{\LP@RSK@rows}{1cm}%
8022 }%
8023 {%
8024 \end{tikzpicture}%
8025 \LP@drawcounter{\LP@RSK@counterstyle}%
8026 \stepcounter{LP@puzzlecounter}%
8027 \end{minipage}%
8028 }%
8029 % \end{macrocode}
8030 % \end{environment}
8031 % \begin{macrocode}
8032 %
8033 % schatzsuche environment and options
8034 %
8035 \newcommand*\LP@SS@init@prefix{LP@SS}%
8036 \newcommand*\LP@SS@init@package{schatzsuche}%
8037 %
8038 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{rows}{5}%
8039 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{columns}{5}%
8040 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{scale}{1}%
8041 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{counterstyle}{none}%
8042 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{bgcolor}{}%
8043 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{width}{5.1cm}%
8044 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{cvoffset}{-23pt}%
8045 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{title}{}%
8046 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{titleindent}{0cm}%
8047 \LP@define@key{\LP@SS@init@prefix}{\LP@SS@init@package}{titlewidth}{5.1cm}%
8048 \LP@define@choicekey@fontsize{\LP@SS@init@prefix}{\LP@SS@init@package}{Large}%
8049 %
8050 \let\schatzsuchecell\setcell%
8051 %
8052 \newcommand*\schatzsuchesetup[1]%
8053 {%
8054 \setkeys{schatzsuche.sty}{#1}%
8055 }%
8056 % \end{macrocode}
8057 % \begin{macro}{\LP@Diamond}
8058 % For the \env{schatzsuche} environment, we need to draw diamonds.
8059 % \begin{macrocode}
8060 \newcommand*\LP@Diamond%
8061 {%
8062 \begin{tikzpicture}[scale=\LP@scale*.9]%
8063 \clip (.05,.905) rectangle (.95,.1);%
8064 \draw[line width=\LP@normallines,fill=yellow!20]%
8065 (.5,.1) -- (.7,.9) -- (.3,.9) -- cycle;%
8066 \draw[line width=\LP@normallines,fill=orange!20]%
8067 (.5,.1) -- (.7,.9) -- (.9,.8) -- cycle;%
8068 \draw[line width=\LP@normallines,fill=orange!20]%
8069 (.5,.1) -- (.3,.9) -- (.1,.8) -- cycle;%
8070 \draw[line width=\LP@normallines] (.1,.8) -- (.9,.8);%
8071 \end{tikzpicture}%
8072 }%
8073 % \end{macrocode}
8074 % \end{macro}
8075 % \begin{macro}{\Diamond}
8076 % A user command for drawing diamonds.
8077 % \begin{macrocode}
8078 \let\Diamond\LP@Diamond%
8079 % \end{macrocode}
8080 % \end{macro}
8081 % \begin{environment}{schatzsuche}
8082 % \begin{macrocode}
8083 \newenvironment{schatzsuche}[1][]%
8084 {%
8085 \setkeys{schatzsuche}{#1}%
8086 \LP@set@package{schatzsuche}%
8087 \LP@set@env@prefix{LP@SS}%
8088 \setcounter{LP@rows}{\LP@SS@rows}%
8089 \setcounter{LP@columns}{\LP@SS@columns}%
8090 \stepcounter{LP@rows}%
8091 \stepcounter{LP@columns}%
8092 \begin{minipage}[t]{\LP@SS@width}%
8093 \ifthenelse{\equal{\LP@SS@title}{}}%
8094 {\par\enspace\par}% empty
8095 {\enspace\par\noindent\hspace{\LP@SS@titleindent}\parbox{\LP@SS@titlewidth}{\strut\LP@titleformat\LP@SS@title}\vspace{3mm}\par}%
8096 \begin{tikzpicture}[LPpreset,scale=\LP@SS@scale]%
8097 \LP@drawbackground{1}{1}{\LP@SS@columns}{\LP@SS@rows}{\LP@SS@bgcolor}%
8098 \LP@drawgrid{1}{1}{\LP@SS@columns}{\LP@SS@rows}{1cm}%
8099 }%
8100 {%
8101 \end{tikzpicture}%
8102 \LP@drawcounter{\LP@SS@counterstyle}%
8103 \stepcounter{LP@puzzlecounter}%
8104 \end{minipage}%
8105 }%
8106 % \end{macrocode}
8107 % \end{environment}
8108 % \begin{macrocode}
8109 %
8110 % skyline environment and options
8111 %
8112 \newcommand*\LP@SL@init@prefix{LP@SL}%
8113 \newcommand*\LP@SL@init@package{skyline}%
8114 %
8115 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{rows}{5}%
8116 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{columns}{5}%
8117 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{scale}{1}%
8118 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{counterstyle}{none}%
8119 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{bgcolor}{}%
8120 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{width}{6.7cm}%
8121 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{cvoffset}{-38pt}%
8122 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{title}{}%
8123 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{titleindent}{0.75cm}%
8124 \LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{titlewidth}{5.85cm}%
8125 \LP@define@choicekey@fontsize{\LP@SL@init@prefix}{\LP@SL@init@package}{Large}%
8126 %
8127 \newcommand*\LP@SL@sudoku{false}%
8128 %
8129 \define@choicekey*{skyline.sty}{sudoku}[\LP@SL@sudoku\nr]{true,false}[true]%
8130 {%
8131 \ifcase\nr\relax%
8132 \renewcommand*\LP@SL@sudoku{true}%
8133 \renewcommand*\LP@SL@rows{9}%
8134 \renewcommand*\LP@SL@columns{9}%
8135 \or%
8136 \renewcommand*\LP@SL@sudoku{false}%
8137 \fi%
8138 }%
8139 %
8140 \define@choicekey*{skyline}{sudoku}[\LP@SL@sudoku\nr]{true,false}[true]%
8141 {%
8142 \ifcase\nr\relax%
8143 \renewcommand*\LP@SL@sudoku{true}%
8144 \renewcommand*\LP@SL@rows{9}%
8145 \renewcommand*\LP@SL@columns{9}%
8146 \or%
8147 \renewcommand*\LP@SL@sudoku{false}%
8148 \fi%
8149 }%
8150 %
8151 \let\skylineB\LP@bottomrow%
8152 \let\skylineT\LP@toprow%
8153 \let\skylineL\LP@leftcolumn%
8154 \let\skylineR\LP@rightcolumn%
8155 \let\skylinecell\setcell%
8156 %
8157 \newcommand*\skylinesetup[1]%
8158 {%
8159 \setkeys{skyline.sty}{#1}%
8160 }%
8161 % \end{macrocode}
8162 % \begin{environment}{skyline}
8163 % \begin{macrocode}
8164 \newenvironment{skyline}[1][]%
8165 {%
8166 \setkeys{skyline}{#1}%
8167 \LP@set@package{skyline}%
8168 \LP@set@env@prefix{LP@SL}%
8169 \setcounter{LP@rows}{\LP@SL@rows}%
8170 \setcounter{LP@columns}{\LP@SL@columns}%
8171 \stepcounter{LP@rows}%
8172 \stepcounter{LP@columns}%
8173 \begin{minipage}[t]{\LP@SL@width}%
8174 \ifthenelse{\equal{\LP@SL@title}{}}%
8175 {\par\enspace\par}% empty
8176 {\enspace\par\noindent\hspace{\LP@SL@titleindent}\parbox{\LP@SL@titlewidth}{\strut\LP@titleformat\LP@SL@title}\vspace{3mm}\par}%
8177 \begin{tikzpicture}[LPpreset,scale=\LP@SL@scale]%
8178 \LP@drawbackground{1}{1}{\LP@SL@columns}{\LP@SL@rows}{\LP@SL@bgcolor}%
8179 \LP@drawgrid{1}{1}{\LP@SL@columns}{\LP@SL@rows}{1cm}%
8180 \ifthenelse{\equal{\LP@SL@sudoku}{true}}%
8181 {\LP@drawsudokugrid}%
8182 {}%
8183 }%
8184 {%
8185 \end{tikzpicture}%
8186 \LP@drawcounter{\LP@SL@counterstyle}%
8187 \stepcounter{LP@puzzlecounter}%
8188 \end{minipage}%
8189 }%
8190 % \end{macrocode}
8191 % \end{environment}
8192 % \begin{macrocode}
8193 %
8194 % slitherlink environment and options
8195 %
8196 \newcommand*\LP@SK@init@prefix{LP@SK}%
8197 \newcommand*\LP@SK@init@package{slitherlink}%
8198 %
8199 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{rows}{5}%
8200 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{columns}{5}%
8201 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{scale}{1}%
8202 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{counterstyle}{none}%
8203 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{bgcolor}{}%
8204 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{width}{5.2cm}%
8205 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{cvoffset}{-23pt}%
8206 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{title}{}%
8207 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{titleindent}{0cm}%
8208 \LP@define@key{\LP@SK@init@prefix}{\LP@SK@init@package}{titlewidth}{5.2cm}%
8209 \LP@define@choicekey@fontsize{\LP@SK@init@prefix}{\LP@SK@init@package}{Large}%
8210 %
8211 \let\slitherlinkcell\setcell%
8212 %
8213 \newcommand*\slitherlinksetup[1]%
8214 {%
8215 \setkeys{slitherlink.sty}{#1}%
8216 }%
8217 % \end{macrocode}
8218 % \begin{macro}{\LP@drawgriddots}
8219 % For the \env{slitherlink} environment, we need little dots in every cell corner.
8220 % Therefore, we loop through all rows and columns and paint the dots on the \layer{LPforeground} layer.
8221 % \changes{v2.5}{2013/07/22}{removed unnecessary \texttt{scale} update}
8222 % \begin{macrocode}
8223 \newcommand*\LP@drawgriddots%
8224 {%
8225 \pgfmathsetmacro{\START}{1}%
8226 % \end{macrocode}
8227 % The dots are drawn immediatly after the grid, so we can recycle |LP@counti| and |LP@countii|.
8228 % \begin{macrocode}
8229 \pgfmathsetmacro{\ENDC}{\arabic{LP@counti}}%
8230 \pgfmathsetmacro{\ENDR}{\arabic{LP@countii}}%
8231 \begin{pgfonlayer}{LPforeground}%
8232 \foreach \i in {\START,...,\ENDC}%
8233 \foreach \j in {\START,...,\ENDR}%
8234 \fill[color=LP@c@griddots] (\i,\j) circle [radius=3pt];%
8235 \end{pgfonlayer}%
8236 }%
8237 % \end{macrocode}
8238 % \end{macro}
8239 % \begin{environment}{slitherlink}
8240 % \begin{macrocode}
8241 \newenvironment{slitherlink}[1][]%
8242 {%
8243 \setkeys{slitherlink}{#1}%
8244 \LP@set@package{slitherlink}%
8245 \LP@set@env@prefix{LP@SK}%
8246 \ifthenelse{\equal{\LP@grid@linestyle}{}}%
8247 {\setgridlinestyle{dashed}}{}%
8248 \setcounter{LP@rows}{\LP@SK@rows}%
8249 \setcounter{LP@columns}{\LP@SK@columns}%
8250 \stepcounter{LP@rows}%
8251 \stepcounter{LP@columns}%
8252 \begin{minipage}[t]{\LP@SK@width}%
8253 \ifthenelse{\equal{\LP@SK@title}{}}%
8254 {\par\enspace\par}% empty
8255 {\enspace\par\noindent\hspace{\LP@SK@titleindent}\parbox{\LP@SK@titlewidth}{\strut\LP@titleformat\LP@SK@title}\vspace{3mm}\par}%
8256 \begin{tikzpicture}[LPpreset,scale=\LP@SK@scale]%
8257 \LP@drawbackground{1}{1}{\LP@SK@columns}{\LP@SK@rows}{\LP@SK@bgcolor}%
8258 \LP@drawgrid{1}{1}{\LP@SK@columns}{\LP@SK@rows}{1cm}%
8259 \LP@drawgriddots%
8260 }%
8261 {%
8262 \end{tikzpicture}%
8263 \LP@drawcounter{\LP@SK@counterstyle}%
8264 \stepcounter{LP@puzzlecounter}%
8265 \end{minipage}%
8266 }%
8267 % \end{macrocode}
8268 % \end{environment}
8269 % \begin{macrocode}
8270 %
8271 % starbattle environment and options
8272 %
8273 \newcommand*\LP@SB@init@prefix{LP@SB}%
8274 \newcommand*\LP@SB@init@package{starbattle}%
8275 %
8276 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{rows}{5}%
8277 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{columns}{5}%
8278 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{scale}{1}%
8279 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{counterstyle}{none}%
8280 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{bgcolor}{}%
8281 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{width}{5.1cm}%
8282 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{cvoffset}{-23pt}%
8283 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{title}{}%
8284 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{titleindent}{0cm}%
8285 \LP@define@key{\LP@SB@init@prefix}{\LP@SB@init@package}{titlewidth}{5.1cm}%
8286 \LP@define@choicekey@fontsize{\LP@SB@init@prefix}{\LP@SB@init@package}{Large}%
8287 %
8288 \let\starbattlecell\setcell%
8289 %
8290 \newcommand*\starbattlesetup[1]%
8291 {%
8292 \setkeys{starbattle.sty}{#1}%
8293 }%
8294 % \end{macrocode}
8295 % \begin{environment}{starbattle}
8296 % \begin{macrocode}
8297 \newenvironment{starbattle}[1][]%
8298 {%
8299 \setkeys{starbattle}{#1}%
8300 \LP@set@package{starbattle}%
8301 \LP@set@env@prefix{LP@SB}%
8302 \setcounter{LP@rows}{\LP@SB@rows}%
8303 \setcounter{LP@columns}{\LP@SB@columns}%
8304 \stepcounter{LP@rows}%
8305 \stepcounter{LP@columns}%
8306 \begin{minipage}[t]{\LP@SB@width}%
8307 \ifthenelse{\equal{\LP@SB@title}{}}%
8308 {\par\enspace\par}% empty
8309 {\enspace\par\noindent\hspace{\LP@SB@titleindent}\parbox{\LP@SB@titlewidth}{\strut\LP@titleformat\LP@SB@title}\vspace{3mm}\par}%
8310 \begin{tikzpicture}[LPpreset,scale=\LP@SB@scale]%
8311 \LP@drawbackground{1}{1}{\LP@SB@columns}{\LP@SB@rows}{\LP@SB@bgcolor}%
8312 \LP@drawgrid{1}{1}{\LP@SB@columns}{\LP@SB@rows}{1cm}%
8313 }%
8314 {%
8315 \end{tikzpicture}%
8316 \LP@drawcounter{\LP@SB@counterstyle}%
8317 \stepcounter{LP@puzzlecounter}%
8318 \end{minipage}%
8319 }%
8320 % \end{macrocode}
8321 % \end{environment}
8322 % \begin{macrocode}
8323 %
8324 % starsandarrows environment and options
8325 %
8326 \newcommand*\LP@SAA@init@prefix{LP@SAA}%
8327 \newcommand*\LP@SAA@init@package{starsandarrows}%
8328 %
8329 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{rows}{5}%
8330 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{columns}{5}%
8331 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{scale}{1}%
8332 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{counterstyle}{none}%
8333 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{bgcolor}{}%
8334 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{width}{5.9cm}%
8335 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{cvoffset}{-23pt}%
8336 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{title}{}%
8337 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{titleindent}{0cm}%
8338 \LP@define@key{\LP@SAA@init@prefix}{\LP@SAA@init@package}{titlewidth}{5.9cm}%
8339 \LP@define@choicekey@fontsize{\LP@SAA@init@prefix}{\LP@SAA@init@package}{Large}%
8340 %
8341 \let\starsH\LP@toprow%
8342 \let\starsV\LP@leftcolumn%
8343 %
8344 \newcommand*\starsandarrowssetup[1]%
8345 {%
8346 \setkeys{starsandarrows.sty}{#1}%
8347 }%
8348 % \end{macrocode}
8349 % \begin{macro}{\LP@Star}
8350 % For several environments, we need to draw stars.
8351 % \begin{macrocode}
8352 \newcommand*\LP@Star%
8353 {%
8354 \tikz\node[shape=star,fill=yellow,draw,scale=.8*\LP@scale,%
8355 star point height=.25cm] {};%
8356 }%
8357 % \end{macrocode}
8358 % A user command for drawing stars.
8359 % \begin{macrocode}
8360 \let\Star\LP@Star%
8361 % \end{macrocode}
8362 % \end{macro}
8363 % \begin{macro}{\LP@ArrowA}
8364 % A generic macro for drawing arrows with different colors and angles.
8365 %
8366 % \cs{LP@ArrowA}\oarg{color}\marg{angle}
8367 % \begin{macrocode}
8368 \newcommand*\LP@ArrowA[2][red]%
8369 {%
8370 \LP@set@LP@scale{\LP@env@prefix}%
8371 \pgfmathsetmacro{\LPlinewidth}{3pt*\LP@scale}%
8372 \tikz\draw[->,line width=\LPlinewidth,rotate=#2,%
8373 scale=\LP@scale,color=#1]%
8374 (0.1,.5) -- (0.9,.5);%
8375 }%
8376 % \end{macrocode}
8377 % The we define some arrows with standard angles.
8378 % \begin{macrocode}
8379 \newcommand*\LP@c@stararrow{red}%
8380 % \end{macrocode}
8381 % \end{macro}
8382 % \begin{macro}{\Right}
8383 % \begin{macrocode}
8384 \newcommand*\Right{\LP@ArrowA[\LP@c@stararrow]{0}}%
8385 % \end{macrocode}
8386 % \end{macro}
8387 % \begin{macro}{\RightUp}
8388 % \begin{macrocode}
8389 \newcommand*\RightUp{\LP@ArrowA[\LP@c@stararrow]{45}}%
8390 % \end{macrocode}
8391 % \end{macro}
8392 % \begin{macro}{\Up}
8393 % \begin{macrocode}
8394 \newcommand*\Up{\LP@ArrowA[\LP@c@stararrow]{90}}%
8395 % \end{macrocode}
8396 % \end{macro}
8397 % \begin{macro}{\LeftUp}
8398 % \begin{macrocode}
8399 \newcommand*\LeftUp{\LP@ArrowA[\LP@c@stararrow]{135}}%
8400 % \end{macrocode}
8401 % \end{macro}
8402 % \begin{macro}{\Left}
8403 % \begin{macrocode}
8404 \newcommand*\Left{\LP@ArrowA[\LP@c@stararrow]{180}}%
8405 % \end{macrocode}
8406 % \end{macro}
8407 % \begin{macro}{\LeftDown}
8408 % \begin{macrocode}
8409 \newcommand*\LeftDown{\LP@ArrowA[\LP@c@stararrow]{225}}%
8410 % \end{macrocode}
8411 % \end{macro}
8412 % \begin{macro}{\Down}
8413 % \begin{macrocode}
8414 \newcommand*\Down{\LP@ArrowA[\LP@c@stararrow]{270}}%
8415 % \end{macrocode}
8416 % \end{macro}
8417 % \begin{macro}{\RightDown}
8418 % \begin{macrocode}
8419 \newcommand*\RightDown{\LP@ArrowA[\LP@c@stararrow]{315}}%
8420 % \end{macrocode}
8421 % \end{macro}
8422 % \begin{environment}{starsandarrows}
8423 % \begin{macrocode}
8424 \newenvironment{starsandarrows}[1][]%
8425 {%
8426 \setkeys{starsandarrows}{#1}%
8427 \LP@set@package{starsandarrows}%
8428 \LP@set@env@prefix{LP@SAA}%
8429 \setcounter{LP@rows}{\LP@SAA@rows}%
8430 \setcounter{LP@columns}{\LP@SAA@columns}%
8431 \stepcounter{LP@rows}%
8432 \stepcounter{LP@columns}%
8433 \begin{minipage}[t]{\LP@SAA@width}%
8434 \ifthenelse{\equal{\LP@SAA@title}{}}%
8435 {\par\enspace\par}% empty
8436 {\enspace\par\noindent\hspace{\LP@SAA@titleindent}\parbox{\LP@SAA@titlewidth}{\strut\LP@titleformat\LP@SAA@title}\vspace{3mm}\par}%
8437 \begin{tikzpicture}[LPpreset,scale=\LP@SAA@scale]%
8438 \LP@drawbackground{1}{1}{\LP@SAA@columns}{\LP@SAA@rows}{\LP@SAA@bgcolor}%
8439 \LP@drawgrid{1}{1}{\LP@SAA@columns}{\LP@SAA@rows}{1cm}%
8440 }%
8441 {%
8442 \end{tikzpicture}%
8443 \LP@drawcounter{\LP@SAA@counterstyle}%
8444 \stepcounter{LP@puzzlecounter}%
8445 \end{minipage}%
8446 }%
8447 % \end{macrocode}
8448 % \end{environment}
8449 % \begin{macrocode}
8450 %
8451 % sunandmoon environment and options
8452 %
8453 \newcommand*\LP@SAM@init@prefix{LP@SAM}%
8454 \newcommand*\LP@SAM@init@package{sunandmoon}%
8455 %
8456 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{rows}{5}%
8457 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{columns}{5}%
8458 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{scale}{1}%
8459 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{counterstyle}{none}%
8460 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{bgcolor}{}%
8461 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{width}{5.1cm}%
8462 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{cvoffset}{-23pt}%
8463 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{title}{}%
8464 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{titleindent}{0cm}%
8465 \LP@define@key{\LP@SAM@init@prefix}{\LP@SAM@init@package}{titlewidth}{5.1cm}%
8466 \LP@define@choicekey@fontsize{\LP@SAM@init@prefix}{\LP@SAM@init@package}{Large}%
8467 %
8468 \let\sunandmooncell\setcell%
8469 %
8470 \newcommand*\sunandmoonsetup[1]%
8471 {%
8472 \setkeys{sunandmoon.sty}{#1}%
8473 }%
8474 % \end{macrocode}
8475 % \begin{macro}{\LP@DarkCloud}
8476 % For the \env{sunandmoon} environment, we need to draw a dark cloud and differently%
8477 % lighted moons.
8478 % \begin{macrocode}
8479 \newcommand*\LP@DarkCloud{%
8480 \tikz[scale=0.7*\LP@scale]\fill[color=black!60] (0,0)%
8481 rectangle (1,1);%
8482 }%
8483 % \end{macrocode}
8484 % \end{macro}
8485 % \begin{macro}{\LP@Moon}
8486 % \begin{macrocode}
8487 \newcommand*\LP@Moon{%
8488 \tikz[scale=0.7*\LP@scale]\fill[color=black!60]%
8489 (0,0) circle (0.5cm);%
8490 }%
8491 % \end{macrocode}
8492 % \end{macro}
8493 % \begin{macro}{\LP@MoonR}
8494 % \begin{macrocode}
8495 \newcommand*\LP@MoonR%
8496 {%
8497 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8498 \fill[color=black!60] (0.5,0.5) circle (0.5cm);%
8499 \fill[color=yellow] (.5,0) arc (270:450:.5);%
8500 \end{tikzpicture}%
8501 }%
8502 % \end{macrocode}
8503 % \end{macro}
8504 % \begin{macro}{\LP@MoonL}
8505 % \begin{macrocode}
8506 \newcommand*\LP@MoonL%
8507 {%
8508 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8509 \fill[color=black!60] (0.5,0.5) circle (0.5cm);%
8510 \fill[color=yellow] (.5,0) arc (270:90:.5);%
8511 \end{tikzpicture}%
8512 }%
8513 % \end{macrocode}
8514 % \end{macro}
8515 % \begin{macro}{\LP@MoonT}
8516 % \begin{macrocode}
8517 \newcommand*\LP@MoonT%
8518 {%
8519 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8520 \fill[color=black!60] (0.5,0.5) circle (0.5cm);%
8521 \fill[color=yellow] (0,0.5) arc (180:0:.5);%
8522 \end{tikzpicture}%
8523 }%
8524 % \end{macrocode}
8525 % \end{macro}
8526 % \begin{macro}{\LP@MoonB}
8527 % \begin{macrocode}
8528 \newcommand*\LP@MoonB%
8529 {%
8530 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8531 \fill[color=black!60] (0.5,0.5) circle (0.5cm);%
8532 \fill[color=yellow] (0,0.5) arc (180:360:.5);%
8533 \end{tikzpicture}%
8534 }%
8535 % \end{macrocode}
8536 % \end{macro}
8537 % \begin{macro}{\LP@MoonTL}
8538 % \begin{macrocode}
8539 \newcommand*\LP@MoonTL%
8540 {%
8541 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8542 \fill[color=yellow] (0.5,0.5) circle (0.5cm);%
8543 \fill[color=black!60] (1,.5) -- (.5,.5) -- (.5,0)%
8544 arc (270:360:.5);%
8545 \end{tikzpicture}%
8546 }%
8547 % \end{macrocode}
8548 % \end{macro}
8549 % \begin{macro}{\LP@MoonBL}
8550 % \begin{macrocode}
8551 \newcommand*\LP@MoonBL%
8552 {%
8553 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8554 \fill[color=yellow] (0.5,0.5) circle (0.5cm);%
8555 \fill[color=black!60] (1,.5) -- (.5,.5) -- (.5,1)%
8556 arc (90:0:.5);%
8557 \end{tikzpicture}%
8558 }%
8559 % \end{macrocode}
8560 % \end{macro}
8561 % \begin{macro}{\LP@MoonBR}
8562 % \begin{macrocode}
8563 \newcommand*\LP@MoonBR%
8564 {%
8565 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8566 \fill[color=yellow] (0.5,0.5) circle (0.5cm);%
8567 \fill[color=black!60] (0,.5) -- (.5,.5) -- (.5,1)%
8568 arc (90:180:.5);%
8569 \end{tikzpicture}%
8570 }%
8571 % \end{macrocode}
8572 % \end{macro}
8573 % \begin{macro}{\LP@MoonTR}
8574 % \begin{macrocode}
8575 \newcommand*\LP@MoonTR%
8576 {%
8577 \begin{tikzpicture}[scale=0.7*\LP@scale]%
8578 \fill[color=yellow] (0.5,0.5) circle (0.5cm);%
8579 \fill[color=black!60] (0,.5) -- (.5,.5) -- (.5,0)%
8580 arc (270:180:.5);%
8581 \end{tikzpicture}%
8582 }%
8583 % \end{macrocode}
8584 % \end{macro}
8585 % \begin{macro}{\Cloud}
8586 % \begin{macrocode}
8587 \let\Cloud\LP@DarkCloud%
8588 % \end{macrocode}
8589 % \end{macro}
8590 % \begin{macro}{\Moon}
8591 % \begin{macrocode}
8592 \let\Moon\LP@Moon%
8593 % \end{macrocode}
8594 % \end{macro}
8595 % \begin{macro}{\MoonR}
8596 % \begin{macrocode}
8597 \let\MoonR\LP@MoonR%
8598 % \end{macrocode}
8599 % \end{macro}
8600 % \begin{macro}{\MoonL}
8601 % \begin{macrocode}
8602 \let\MoonL\LP@MoonL%
8603 % \end{macrocode}
8604 % \end{macro}
8605 % \begin{macro}{\MoonT}
8606 % \begin{macrocode}
8607 \let\MoonT\LP@MoonT%
8608 % \end{macrocode}
8609 % \end{macro}
8610 % \begin{macro}{\MoonB}
8611 % \begin{macrocode}
8612 \let\MoonB\LP@MoonB%
8613 % \end{macrocode}
8614 % \end{macro}
8615 % \begin{macro}{\MoonTL}
8616 % \begin{macrocode}
8617 \let\MoonTL\LP@MoonTL%
8618 % \end{macrocode}
8619 % \end{macro}
8620 % \begin{macro}{\MoonBL}
8621 % \begin{macrocode}
8622 \let\MoonBL\LP@MoonBL%
8623 % \end{macrocode}
8624 % \end{macro}
8625 % \begin{macro}{\MoonBR}
8626 % \begin{macrocode}
8627 \let\MoonBR\LP@MoonBR%
8628 % \end{macrocode}
8629 % \end{macro}
8630 % \begin{macro}{\MoonTR}
8631 % \begin{macrocode}
8632 \let\MoonTR\LP@MoonTR%
8633 % \end{macrocode}
8634 % \end{macro}
8635 % \begin{environment}{sunandmoon}
8636 % \begin{macrocode}
8637 \newenvironment{sunandmoon}[1][]%
8638 {%
8639 \setkeys{sunandmoon}{#1}%
8640 \LP@set@package{sunandmoon}%
8641 \LP@set@env@prefix{LP@SAM}%
8642 \setcounter{LP@rows}{\LP@SAM@rows}%
8643 \setcounter{LP@columns}{\LP@SAM@columns}%
8644 \stepcounter{LP@rows}%
8645 \stepcounter{LP@columns}%
8646 \begin{minipage}[t]{\LP@SAM@width}%
8647 \ifthenelse{\equal{\LP@SAM@title}{}}%
8648 {\par\enspace\par}% empty
8649 {\enspace\par\noindent\hspace{\LP@SAM@titleindent}\parbox{\LP@SAM@titlewidth}{\strut\LP@titleformat\LP@SAM@title}\vspace{3mm}\par}%
8650 \begin{tikzpicture}[LPpreset,scale=\LP@SAM@scale]%
8651 \LP@drawbackground{1}{1}{\LP@SAM@columns}{\LP@SAM@rows}{\LP@SAM@bgcolor}%
8652 \LP@drawgrid{1}{1}{\LP@SAM@columns}{\LP@SAM@rows}{1cm}%
8653 }%
8654 {%
8655 \end{tikzpicture}%
8656 \LP@drawcounter{\LP@SAM@counterstyle}%
8657 \stepcounter{LP@puzzlecounter}%
8658 \end{minipage}%
8659 }%
8660 % \end{macrocode}
8661 % \end{environment}
8662 % \begin{macrocode}
8663 %
8664 % tentsandtrees environment and options
8665 %
8666 \newcommand*\LP@TAT@init@prefix{LP@TAT}%
8667 \newcommand*\LP@TAT@init@package{tentsandtrees}%
8668 %
8669 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{rows}{5}%
8670 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{columns}{5}%
8671 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{scale}{1}%
8672 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{counterstyle}{none}%
8673 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{bgcolor}{}%
8674 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{width}{5.9cm}%
8675 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{cvoffset}{-23pt}%
8676 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{title}{}%
8677 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{titleindent}{0cm}%
8678 \LP@define@key{\LP@TAT@init@prefix}{\LP@TAT@init@package}{titlewidth}{5.9cm}%
8679 \LP@define@choicekey@fontsize{\LP@TAT@init@prefix}{\LP@TAT@init@package}{Large}%
8680 %
8681 \let\tentH\LP@toprow%
8682 \let\tentV\LP@leftcolumn%
8683 %
8684 \newcommand*\tentsandtreessetup[1]%
8685 {%
8686 \setkeys{tentsandtrees.sty}{#1}%
8687 }%
8688 % \end{macrocode}
8689 % \begin{macro}{\LP@Tree}
8690 % For the \env{tentsandtree} environments, we need to draw trees.
8691 % \begin{macrocode}
8692 \newcommand*\LP@Tree%
8693 {%
8694 \begin{tikzpicture}[scale=.07*\LP@scale]%
8695 \draw[fill=brown!95!black!95,line width=.1pt*\LP@scale]%
8696 (.75,-1) .. controls (.5,.5) and (.5,3) .. (0.5,4) --%
8697 (-0.5,4) .. controls (-.5,3) and (-.5,.5) .. (-.75,-1);%
8698 \shade[top color=green!50!black!60,draw=black,%
8699 line width=.1pt*\LP@scale,bottom color=green!50!black]%
8700 (0,10) .. controls (0,8) and (1,7) .. (1.5,7)%
8701 .. controls (1,7) and (1,7) .. (0.5,7.25)%
8702 .. controls (1.5,5) and (2.5,4) .. (3,4)%
8703 .. controls (2,4) and (1.25,4) .. (1,4.5)%
8704 .. controls (2,2) and (3.5,2) .. (4,2)%
8705 .. controls (1,1) and (-1,1) .. (-4,2)%
8706 .. controls (-3.5,2) and (-2,2) .. (-1,4.5)%
8707 .. controls (-1.25,4) and (-2,4) .. (-3,4)%
8708 .. controls (-2.5,4) and (-1.5,5) .. (-0.5,7.25)%
8709 .. controls (-1,7) and (-1,7) .. (-1.5,7)%
8710 .. controls (-1,7) and (0,8) .. (0,10);%
8711 \end{tikzpicture}%
8712 }%
8713 % \end{macrocode}
8714 % \end{macro}
8715 % \begin{macro}{\Tree}
8716 % A user command for drawing a tree.
8717 % \begin{macrocode}
8718 \let\Tree\LP@Tree%
8719 % \end{macrocode}
8720 % \end{macro}
8721 % \begin{macro}{\LP@Tent}
8722 % We also need tents.
8723 % \begin{macrocode}
8724 \newcommand*\LP@Tent%
8725 {%
8726 \begin{tikzpicture}[scale=\LP@scale]%
8727 \draw[fill=yellow!50,line width=.1pt*\LP@scale]%
8728 (.1,.1) -- (.6,.1) -- (.9,.5) -- (.75,.8) -- (.35,.6)%
8729 -- cycle;%
8730 \draw[line width=.1pt*\LP@scale] (.35,.6) -- (.35,.1);%
8731 \draw[line width=.1pt*\LP@scale] (.35,.6) -- (.6,.1);%
8732 \end{tikzpicture}%
8733 }%
8734 % \end{macrocode}
8735 % \end{macro}
8736 % \begin{macro}{\Tent}
8737 % A user command for drawing tents.
8738 % \begin{macrocode}
8739 \let\Tent\LP@Tent%
8740 % \end{macrocode}
8741 % \end{macro}
8742 % \begin{environment}{tentsandtrees}
8743 % \begin{macrocode}
8744 \newenvironment{tentsandtrees}[1][]%
8745 {%
8746 \setkeys{tentsandtrees}{#1}%
8747 \LP@set@package{tentsandtrees}%
8748 \LP@set@env@prefix{LP@TAT}%
8749 \setcounter{LP@rows}{\LP@TAT@rows}%
8750 \setcounter{LP@columns}{\LP@TAT@columns}%
8751 \stepcounter{LP@rows}%
8752 \stepcounter{LP@columns}%
8753 \begin{minipage}[t]{\LP@TAT@width}%
8754 \ifthenelse{\equal{\LP@TAT@title}{}}%
8755 {\par\enspace\par}% empty
8756 {\enspace\par\noindent\hspace{\LP@TAT@titleindent}\parbox{\LP@TAT@titlewidth}{\strut\LP@titleformat\LP@TAT@title}\vspace{3mm}\par}%
8757 \begin{tikzpicture}[LPpreset,scale=\LP@TAT@scale]%
8758 \LP@drawbackground{1}{1}{\LP@TAT@columns}{\LP@TAT@rows}{\LP@TAT@bgcolor}%
8759 \LP@drawgrid{1}{1}{\LP@TAT@columns}{\LP@TAT@rows}{1cm}%
8760 }%
8761 {%
8762 \end{tikzpicture}%
8763 \LP@drawcounter{\LP@TAT@counterstyle}%
8764 \stepcounter{LP@puzzlecounter}%
8765 \end{minipage}%
8766 }%
8767 % \end{macrocode}
8768 % \end{environment}
8769 % \begin{macrocode}
8770 %
8771 % tunnel environment and options
8772 %
8773 \newcommand*\LP@TN@init@prefix{LP@TN}%
8774 \newcommand*\LP@TN@init@package{tunnel}%
8775 %
8776 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{rows}{5}%
8777 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{columns}{5}%
8778 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{scale}{1}%
8779 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{counterstyle}{none}%
8780 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{bgcolor}{}%
8781 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{width}{5.9cm}%
8782 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{cvoffset}{-23pt}%
8783 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{title}{}%
8784 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{titleindent}{0cm}%
8785 \LP@define@key{\LP@TN@init@prefix}{\LP@TN@init@package}{titlewidth}{5.9cm}%
8786 \LP@define@choicekey@fontsize{\LP@TN@init@prefix}{\LP@TN@init@package}{Large}%
8787 %
8788 \let\tunnelH\LP@toprow%
8789 \let\tunnelV\LP@leftcolumn%
8790 %
8791 \newcommand*\tunnelsetup[1]%
8792 {%
8793 \setkeys{tunnel.sty}{#1}%
8794 }%
8795 % \end{macrocode}
8796 % \begin{macro}{\LP@Portal}
8797 % We define a Ti{\itshape k}Z picture that symbolizes a tunnel portal.
8798 % \begin{macrocode}
8799 \newcommand*\LP@Portal%
8800 {%
8801 \LP@set@LP@scale{\LP@env@prefix}%
8802 \begin{tikzpicture}[scale=\LP@scale]%
8803 \fill[color=black]%
8804 (0,0) -- (0,1) -- (.4,.5) -- (.4,0) -- cycle;%
8805 \fill[color=LP@c@tunnel@ii]%
8806 (0,1) -- (1,1) -- (1,.5) -- (.4,.5) -- cycle;%
8807 \fill[color=LP@c@tunnel@i]%
8808 (.4,0) rectangle (1,.5);%
8809 \draw[line width=\LP@normallines] (0,0) rectangle (1,1) ;%
8810 \end{tikzpicture}%
8811 }%
8812 % \end{macrocode}
8813 % \end{macro}
8814 % \begin{macro}{\portal}
8815 % We define a user command to set a tunnel portal into a grid cell.
8816 %
8817 % \cs{portal}\marg{column}\marg{row}
8818 % \begin{macrocode}
8819 \newcommand*\portal[2]%
8820 {%
8821 % \end{macrocode}
8822 % To avoid interference with the grid lines, we use the \layer{LPbackground} layer.
8823 % \begin{macrocode}
8824 \begin{puzzlebackground}%
8825 \LP@G@setcellcontent[hcenter,vcenter]{#1}{#2}{\LP@Portal}%
8826 \end{puzzlebackground}%
8827 }%
8828 % \end{macrocode}
8829 % \end{macro}
8830 % \begin{macro}{\tube}
8831 % For the \env{tunnel} environments, we need to draw tubes.
8832 %
8833 % \cs{tube}\marg{TikZ path}
8834 % \begin{macrocode}
8835 \newcommand*\tube[1]%
8836 {%
8837 \LP@set@LP@scale{\LP@env@prefix}%
8838 \bgroup%
8839 % \end{macrocode}
8840 % Tubes start in the center of a grid cell, therefore we must redefine\newline
8841 % \cs{LP@rel@tikzpath} to |.5| inside a group for \cs{tikzpath} and \cs{xtikzpath}.
8842 % \begin{macrocode}
8843 \def\LP@rel@tikzpath{.5}%
8844 % \end{macrocode}
8845 % We draw on the \layer{LPbackgroundtwo} layer to get a segmented look behind
8846 % the grid lines.
8847 % \begin{macrocode}
8848 \begin{pgfonlayer}{LPbackgroundtwo}%
8849 \pgfsetcornersarced{\pgfpoint{3mm}{3mm}}%
8850 % \end{macrocode}
8851 % We draw the tube several times with slightly different colors to get a 3D effect.
8852 % \begin{macrocode}
8853 \draw[color=LP@c@tunnel!80!black, line width=.4cm*\LP@scale]%
8854 #1;%
8855 \draw[color=LP@c@tunnel, line width=.38cm*\LP@scale] #1;%
8856 \draw[color=LP@c@tunnel!85, line width=.35cm*\LP@scale] #1;%
8857 \draw[color=LP@c@tunnel!70, line width=.32cm*\LP@scale] #1;%
8858 \draw[color=LP@c@tunnel!55, line width=.29cm*\LP@scale] #1;%
8859 \draw[color=LP@c@tunnel!45, line width=.25cm*\LP@scale] #1;%
8860 \draw[color=LP@c@tunnel!35, line width=.2cm*\LP@scale] #1;%
8861 \end{pgfonlayer}%
8862 \egroup%
8863 }%
8864 % \end{macrocode}
8865 % \end{macro}
8866 % \begin{environment}{tunnel}
8867 % \begin{macrocode}
8868 \newenvironment{tunnel}[1][]%
8869 {%
8870 \setkeys{tunnel}{#1}%
8871 \LP@set@package{tunnel}%
8872 \LP@set@env@prefix{LP@TN}%
8873 \setcounter{LP@rows}{\LP@TN@rows}%
8874 \setcounter{LP@columns}{\LP@TN@columns}%
8875 \stepcounter{LP@rows}%
8876 \stepcounter{LP@columns}%
8877 \begin{minipage}[t]{\LP@TN@width}%
8878 \ifthenelse{\equal{\LP@TN@title}{}}%
8879 {\par\enspace\par}% empty
8880 {\enspace\par\noindent\hspace{\LP@TN@titleindent}\parbox{\LP@TN@titlewidth}{\strut\LP@titleformat\LP@TN@title}\vspace{3mm}\par}%
8881 \begin{tikzpicture}[LPpreset,scale=\LP@TN@scale]%
8882 \LP@drawbackground{1}{1}{\LP@TN@columns}{\LP@TN@rows}{\LP@TN@bgcolor}%
8883 \LP@drawgrid{1}{1}{\LP@TN@columns}{\LP@TN@rows}{1cm}%
8884 }%
8885 {%
8886 \end{tikzpicture}%
8887 \LP@drawcounter{\LP@TN@counterstyle}%
8888 \stepcounter{LP@puzzlecounter}%
8889 \end{minipage}%
8890 }%
8891 % \end{macrocode}
8892 % \end{environment}
8893 % \begin{macrocode}
8894 %</lpenv>
8895 % \end{macrocode}
8896 %\Finale