Games::Roguelike::Utils - Convenience functions and exports for roguelikes
use Games::Roguelike::Utils qw(:all);
Non-object oriented functions that are generally helpful for roguelike programming, and are used by other roguelike modules.
Returns min/max of 2 passed values
Returns the distance between 2 points, uses Inline C version if available
Randomly sorts its arguments and returns the random array.
With 2 arguments, returns a random integer from a to b, inclusive.
With 1 argument, returns a random integer form 0 to a-1.
Pads string out to length using spaces or "char" if one is specified.
Hash mapping direction names to array ref offsets.
'n' =>[0,-1], # north decreases y, and leaves x alone ... 'se'=>[1, 1], # southeast increases y, and increases x
Array with delta entries as above, sorted as: 'n','s','e','w','ne','se','nw','sw', '.'
The array ('n','s','e','w','ne','se','nw','sw','.')
The array ('n','ne','e','se','s','sw','w','nw'), used in door-ok and other quadrant-scanning algorithms.
Maps 0=>'n', 1=>'s' ... etc. as in @DIRS
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html or the included LICENSE file.