Puzzles and brain teasers

Number Puzzles

Sudoku has been popular for about 15 years, on paper as well as on computers. Available options include sudoku [9], KSudoku [10], and gnome-sudoku [11] (Figure 7). More puzzles and the means to create games can be found in the program Hitori (Figure 8) [12] [13] and Simon Tatham's portable puzzle collection (sgt-puzzles package) [14].

Figure 7: Sudoku under Gnome.
Figure 8: Successfully solved Hitori.

Solution Helpers

To help find the right answers and words to the puzzle questions, you have various resources at your disposal. On one hand, the online dictionaries already presented in the Free Thesauri article [15] and web resources such as OneAcross [16], Crossword Solver [17], Crossword Nexus [18], and Wordplays.com [19] are useful, as well as websites for synonyms and antonyms [20] [21]. These sites significantly simplify a search based on a puzzle question or term.

Incorporating Puzzles

As mentioned before, Qxw, CrossFire, and Klest-crossword can export your puzzles as PDFs or image files and allow you to incorporate them into other documents. The extensions crossword, crosswrd, cwpuzzle, and sudoku are available in the comprehensive TeX archive network (CTAN) for typesetting with LaTeX. Debian and Ubuntu users can find all extensions in texlive-games [22].

Listing 1 shows a snippet of how you can set up a puzzle with the help of cwpuzzle. First, import both color and cwpuzzle in lines 2 and 3, and then set a gray-shaded, borderless square in lines 7-14.

Listing 1

Constructing a Puzzle in LaTeX

 

In lines 16 and 17, you decide whether to output the empty puzzle or its solution – the empty puzzle is chosen here. Define the grid and the contents of the squares based on the environment puzzle in lines 19-25. Individual squares are separated using the pipe character, |; curly brackets, {}, indicate blank squares; and indices for a puzzle word are in square brackets, [<no>]. If you add the detail [c], the color definition in line 2 becomes important, and the corresponding square is highlighted in gray. Each line ends with a period.

Lines 27-32 and 34-36 set the puzzle questions. Each question consists of a brief description that helps the puzzler find the solution. Figure 9 shows the puzzles created by LaTeX. For further information – including how to create number puzzles – read the detailed documentation included with the package.

Figure 9: Crossword puzzles with the help of LaTeX.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News