Problem with Game of Life

for instance where I know I have a problem is if I make the screen into a rectangle it breaks down. It’ll only accept a square. This indicates to me that somewhere I’m inverting the cols and rows … but I can’t figure out where as small tweaks and suddenly everything breaks down