src/main/java/biz/pavonis/golservice/internal/Universe.java
public boolean[][] recalculateUniverseState() {
		stampPatterns();
		int newFlipFlopIndex = (flipFlopIndex == FLIP_INDEX ? FLOP_INDEX : FLIP_INDEX);
		boolean[][] newBuffer = universeDoubleBuffer[newFlipFlopIndex];
		boolean[][] oldBuffer = universeDoubleBuffer[flipFlopIndex];
		for (int y = BORDER_OFFSET; y <= height; y++) {
			int environment = (oldBuffer[y - 1][0] ? 32 : 0) + (oldBuffer[y - 1][1] ? 4 : 0) + (oldBuffer[y][0] ? 16 : 0)
							+ (oldBuffer[y][1] ? 2 : 0) + (oldBuffer[y + 1][0] ? 8 : 0) + (oldBuffer[y + 1][1] ? 1 : 0);
			for (int x = BORDER_OFFSET; x <= width; x++) {
				environment = ((environment % 64) * 8) + (oldBuffer[y - 1][x + 1] ? 4 : 0) + (oldBuffer[y][x + 1] ? 2 : 0)
								+ (oldBuffer[y + 1][x + 1] ? 1 : 0);
				newBuffer[y][x] = lookupTable[environment];
			}
		}
		universeDoubleBuffer[newFlipFlopIndex] = newBuffer;
		flipFlopIndex = newFlipFlopIndex;
		return universeDoubleBuffer[flipFlopIndex];
	}
/**
	 * Recalculates the universe state and returns the new one.
	 * 
	 * @return
	 */
Recalculates the universe state and returns the new one.

@return
Recalculates the universe state and returns the new one . @return
public boolean[][] recalculateUniverseState() {
		stampPatterns();
		int newFlipFlopIndex = (flipFlopIndex == FLIP_INDEX ? FLOP_INDEX : FLIP_INDEX);
		boolean[][] newBuffer = universeDoubleBuffer[newFlipFlopIndex];
		boolean[][] oldBuffer = universeDoubleBuffer[flipFlopIndex];
		for (int y = BORDER_OFFSET; y <= height; y++) {
			int environment = (oldBuffer[y - 1][0] ? 32 : 0) + (oldBuffer[y - 1][1] ? 4 : 0) + (oldBuffer[y][0] ? 16 : 0)
							+ (oldBuffer[y][1] ? 2 : 0) + (oldBuffer[y + 1][0] ? 8 : 0) + (oldBuffer[y + 1][1] ? 1 : 0);
			for (int x = BORDER_OFFSET; x <= width; x++) {
				environment = ((environment % 64) * 8) + (oldBuffer[y - 1][x + 1] ? 4 : 0) + (oldBuffer[y][x + 1] ? 2 : 0)
								+ (oldBuffer[y + 1][x + 1] ? 1 : 0);
				newBuffer[y][x] = lookupTable[environment];
			}
		}
		universeDoubleBuffer[newFlipFlopIndex] = newBuffer;
		flipFlopIndex = newFlipFlopIndex;
		return universeDoubleBuffer[flipFlopIndex];
	}
public boolean [ ] [ ] recalculateUniverseState ( ) { stampPatterns ( ) ; int newFlipFlopIndex = ( flipFlopIndex == FLIP_INDEX ? FLOP_INDEX : FLIP_INDEX ) ; boolean [ ] [ ] newBuffer = universeDoubleBuffer [ newFlipFlopIndex ] ; boolean [ ] [ ] oldBuffer = universeDoubleBuffer [ flipFlopIndex ] ; for ( int y = BORDER_OFFSET ; y <= height ; y ++ ) { int environment = ( oldBuffer [ y - 1 ] [ 0 ] ? 32 : 0 ) + ( oldBuffer [ y - 1 ] [ 1 ] ? 4 : 0 ) + ( oldBuffer [ y ] [ 0 ] ? 16 : 0 ) + ( oldBuffer [ y ] [ 1 ] ? 2 : 0 ) + ( oldBuffer [ y + 1 ] [ 0 ] ? 8 : 0 ) + ( oldBuffer [ y + 1 ] [ 1 ] ? 1 : 0 ) ; for ( int x = BORDER_OFFSET ; x <= width ; x ++ ) { environment = ( ( environment % 64 ) * 8 ) + ( oldBuffer [ y - 1 ] [ x + 1 ] ? 4 : 0 ) + ( oldBuffer [ y ] [ x + 1 ] ? 2 : 0 ) + ( oldBuffer [ y + 1 ] [ x + 1 ] ? 1 : 0 ) ; newBuffer [ y ] [ x ] = lookupTable [ environment ] ; } } universeDoubleBuffer [ newFlipFlopIndex ] = newBuffer ; flipFlopIndex = newFlipFlopIndex ; return universeDoubleBuffer [ flipFlopIndex ] ; }
Recalculates the universe state and returns the new one.
Recalculates the universe state and returns the new one .