I have this bit of code and eclipse is telling me that the boolean expressions can be simplified.
knightTurn == true && occupied ==true
and
knightTurn == true
both boolean knightTurn and boolean occupied are set to false earlier in the code.
boolean knightTurn=false
boolean occupied=false
@Tags({"passed"})
public void passed ()
{
final int x = 50;
if (knightTurn == true && occupied == true) {
for (int i=0; i<x; i++) {
standKnight.moveAvatar(i, 0);
avatarEditor.refresh();
i++;
}
occupied = false;
}
}
@Tags({"failed"})
public void failed () {
final int x = 35;
if (knightTurn == true) {
for (int i=0; i<x; i++) {
standKnight.moveAvatar(i, i/2);
avatarEditor.refresh();
i++;
}
occupied = false;
}
The code still runs as it should, but how do I tidy up this bit and make it simpler?