Andrew L. Johnson > Games-WordFind-0.02 > Games::WordFind

Download:
Games-WordFind-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

WordFind - Class for generating Word Find type puzzles

SYNOPSIS ^

    use Games::WordFind;
    $puz=Games::WordFind->new({cols=>10});
    @words=qw(perl camel llama linux great);
    $puz->create_puzzle(@words);
    print $puz->get_plain();
    
    or,
    print $puz->get_latex();

DESCRIPTION ^

This module simply provides a class which can be used to generate WordFind type puzzles. It is simple to use, the relevant methods are:

$puzzle = Games::WordFind->new({cols => 10,intersect=>1});

Obviously, this returns a WordFind object. By default the puzzle created by this object is a 10x10 lattice---you may give an optional hash reference with a 'cols' as the key and some number as the value for the size of the lattice. You may also provide an 'intersect' key, which allows words to intersect in the puzzle (share letters) when set to a non-zero value.

$puzzle->create_puzzle(LIST)

This method takes the LIST of words and creates the puzzle. Any words which are longer than the number of columns in the puzzle are dropped from the wordlist and a warning is issued. This method will return references to three arrays; a two dimensional array of the puzzle, an array of the words used, and a two dimensional array of the puzzle solution. These are so you can format your puzzle output yourself rather than using the latex or html formatting functions described next.

$puzzle->get_plain({solution => 1})

This method gets the puzzle and its solution matrix in a plain text format. If you supply the optional hash reference with a non-zero value for 'solution', a solution matrix is included immediately following the puzzle.

$puzzle->get_latex({solution => 1, wrapper => 1})

This method a latex formatted version of the puzzle containing tabular environments to set the puzzle and solution (a newpage separates the two). The optional hash argument can contain the key 'wrapper' which tells the method to return the puzzle wrapped with a latex preamble, and the key 'solution' which will return the solution matrix after a \newpage command in the latex source.

$puzzle->get_html({solution =>1, wrapper =>1})

Similar to the latex method, though, of course, there is no newpage separation of the solution.

AUTHOR ^

Andrew L Johnson <ajohnson@gpu.srv.ualberta.ca>

Copyright ^

WordFind.pm and wordfind.pl are copyright (c) 1997,1998 Andrew L Johnson. This is free software and you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

perl(1).

syntax highlighting: