Games::Boggle - find words on a boggle board


Games-Boggle documentation  | view source Contained in the Games-Boggle distribution.

Index


NAME

Top

Games::Boggle - find words on a boggle board

SYNOPSIS

Top

  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

Top

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

Top

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

Top

Tony Bowden

BUGS and QUERIES

Top

Please direct all correspondence regarding this module to: bug-Games-Boggle@rt.cpan.org

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

Advanced Perl Programming, 2nd Edition, by Simon Cozens


Games-Boggle documentation  | view source Contained in the Games-Boggle distribution.