You are on page 1of 1

public boolean canPlay( int index, int ULCr, int ULCc )

{
// get the 2d grid from the piece
Integer[][] g= pieces[index].getGrid();
// look at each entry in the piece grid
/*Impelent the above variables by converting the mouse position to the rol
and column of the double array of integer
*/
int row= ULCr;
int col= ULCc;
if(row <0||col<0||row>board.length||col>board.length){return false;}
for(int i=0;i<g.length;i++){
for(int k=0;k<g[i].length;k++){
if(g[i][k]!=null){
if(row+i <0||col+i<0||row+i>board.length||col+i>board.length|
|board[row+i][col+k]!=null){return false;}
}
}
}
return true;}

You might also like