• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Game of Life on a torus [solved]

screw3d

Diamond Member
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
 
Sorry what I meant was something if u skin donut and lay it on a flat surface.

I've solved it anyway 😀
 
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
 
Back
Top