Skip to content

Commit 07ed4f8

Browse files
committed
.gitignore updates
1 parent 23d56c2 commit 07ed4f8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea/
22
out/
3+
*.iml

src/Percolation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ public void open(int row, int col) {
5353

5454
// qq
5555
if (row == maxN) {
56-
ufstruct.union(rowColTo1D(row, col), qq);
56+
if (isOpen(row - 1, col) && isFull(row - 1, col)
57+
|| (isValid(row, col - 1) && isFull(row, col - 1))
58+
|| (isValid(row, col + 1) && isFull(row, col + 1))) {
59+
ufstruct.union(rowColTo1D(row, col), qq);
60+
}
61+
5762
}
5863

5964
}

src/PercolationStats.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public static void main(String[] args) {
5050

5151
PercolationStats ps = new PercolationStats(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
5252

53+
54+
5355
System.out.printf("mean = %g %n", ps.mean());
5456
System.out.printf("stddev = %g %n", ps.stddev());
5557
System.out.printf("95%% confidence interval = [%g, %g]", ps.confidenceLo(), ps.confidenceHi());

0 commit comments

Comments
 (0)