Optimizes the bot to take fewer moves

Doesn't traverse a row if there are no more dirty cells