All pastes #10065 Raw Edit

Something

public cpp v1 · immutable
#10065 ·published 2005-04-22 07:50 UTC
rendered paste body
     */    public boolean isCompleted() {	    if (fmc == mc && fc == mc){		    return true;	    }	    return false;    }    /**     * Returns the number of cells that contain mines and that are adjacent to     * the cell at (x, y).     */    public int getSurroundingMineCount(int x, int y) {	    	int i = 0;		i = y * w;		i = i + x;		int[] adj;		int acount=0;		adj = new int[8];		if(x!=w-1) adj[0] = i + 1;		if(x!=0) adj[1] = i - 1;		adj[2] = i + w;		adj[3] = i - w;		if(x!=0) adj[4] = adj[3] - 1;		if(x!=0) adj[5] = adj[2] - 1;		if(x!=w-1) adj[6] = adj[3]+ 1;		if(x!=w-1) adj[7] = adj[2] + 1;		for(int z=0; z<8; z++){				if (adj[z] <= ccount-1 && adj[z] >= 0){					if (Cells[adj[z]].containsMine()) acount++;				}		}		if (acount==0){			int[] ce;			ce = new int[ccount];			int c = 0;			for(int z=0; z<8; z++){				if (adj[z] <= ccount-1 && adj[z] >= 0){					ce[c] = adj[z];					c++;				}			}		}		for(int p=c; p>=0; p--){					return acount;    }}