Skip to content

Commit 7ecee83

Browse files
committed
small changes.
1 parent d966aec commit 7ecee83

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

aima-core/src/main/java/aima/core/environment/vacuum/MazeVacuumEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public MazeVacuumEnvironment(int xDim, int yDim) {
3232
this(xDim, yDim, 0.5, 0);
3333
}
3434

35-
// Obstacles are marked by with locationState==null
35+
// Obstacles are marked with locationState==null
3636
public MazeVacuumEnvironment(int xDim, int yDim, double dirtProbability, double obstacleProbability) {
3737
super(createLocations(xDim * yDim));
3838
xDimension = xDim;

aima-gui/src/main/java/aima/gui/fx/views/SudokuViewCtrl.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import javafx.geometry.Pos;
55
import javafx.geometry.VPos;
66
import javafx.scene.control.ComboBox;
7-
import javafx.scene.layout.ColumnConstraints;
8-
import javafx.scene.layout.GridPane;
9-
import javafx.scene.layout.RowConstraints;
10-
import javafx.scene.layout.StackPane;
7+
import javafx.scene.layout.*;
118

129
import java.util.ArrayList;
1310
import java.util.List;
@@ -65,10 +62,13 @@ public SudokuViewCtrl(StackPane viewRoot) {
6562
}
6663

6764
public void clear(boolean allDigits) {
68-
for (int i = 0; i < 81; i++) {
69-
ComboBox<String> combo = combos.get(i);
70-
if (allDigits || !isFixed(i % 9 + 1, i / 9 + 1))
71-
combo.getSelectionModel().select(0);
65+
for (int row = 1; row <= 9; row++) {
66+
for (int col = 1; col <= 9; col++) {
67+
if (allDigits || !isFixed(col, row)) {
68+
clearDigit(col, row);
69+
setGrey(col, row, false);
70+
}
71+
}
7272
}
7373
}
7474

@@ -100,6 +100,10 @@ public boolean isFixed(int col, int row) {
100100
return selIdx >= 10;
101101
}
102102

103+
public void setGrey(int col, int row, boolean b) {
104+
getCombo(col, row).setOpacity(b ? 0.5 : 1);
105+
}
106+
103107
private ComboBox<String> getCombo(int col, int row) {
104108
assert col >= 1 && col <= 9;
105109
assert row >= 1 && row <= 9;

0 commit comments

Comments
 (0)