title: Drawing at specific coordinates in a loop
body: <p>I am trying to write a program which simply reads through a multidimensional array (using 'for' loops) and if it encounters a certain letter (like 'A'), it would draw a rectangular shape (im using canvas library and functions to draw the shapes).</p>
  
  <p>I'm trying to actually draw a maze-like map using canvas. But for some odd reason, it is not coming out right. I'm assuming it's a problem with reading the array, which I don't know why.</p>
  
  <p>the multidimensional array read input from a text file which looks like this (a sample):
  This is the layout of the maze map I am attempting to create using canvas.</p>
  
  <pre><code>AAAAAAAAAAAAAAAAAAAAA
  A.........A.........A
  A.........A.........A
  A...............AAAAA
  AAAAA...............A
  AAAAAAAAAAAAAAAAAAAAA
  </code></pre>
  
  <p>of course the 'A' will be replaced with a filled rectangle to represent the wall</p>
  
  <p>the '.' represents the path.</p>
  
  <p>here is my code:</p>
  
  <pre><code>void MazeGame::DrawMap(Canvas &amp;canvas, char (&amp;map)[20][26]) 
  { 
      double drawx = 200; 
      double drawy = 200;
  
      for(int i = 0; i &lt; 20; i++)
      {
          for(int j = 0; j &lt; 26; j++)
          {
              if(map[i][j] == 'A') 
              {
                  canvas.DrawFillRect(drawx+10, drawy, 10, 10);
              } 
  
              if(map[i][j] == '.')
              {
                  map[i][j] = ' ';  
              }
          }
      }
  }
  </code></pre>
  
  <p>i wrote this function in a class.</p>
  
  <p>I initialized two 'double' variables, drawx and drawy, as 200. That is considered to be the x and y origin coordinate where the shape will be drawn.
  Of course as the array of chars is being read, the x &amp; y coordinate has to move accordingly to how the maze layout is displayed in the text file or else, when the shape is drawn, it would simply draw over or overwrite the previously drawn shapes. I don't want that</p>
  
  <p>I feel that this is so simple but the output is really confusing me.
  Any suggestions?</p>