NAME
Games::Roguelike::Utils - Convenience functions and exports for roguelikes
SYNOPSIS
use Games::Roguelike::Utils qw(:all);
DESCRIPTION
Non-object oriented functions that are generally helpful for roguelike programming, and are used by other roguelike modules.
FUNCTIONS
- min (a, b)
- max (a, b)
-
Returns min/max of 2 passed values
- distance(x1, y1, x2, y2);
-
Returns the distance between 2 points, uses Inline C version if available
- randsort(array);
-
Randomly sorts its arguments and returns the random array.
- randi (a[, b])
-
With 2 arguments, returns a random integer from a to b, inclusive.
With 1 argument, returns a random integer form 0 to a-1.
- rpad (string, length [, char])
-
Pads string out to length using spaces or "char" if one is specified.
VARIABLES
- %DD - direction delta hash
-
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
- @DD - direction delta list
-
Array with delta entries as above, sorted as: 'n','s','e','w','ne','se','nw','sw', '.'
- @DIRS - direction list
-
The array ('n','s','e','w','ne','se','nw','sw','.')
- @CWDIRS - clockwise direction list
-
The array ('n','ne','e','se','s','sw','w','nw'), used in door-ok and other quadrant-scanning algorithms.
- @DI - direction index
-
Maps 0=>'n', 1=>'s' ... etc. as in @DIRS
- @DIRN - number of directions (8)
SEE ALSO
AUTHOR
Erik Aronesty earonesty@cpan.org
LICENSE
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.