NAME
Games::Boggle - find words on a boggle board
SYNOPSIS
use Games::Boggle;
my $board = Games::Boggle->new("TRTO XIHP TEEB MQYP");
foreach my $word (@wordlist) {
print "OK $word\n" if $board->has_word($word);
}
DESCRIPTION
This module lets you set up a Boggle board, and then query it for whether or not it is possible to find words on that board.
METHODS
new
my $board = Games::Boggle->new("TRTO XIHP TEEB MEQP");
You initialize the board with a series of 16 letters representing the letters that are shown. Optional spaces may be inserted to make the board string more readable.
A 'Qu' should be entered solely as a 'Q'.
has_word
print "OK $word\n" if $board->has_word('tithe');
print "NOT OK $word\n" unless $board->has_word('queen');
Given any word, we return whether or not that word can be found on the board following the normal rules of Boggle.
In scalar context this returns the number of possible ways of finding this word. In list context it returns the starting squares from which this word can be found (but only once per square, no matter how many times it can be found there).
Words containing the letter Q should be entered in full ('Queen', rather than 'qeen'). Words containing a 'Q' not immediately followed by a 'U' are never playable.
AUTHOR
Tony Bowden
BUGS and QUERIES
Please direct all correspondence regarding this module to: bug-Games-Boggle@rt.cpan.org
COPYRIGHT AND LICENSE
Copyright (C) 2002-2005 Tony Bowden.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License; either version 2 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
SEE ALSO
Advanced Perl Programming, 2nd Edition, by Simon Cozens