Percolation/Mean cluster density: Difference between revisions
m
Rearranged some code.
(New post.) |
m (Rearranged some code.) |
||
Line 912:
System.out.println();
}
}▼
clusterCount = 0;▼
for ( int row = 0; row < grid.length; row++ ) {▼
for ( int col = 0; col < grid.length; col++ ) {▼
if ( grid[row][col] == CLUSTERED ) {▼
clusterCount += 1;▼
identifyCluster(row, col, clusterCount);▼
}▼
}▼
}
return clusterCount;▼
}
Line 928 ⟶ 941:
identifyCluster(aRow - 1, aCol, aCount);
}
}
▲ private int countClusters() {
▲ clusterCount = 0;
▲ for ( int row = 0; row < grid.length; row++ ) {
▲ for ( int col = 0; col < grid.length; col++ ) {
▲ if ( grid[row][col] == CLUSTERED ) {
▲ clusterCount += 1;
▲ identifyCluster(row, col, clusterCount);
▲ }
▲ }
▲ }
▲ return clusterCount;
▲ }
private void createGrid(int aGridSize, double aProbability) {
|