Skip to content

Commit b6d1e00

Browse files
committed
Merge branch 'AIMA3e' of https://github.com/aimacode/aima-java.git into AIMA3e
2 parents 11858ab + 83e6b38 commit b6d1e00

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

aima-core/src/main/java/aima/core/environment/eightpuzzle/EightPuzzleBoard.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,17 @@ private int getGapPosition() {
206206
}
207207

208208
private int getPositionOf(int val) {
209-
int retVal = -1;
210209
for (int i = 0; i < 9; i++) {
211210
if (state[i] == val) {
212-
retVal = i;
211+
return i;
213212
}
214213
}
215-
return retVal;
214+
return -1;
216215
}
217216

218217
private void setValue(int x, int y, int val) {
219218
int absPos = getAbsPosition(x, y);
220219
state[absPos] = val;
221220

222221
}
223-
}
222+
}

0 commit comments

Comments
 (0)