Doesn't work with non square board since x's and y's are mixed in the code.
Doesn't work with non square board since x's and y's are mixed in the code.