note
Masem
Hmmm, [tye]'s solution provides insight to another:
<CODE>
# You might already have this type of function available.
# If not, it's needed for the next part:
sub same_coord
{
my ($aref, $bref) = @_;
my @acoord = @$aref;
my @bcoord = @$bref;
return 0 if ( scalar @acoord != scalar @bcoord );
foreach my $i ( 0..$#accord ) {
return 0 if ( $acoord[$i] != $bcoord[$i] );
}
return 1;
}
sub get_neighbors {
my @coord = @_;
my @n = ( [] );
foreach my $i ( 0..$#coord ) {
@n = map { @left = @$_;
map { [ @left, $_ ] } ( $coord[$i]-1..$coord[$i]+1)
} @n;
}
@n = grep { !same_coord( \@coord, $_ ) } @n;
return @n;
}
</CODE>
<P>
-----------------------------------------------------
<BR>
<I>
<A HREF="http://mneylon.masemware.com/">Dr. Michael K. Neylon</A> - <a href="mailto:mneylon-pm@masemware.com">mneylon-pm@masemware.com</a>
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
<BR>
<FONT COLOR="#800000"><I>"I can see my house from here!"</I></FONT>
<BR>
<FONT COLOR="#808080"><I>It's not what you know, but knowing how to find it if you don't know that's important</I></FONT>
</I>
140418
140418