We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 13465cb + 3086e06 commit 83e6b38Copy full SHA for 83e6b38
1 file changed
aima-core/src/main/java/aima/core/environment/eightpuzzle/EightPuzzleBoard.java
@@ -206,18 +206,17 @@ private int getGapPosition() {
206
}
207
208
private int getPositionOf(int val) {
209
- int retVal = -1;
210
for (int i = 0; i < 9; i++) {
211
if (state[i] == val) {
212
- retVal = i;
+ return i;
213
214
215
- return retVal;
+ return -1;
216
217
218
private void setValue(int x, int y, int val) {
219
int absPos = getAbsPosition(x, y);
220
state[absPos] = val;
221
222
223
-}
+}
0 commit comments