Games::Word - utility functions for writing word games
use Games::Word; print "permutation!\n" if is_permutation 'word', 'orwd'; my $mm_solution = random_string_from "abcdefgh"; my $mm_guess = <>; chomp $mm_guess; my $mm_correct_letters = shared_letters $mm_solution, $mm_guess; my $mm_correct_positions = shared_letters_by_position $mm_solution, $mm_guess;
Games::Word provides several utility functions for writing word games, such as manipulating permutations of strings, testing for similarity of strings, and finding strings from a given source of characters.
Returns a string which is a random permutation of the letters in STRING.
Returns true of STRING1 is a permutation of STRING2, and false otherwise.
Returns a list containing all permutations of the characters in STRING.
Returns a list of the characters that STRING1 and STRING2 have in common, ignoring their position in the string.
In list context, returns a list that is the length of the larger of STRING1 and STRING2, which contains the character at that position in both strings if they are the same, and undef otherwise.
In scalar context, returns the number of characters that are the same in both value and position between STRING1 and STRING2.
Uses STRING as an alphabet to generate a random string of length LENGTH. Characters in STRING may be repeated.
Returns true if SUBSTRING consists of only characters from STRING, in order. For example, 'word' is a substring of 'awobbrcd', but not of 'dcrbbowa' or 'awbbrcd'.
Returns a list of all substrings (see is_substring) of STRING.
Returns true if SUBSTRING is a subpermutation (like is_substring, but without caring about order) of STRING, and false otherwise.
No known bugs.
Please report any bugs through RT: email
bug-games-word at rt.cpan.org, or browse http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Word.
You can find this documentation for this module with the perldoc command.
You can also look for information at:
Jesse Luehrs <doy at tozt dot net>
This software is copyright (c) 2012 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.