package nathanw; import nathanw.*; public class Grid { public int grid[][]; public int def; // Default value protected int x,y; public Grid(int sx,int sy,int sinit) { x=sx; y=sy; def=sinit; grid = new int[x][y]; for(int i=0;i=0) && (sy+j>=0)) { grid[sx+i][sy+j]=value; } } public void rotate_cw() // Clockwise { int newGrid[][] = new int[y][x]; int s=y-1; for(int i=0;ix) mx=x-sx; if(my+sy>y) my=y-sy; for(int i=0;i=0) && (sy+j>=0)) grid[sx+i][sy+j]=map.op(grid[sx+i][sy+j], model.grid[i][j]); } public boolean compare(Grid model,int sx,int sy,intComp comp) { int mx,my; mx=model.x; my=model.y; for(int i=0;i=0) && (sy+j>=0)) { if(comp.comp(grid[sx+i][sy+j],model.grid[i][j])) return true; } else { if(comp.comp(def,model.grid[i][j])) return true; } } return false; } }