title: Looping arrays : While loops and 2D Arrays
body: <p>Some context: This program reads lines of Stone and puts them onto the map.</p>
  <p>The program should first ask for the number of lines of STONEs as an integer. Then, the program will scan the locations of the lines as a group of four integers in the following format:</p>
  <p>row column length value</p>
  <p>The row and column represent the left-most block of a horizontal line of blocks to the placed on the map.
  The length tells you how many stones should be in this horizontal line.
  In this example, assume the fourth integer to always be 1 representing a stone.</p>
  <p>Example: CommandMeaning</p>
  <p>0 0 5 1
  Place a line of stone starting at [0][0] and ending at [0][4]. All 5 squares in the line will be set to 1 (STONE).</p>
  <p>My issue to trying to code in the length aspect, i cant figure out the pattern:</p>
  <ul>
  <li>also, we are only allowed to use while loops, no for loops</li>
  </ul>
  <pre><code>#define SIZE 15
  #define EMPTY 0
  #define STONE 1
  
  void printMap(int map[SIZE][SIZE], int playerX);
  
  
  int main (void) {
      // This line creates our 2D array called &quot;map&quot; and sets all
      // of the blocks in the map to EMPTY.
      int map[SIZE][SIZE] = {EMPTY};
  
  
      // This line creates out playerX variable.
      int playerX = SIZE / 2;
  
      printf(&quot;How many lines of stone? &quot;);
      int linesOfStone; 
      scanf(&quot;%d&quot;, &amp;linesOfStone);
  
      printf(&quot;Enter lines of stone:\n&quot;);
   
      int rowPos; 
      int columnPos; 
      int stoneLength; 
      int stoneValue; 
     
      int i = 0; 
      while (i &lt; linesOfStone) {
          scanf(&quot;%d %d %d %d&quot;, &amp;rowPos, &amp;columnPos, &amp;stoneLength, &amp;stoneValue); 
          map[rowPos][columnPos]++; //pos for position
        
  //ERROR: This was my attempt to incorporate the length aspect, i think my logic got lost along the way... 
    
              int j = 0; 
              while (j &lt; stoneLength) {
              rowPos++; 
              j++; 
              }
      i++; 
      }
  
      printMap(map, playerX);
  
      return 0;
  }
  
  // Print out the contents of the map array. Then print out the player line
  // which will depends on the playerX variable.
  void printMap(int map[SIZE][SIZE], int playerX) {
      
      // Print values from the map array.
      int i = 0;
      while (i &lt; SIZE) {
          int j = 0;
          while (j &lt; SIZE) {
              printf(&quot;%d &quot;, map[i][j]);
              j++;
          }
          printf(&quot;\n&quot;);
          i++;
      }    
      
      // Print the player line.
      i = 0;
      while (i &lt; player
  </code></pre>