Games::Boggle - find words on a boggle board
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); }
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.
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'.
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.
Tony Bowden
Please direct all correspondence regarding this module to: bug-Games-Boggle@rt.cpan.org
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.
Advanced Perl Programming, 2nd Edition, by Simon Cozens
To install Games::Boggle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Boggle
CPAN shell
perl -MCPAN -e shell install Games::Boggle
For more information on module installation, please visit the detailed CPAN module installation guide.