Java Reference
In-Depth Information
"+(endTime-startTime)/1000 + "ms");
}
SwingUtilities.invokeAndWait(() -> {
model.setBoard(newBoard);
lifeTable.repaint();
});
lifeBoard = newBoard;
}
////////////////////////////////////////////////////////////////
class GameOfLifeAdvancer extends RecursiveAction{
private boolean[][] originalBoard;
private boolean[][] destinationBoard;
private int startRow;
private int endRow;
private int endCol;
private int startCol;
GameOfLifeAdvancer(boolean[][] originalBoard, int
startRow, int startCol, int endRow,
int endCol, boolean [][] destinationBoard) {
this.originalBoard = originalBoard;
this.destinationBoard = destinationBoard;
this.startRow = startRow;
this.endRow = endRow;
this.endCol = endCol;
this.startCol = startCol;
}
private void computeDirectly() {
for (int row = startRow; row <= endRow;row++)
{
for (int col = startCol; col <= endCol;
col++) {
int numberOfNeighbors
= getNumberOfNeighbors (row, col);
if (originalBoard[row][col]) {
Search WWH ::




Custom Search