title: How can I superimpose 2D arrays in Java?
body: <p>My task is to make a path from the leftmost column to the rightmost column of a 2D array which contains blocked numbers. The path must be composed of "pieces" that touch only in one block, and don't overlap. The pieces are normal tetris pieces: 3 blocks horizontal, 3 blocks vertical, corner, and reflected corner. They can't be rotated. </p>
  
  <p>The 2d array is created via user input, and I format the array to contain a sequence of 0s and 1s, where 0 indicates "open" areas, and 1 indicates areas that the pieces can't go through, "blocked" areas. </p>
  
  <p>My question is: how can I superimpose the "piece" arrays with the original large array to create the path? I googled "2d array superposition java" and didn't come up with much, so maybe it isn't possible. If it isn't, are there any other options for this problem?</p>
  
  <p>For example: array is :</p>
  
  <p>0 0 0 0 1<br>
  1 0 0 0 1<br>
  0 1 0 1 0<br>
  1 1 0 0 0 </p>
  
  <p>We place the corner piece at (0,0). Now these cells are blocked and we have array:</p>
  
  <p><strong>1 1</strong> 0 0 1<br>
  1 <strong>1</strong> 0 0 1<br>
  0 1 0 1 0<br>
  1 1 0 0 0 </p>
  
  <p>Now the vertical piece:</p>
  
  <p>1 1 0 0 1<br>
  1 1 <strong>1</strong> 0 1<br>
  0 1 <strong>1</strong> 1 0<br>
  1 1 <strong>1</strong> 0 0 </p>
  
  <p>Now reflected corner:</p>
  
  <p>1 1 0 0 1<br>
  1 1 1 0 1<br>
  0 1 1 1 <strong>1</strong><br>
  1 1 1 <strong>1 1</strong>  </p>
  
  <p>And we output the sequence: "corner/vertical/reflected corner".</p>