package Mine; import java.util.Random; public class arrangement { public int x=0,y=0; protected int[][] inputarry ; protected int[][] outputarry ; stack xValue = new stack(); stack yValue = new stack(); stack xAxisRestack = new stack(); stack yAxisRestack = new stack(); public arrangement(int a, int b){ x = a; y = b; inputarry = new int[x][y]; outputarry = new int[x][y]; } public void MineContrary(){ int a = (x*y)/10; int b=0,c=0; Random random = new Random(); for(int i=0;i<=a;i++){ b = random.nextInt(x); c = random.nextInt(y); if(b>x || c >y){ b=0; c=0; } inputarry[b][c] = 1; xValue.push(b); yValue.push(c); xAxisRestack.push(b); yAxisRestack.push(c); } } public void operation (){ int xAxis=0; int yAxis=0; while(xValue.top != -1){ xAxis = xValue.pop(); yAxis = yValue.pop(); for(int i=(xAxis-1),j=(xAxis+1);i<=j;i++){ for(int m=(yAxis-1),n=(yAxis+1);m<=n;m++){ int b = 0; if((m<0) || (m>=y) || (i<0) || (i>=x)) continue; outputarry[i][m] += 1; } } } while( xAxisRestack.top != -1){ int a = xAxisRestack.pop(); int b = yAxisRestack.pop(); outputarry[a][b] = 9; } } public void view(){ for(int i=0,j=x;i