Perl: the Markov chain saw | |
PerlMonks |
Re: Storing variable coordinates in a matrixby Moron (Curate) |
on Mar 15, 2007 at 17:18 UTC ( [id://605028]=note: print w/replies, xml ) | Need Help?? |
Hint: you need two nested loops -- nested because of two dimensions x and y -- one loop to clear the 'screen' matrix and one loop to repopulate it and ..."One loop to bring them all and in the darkness run them" ;) (just kidding at the end there)... Also I'd be expecting to pass five variables to a more generic subroutine -- reference to screen matrix, x, y, width and height rather than hard-code the 3x3. Totals: 0 modules and about 6 - 12 lines of code should do this. More hint: the syntax for assigning to an element of a matrix passed by reference would be
-M Free your mind
In Section
Seekers of Perl Wisdom
|
|