Jump to content

Pentomino tiling: Difference between revisions

m
mNo edit summary
m (→‎{{headerJava}}: formatting)
Line 74:
}
 
static boolean tryPlaceOrientation(int[] o, int r, int c, int shapeIdxshapeIndex) {
 
for (int i = 0; i < o.length; i += 2) {
if (r + o[i] < 0
 
if (r + o[i] < 0 || r + o[i] >= nRows || c + o[i + 1] < 0
|| c + o[i + 1] < 0
|| c + o[i + 1] >= nCols
|| grid[r + o[i]][c + o[i + 1]] != -1)
Line 84 ⟶ 85:
}
 
grid[r][c] = shapeIdxshapeIndex;
for (int i = 0; i < o.length; i += 2)
grid[r + o[i]][c + o[i + 1]] = shapeIdxshapeIndex;
 
return true;
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.