Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Game of Life on non-square topologies with 2^32 update rules (github.com/jeadie)
69 points by jeadie on Nov 7, 2022 | hide | past | favorite | 27 comments
Hi HN, when learning Golang (and topology), I ported a simple GOL in C (https://github.com/Jeadie/GoL) into Go. I then added a bunch of features - Playing on other fundamental polygons (https://en.wikipedia.org/wiki/Fundamental_polygon#Examples_o...) - Considering all possible update rules (of which, there are many).

Looking to get back to this project soon. Would love some feedback + ideas.




I don't understand the update rules as described in the readme.

In an 3x3 neighborhood there are 2^9, not 2^5 states. So we should get 2^512 possible update rules, not 2^32.

I think something similar is described in https://conwaylife.com/wiki/Rule_integer.

I'm not sure that all of those rules are valid. We must have translational invariance. One way to do that is to only update the state of the central cell in each considered neighborhood. In that case 2^9 rules are enough. Are there other ways to define consistent rules for a CA?


> One can conceive of other update rules. If one considers the five relevant cells...

I think they're looking at alternative update rules. The one you question ignores diagonals.


Conway's Game of Life does consider diagonals. Since they start and finish by talking about GoL I think they've made a mistake.


I can't believe I missed this. I always wondered why getting the types of patterns mentioned in literature were hard. Will definitely need to make an update. Thank you


I may be misreading it, but doesn't the GoL as commonly understood also depend on diagonal neighbors (i.e. 8 direct neighbors)? In that case the rule space would explode beyond the 32 bit integer one. (to a 256 bit one)


Shameless (related) plug: Check out broader cellular-automata sim with custom update rules you can define in json (and run the game on the page itself).

https://aperocky.com/cellular-automata/

This allows for more "block state" too in addition to just the black and white for GOL. Also allows some time based rules (i.e. change based off block age that it stayed unchanged).

I've gravitated to essentially a file description (and the corresponding parser) to set up the rules - this makes making and adding rules easier.


This is really neat. I had something like this in mind for Go-L. 1. Make the update rules more human readable/understandable 2. Move from binary to discrete options (and then as some have mentioned, to continuous values).


This is amazing!


Thanks! It's pretty modular so adding additional functions should be easy - just in case anybody wants to do that.


Look up the b/s format for specifying rules. It is a lot more flexible.

Here's my version : https://github.com/chewxy/ll/blob/main/main.go#L176

I also live coded this in a series of 3 videos:

1. https://youtu.be/5JArQO8YeRo 2. https://youtu.be/ZLUVAWb_31M 3. https://youtu.be/BIypQF7M9c8

My approach differs from yours in that mine is entirely matrix driven.


I don't understand how the border topologies change the game of life compared to when it's set on a regular plane

You say it can be played on a variety of manifolds, but if the topology of a manifold "locally resembles Euclidean space near each point", considering that the game of life rules are always super local, then how does that change anything compared to a plane


There are interactions which are impossible in the square but are real in a torus or cylinder.

For instance, periodic patterns may appear due to translations which do not in the square.


Earth is flat locally, too, but if you travel along a line for 40,000 km, you return to your starting point. That doesn’t happen on a plane.

For this, the difference similarly only shows up over longer distances. That means more iterations. Spaceships will return where they left off.

Also, the specific topology matters: if a spaceship makes a tour around the world, it may appear to have flipped over on a Klein bottle.


You can see the change only at the boundaries of the grid. Away from the boundary it is just like regular game of life but at the boundaries the definition of 'neighbour cell' changes based on the way the grid is glued (i.e its topology)


For the torus, what you call the boundary is no different from any of the other cells. If you were to live on such a grid, you’d be able to find out that it’s a torus and how many grid items there are, but you wouldn’t be able to see any difference between the individual grid cells.


See also SmoothLife, an amazing continuous version of Game of life. Integers are replaced by floats providing the same patterns with circular shapes. Here: https://conwaylife.com/wiki/OCA:SmoothLife


This is neat and has so many ideas that inspired me for Go-L. I like the GPU and parallelism (and OpenGL). If I took it to a floating point concept, I'd love to do PDE modelling with it too.


During a recent programming adventure, I discovered that finite elementary cellular automata with periodic boundary conditions can be simulated using matrix-vector multiplication with a circulant matrix and a strange kind of algebra, which I call a kernel algebra. [1] I wonder if this same idea could be generalized to higher dimensional automata on other topological surfaces.

[1]: https://github.com/breandan/galoisenne/blob/8f0f1e9e4e02062c...


Playing on Klein bottles? That sounds like The Flower Game? https://www.destinypedia.com/Flower_game

(from https://www.destinypedia.com/Garden)


Missed the opportunity to call it Gogol :)


You might also be interested in https://github.com/bignimbus/game-of-life-n


Golly is another way to explore 2d cellular automata and it also has a good UI. It is written in Python.


Videos!

I really don't understand the diagrams, and how they relate to the shape that each diagram is labeled as.


Can you extend it to non-uniform causal graphs with continuous state (as opposed to discrete)?


Penrose tilings


You can't post something like that without screenshots. It's against Internet law.


Or a recording, could use something like https://asciinema.org/ or https://github.com/charmbracelet/vhs




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: