Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'm just starting to play around with Curses and I want to draw a (n,n) box of X's to the screen. Then I want to move that box and draw it again. I'm trying to figure out how modify the coordinate variables stored in the matrix.

Currently, I'm storing my coordinates in a matrix. I create my matrix like this...

my ($x, $y) = qw(5 10); my @A = ( [ ([$x, $y ]), ([$x+1, $y ]), ([$x+2, $y ]), ([$x+3, $y ]) ], [ ([$x, $y+1]), ([$x+1, $y+1]), ([$x+2, $y+1]), ([$x+3, $y+1]) ], [ ([$x, $y+2]), ([$x+1, $y+2]), ([$x+2, $y+2]), ([$x+3, $y+2]) ], [ ([$x, $y+3]), ([$x+1, $y+3]), ([$x+2, $y+3]), ([$x+3, $y+3]) ], );


After drawing my matrix, I try to move and redraw the matrix, but when I change $x and $y, it doesn't change the elements in the already created matrix. I've looked at a couple of the Matrix modules, but they all seem to want my matrix elements to be a single value, not an array.

Is there a way to get ($x,$y) to update without cycling through the entire matrix again?

In reply to Storing variable coordinates in a matrix by shandor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-18 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found