I'm developing a Conway's implementation in Rust to further use it with WebAssembly, and I'm thinking about how I'm supposed to treat the map boundaries. At the moment, I'm considering a cell at the limits as a cell that has less neighbors, although I've seen some implementations that treat the map as infinite.
Treating the map with limited bounds generates some weird behaviour, like a Glider becoming a Block:
------generation(0)------
0.0..
.00..
.0...
------generation(1)------
..0..
0.0..
.00..
------generation(2)------
.0...
..00.
.00..
------generation(3)------
..0..
...0.
.000.
------generation(4)------
.....
.0.0.
..00.
------generation(5)------
.....
...0.
..00.
------generation(6)------
.....
..00.
..00.
------generation(7)------
.....
..00.
..00.
Is the "right" way to treat the map as infinite as I saw here or is the "right" way to limit the map? If there isn't any "right" way, which of those two you think that is the best?
If you'd like to see my code, it's here. I didn't post any code sample because the question isn't about the code itself.
The rules for the Game of Life state (emphasis mine):
The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square "cells", each of which is in one of two possible states, alive or dead, (or "populated" and "unpopulated" respectively).
If you don't make your grid infinite, you haven't implemented the Game of Life, but rather you've implemented some variant.