All pastes #14167 Raw Edit

da pro way da go

public java v1 · immutable
#14167 ·published 2005-06-12 22:02 UTC
rendered paste body
	private boolean computeStatus(int r, int c) {		int neighbourCount = 0;		int tmp_i = 0;		int tmp_k = 0;		//int cC = 0;		//System.out.println("Row: " + r + ", Col " + c);				for(int i = -1; i <= 1; i++) {			for(int k = -1; k <= 1; k++) {				if(r+i > this.dimension-1) tmp_i = 0;				else if(r+i < 0) tmp_i = this.dimension-1;				else tmp_i = r+i;								if(c+k > this.dimension-1) tmp_k = 0;				else if(c+k < 0) tmp_k = this.dimension-1;				else tmp_k = c+k;								if(tmp_i == r && tmp_k == c) {					//System.out.println("Checking myself (" + r + "," + c +")");					continue;				} 								//System.out.println(cC++ + ": Checking (" + tmp_i + ", " + tmp_k + ")");				if(this.world[tmp_i][tmp_k].isAlive() == true) neighbourCount++;								if(neighbourCount > 3) return false;			}		}		//System.out.println("Neighbours: " + neighbourCount);				//System.out.println("Row " + r);		//System.out.println("Col " + c);		//System.out.println("hmmm" + this.world[r][c]);				if(this.world[r][c].isAlive() == true) {			if(neighbourCount == 2 || neighbourCount == 3) {				this.livingCells++;				return true;			}		}		else {			if(neighbourCount == 3) {				this.livingCells++;				return true;			}		}				return false;	}