Game of Life on a torus [solved]

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
I am trying to implement a very basic Game of Life program on C++ on a 2D torus field.

Right now I have a 50x50 array, how do I make the blocks (my 'cells') wrap across the grids?

I understand that the modulus (%) operator must be used...

Any ideas?

TIA
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Can someone explain what a 2D torus is? I'm only familiar with the 3D donut shaped variety.
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Sorry what I meant was something if u skin donut and lay it on a flat surface.

I've solved it anyway :D
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Imagine connecting two edges of a piece of paper... it forms a tube. Then connect the two openings to each other. That's the torus.

What I tried to implement was this piece of paper that works as if it's connected as above