My Conway's Game of Life Implementation

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
ThreeNPlusOne
Posts: 6
Joined: October 22nd, 2016, 8:06 am

My Conway's Game of Life Implementation

Post by ThreeNPlusOne » March 23rd, 2017, 11:28 pm

This code was previously only on the Discord chat, so I decided to post it here as well.

It is a simulation of Conway's Game of Life made with Chili's awesome framework. It uses the concepts taught in the 2D arrays tutorial as well as references and the timers used in Snek. I will not explain GoL here as you can easily find out on Google (or read my code).

Controls:
SPACE: Pause/resume simulation.
RIGHT: Step forward one "life iteration".
LEFT: Step backward (coming soon)
DELETE: Clear the board (not particularly useful at this point)

I plan to update this post as new features are added, but for an (almost) real-time view of all my changes, follow the GitHub repository (https://github.com/threen-plus-one/conway-gol).
Attachments
conway-gol.zip
WIP version. Just the basics.
(2.29 MiB) Downloaded 137 times

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: My Conway's Game of Life Implementation

Post by albinopapa » March 24th, 2017, 4:08 am

Hey, interesting stuff that cellular atomata.

Chili and I also made a GoL, we had a contest who could write a faster sim ( chili won hands down ).
I saw chili preview yours in his Update vid, pretty cool stuff.

In the thread How do you multithread?

We start off talking about multithreading which lead to using the GoL as the platform of learning and eventually lead to chili challenging me which lead to him teaching me how to use SSE...I think it's worth the read when you have the time. It has some of our solutions in it as well.

I never did get around to making a faster version of mine, perhaps some day. Instead of using D3D shaders though, I will probably use C++ AMP.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: My Conway's Game of Life Implementation

Post by chili » March 24th, 2017, 4:01 pm

Glad to see you post your conway here threen, and welcome to the forums!

I too was contemplating doing GOL on the gpu. I think think the fastest implementations use some sort of hashing / caching / memoization technique to speed up the simulation dramatically.
Chili

ThreeNPlusOne
Posts: 6
Joined: October 22nd, 2016, 8:06 am

Re: My Conway's Game of Life Implementation

Post by ThreeNPlusOne » May 26th, 2017, 11:09 am

The game goes backwards now. I used a list of unique_ptr to "BoardState". Feel free to evaluate this decision. Code is on GitHub.

Post Reply