More efficient algorithm to reveal empty squares