another attempt to check each state of the grid at a time