Game::TextPatterns::Util - utilities for text pattern generation
use Game::TextPatterns::Util qw(adj_4way adj_8way); my @adj = adj_4way([1,1], 7, 7); my @diags = adj_8way([1,1], 7, 7);
See Game::TextPatterns which uses the provided utility functions. The randomly method might well use these functions via a callback function.
- adj_4way point max-col max-row
Given a point that is an array reference
column, row(x,y) returns the points adjancent by compass motion. Note that error checking is limited in these routines as _fill or such in theory will restrict input points to lie within the bounding box.
Callers must not assume that the points will be returned in any particular order; use
randto pick from the points randomly if necessary.
max-col, max-roware array index values so must be
7,7for an 8x8 pattern.
- adj_8way point max-col max-row
Same as adj_4way only returning points by both compass and diagonal motions.
Humans are really good at mixing up the col,row (x,y) points with other forms especially given the different orientation of the internal pattern. Favor non-square patterns for tests to better expose such mixups.