small changes around line 87

I put the code that selects the next square in an if statement