Exercise Set 2, question 6 protected void move() { Location current = location(); super.move(); if (current.equals(location())) // Have we moved? { Random randNumGen = RandNumGenerator.getInstance(); // If this is the 0.1 chance of turning, turn left or right if (randNumGen.nextDouble() < probOfTurning) { turnRightOrLeft(direction()); Debug.println(" Turned and now facing " + direction()); return location(); } } } /** Turns this fish right or left **/ protected void turnRightOrLeft(Direction dir) { Random randNumGen = RandNumGenerator.getInstance(); if (randNumGen.nextDouble() < probOfRight) { changeDirection(dir.toRight()); } else { changeDirection(dir.toLeft()); } }