The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Jumble - Create and solve Jumble word puzzles.

SYNOPSIS

  use Games::Jumble;

  my $jumble = Games::Jumble->new();
  $jumble->num_words(6);
  $jumble->dict('/home/doug/crossword_dict/unixdict.txt');

  my @jumble = $jumble->create_jumble;

  foreach my $word (@jumble) {
    print "$word\n";
  }

  # Solve jumbled word
  my @good_words = $jumble->solve_word('rta');

  if (@good_words) {
    foreach my $good_word (@good_words) {
      print "$good_word\n";
    }
  } else {
    print "No words found\n";
  }

  # Create jumbled word
  my $word = 'camel';
  my $jumbled_word = $jumble->jumble_word($word);

  print "$jumbled_word ($word)\n";

DESCRIPTION

Games::Jumble is used to create and solve Jumble word puzzles.

Currently Games::Jumble will create random five- and six-letter jumbled words from dictionary. Future versions of Games::Jumble will allow user to create custom jumbles by using a user defined word file with words of any length. Individual words of any length may be jumbled by using the jumble_word() method.

Default number of words is 5. Default dictionary is '/usr/dict/words'. Dictionary file must contain one word per line.

OVERVIEW

TODO

CONSTRUCTOR

new ( [NUMBER_OF_WORDS] );

This is the constructor for a new Games::Jumble object. If NUMBER_OF_WORDS is passed, this method will set the number of words for the puzzle.

METHODS

num_words ( NUMBER_OF_WORDS )

If NUMBER_OF_WORDS is passed, this method will set the number of words for the puzzle. The default value is 5. The number of words is returned.

dict ( PATH_TO_DICT )

If PATH_TO_DICT is passed, this method will set the path to the dictionary file. Dictionary file must have one word per line. The default value is /usr/dict/words. The path to the dictionary file is returned.

word_length_allow ( LENGTH1 [, LENGTH2, LENGTH3,...] )

If LENGTHx is(are) passed, this method will set word lengths that will be used when creating jumble. The default setting will use all word lengths. A hash containing all allow values is returned. Note: Allow all is designated by empty hash.

word_length_deny ( LENGTH1 [, LENGTH2, LENGTH3,...] )

If LENGTHx is(are) passed, this method will set word lengths that will be skipped when creating jumble. The default setting will not skip any word lengths. A hash containing all deny values is returned. Note: Deny none is designated by empty hash.

create_jumble ( )

This method creates the jumble. Returns list containing words (normal and jumbled).

solve_word ( WORD )

This method will solve a jumbled word. Returns list of solved words.

jumble_word ( WORD )

This method will create a jumbled word. Returns scalar containing jumbled word.

CREDITS

Tim Maher for pointing out some outdated documentation in the Synopsis.

AUTHOR

Doug Sparling, doug@dougsparling.com

COPYRIGHT

Copyright (c) 2001-2003 Douglas Sparling. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.