MiSTer-devel / Life_MiSTer

Conway's Game of Life for MiSTer
MIT License
7 stars 2 forks source link

Edge Cases for Row and Field Boundaries #6

Open ktcfleck opened 1 year ago

ktcfleck commented 1 year ago

Implementing GoL as three plain shift registers with no previous/next-state memory causes discontinuities at row and field boundaries.

For row boundaries, the new cells coming in for the shift registers are off by one row. In order to handle this discontinuity, there would need to be some means of indexing data from the upcoming row, and swapping that data in when on a row boundary.

For field boundaries, the cell regions use a mix of current-generation data and next-generation data. Typically, a GoL implementation stores two generations of data and swaps between the display/working memory at the end of each field.

GoL

In this example image, green indicates the current cell being processed, black indicates current-generation neighboring cells, and red indicates next-generation neighboring cells.