void doWander(Dir dir) { moveDelegate.requestMove(this, dir); if (moveDelegate.isBlocked(dir)) { if (wanderJumpAttempts > MAX_WANDER_JUMP_ATTEMPTS) { wanderJumpAttempts = 0; chooseNewWanderActionNot(newAction); return; } bool jumped = tryToJumpOverObstacle(); if (jumped) { wanderJumpAttempts += 1; } return; } wanderJumpAttempts = 0; }