inefficient working implementation, but brute force detects rocks