Hexagonal Life

For general discussion about Conway's Game of Life.
eriksw
Posts: 3
Joined: September 30th, 2009, 8:51 am

Hexagonal Life

Post by eriksw » September 30th, 2009, 9:09 am

I used to "play" a lot with Life in the early eighties (using a home made machine code program on a ZX Spectrum). One time I was in a rose garden with a hexagonal ("honeycomb") layout and I got the idea to create Life on a HEXAGONAL GRID. This way, each cell has 6 neighbours, and they are all equal. (I always thought it was a "glitch" in Life that diagonal neighbours were equal to orthogonal neighbours...) I wrote a program to do this (in Basic on an early PC) and I experimented with different sets of rules to see what would happen. Although it was a joy to see all kinds of "snowflakes" forming out of very small "seeds", I never found any rules that would give a similar "balance" as Conway's Life - things either expanded indefinitely or died out soon. Then I started a hologram shop and got distracted from this effort.

Has anybody else ever played with this ? Any results anywhere ? Anybody feel like having a go ?

Erik Swetter
Amsterdam

User avatar
Macbi
Posts: 903
Joined: March 29th, 2009, 4:58 am

Re: Hexagonal Life

Post by Macbi » September 30th, 2009, 1:28 pm

This page has a nice applet. B3,4/S2 and B3,5/S2 seem like nice rules, though they're a bit oscillatorish.

H. V. McIntosh
Posts: 49
Joined: June 20th, 2009, 5:26 pm
Location: Mexico

Re: Hexagonal Life

Post by H. V. McIntosh » September 30th, 2009, 3:37 pm

To the extent that a hexagonal grid seems to be more symmetrical than a square lattice, there has been much interest in such automata. Preston and Duff have a book, vintage 1984 (Modern Cellular Automata, Plenum) which focusses on that lattice. They devoted some effort to finding things like gliders and rules which have them, but as I recall they never arrived at the level of complexity inherent in Conway's version. More recently, Andrew Adamatzky has a group in England rather interested in hexagonal automata with charateristics resembling WireWorld. Their work most likely can be found by scanning the Internet, although they also have some books. Overall, trying to understand ordinary Life well seems to be complicated enough, without digressing towards other schemes.
-hvm

User avatar
iconmaster
Posts: 42
Joined: July 2nd, 2009, 7:22 pm

Re: Hexagonal Life

Post by iconmaster » October 2nd, 2009, 5:34 pm

The secret to finding life-like rules is to make certain combinations of cells "worth" more than others.


I'll find an example soon.

User avatar
calcyman
Moderator
Posts: 2938
Joined: June 1st, 2009, 4:32 pm

Re: Hexagonal Life

Post by calcyman » October 3rd, 2009, 5:06 am

The best 2-state hexagonal rule that I have come across is Callahan's non-totalistic rule:

http://www.radicaleye.com/lifepage/hexrule.txt
What do you do with ill crystallographers? Take them to the mono-clinic!

eriksw
Posts: 3
Joined: September 30th, 2009, 8:51 am

Re: Hexagonal Life

Post by eriksw » October 3rd, 2009, 6:26 am

Thanks for the replies.

The applet at http://www.cse.sc.edu/~bays/h6h6h6/ is very nice. Now who can change it to work with the rules described in http://www.radicaleye.com/lifepage/hexrule.txt ?

It looks to me as if this "hexalife" has not been studied a lot, I hardly found anything on the internet about this...

User avatar
PM 2Ring
Posts: 152
Joined: March 26th, 2009, 11:18 am

Re: Hexagonal Life

Post by PM 2Ring » October 3rd, 2009, 11:20 am

Another way to get a hexagonal variant of Life is to transform the usual square grid into a hexagonal one. This can be done in a variety of ways. For example, we can combine square cells into pairs, in a brickwork pattern. The brick grid has the same topology as a hexagonal grid, with each brick being surrounded by 6 neighbours.

Code: Select all

  0011
223344
  5566
It's a simple matter to stretch the brick grid into a proper hexagonal grid.

We can apply any of the usual square grid rules to this brick/hex grid. The number of different hex grid cell states is the square of the number of square grid states, since we are combining pairs of square cells. So for standard Conway's Life played on this grid there will be 4 cell states.

A few months ago, I created raytraced images of some simple Life patterns in this format, using POV-Ray. Here's the pattern from my avatar, in hexagons. The white tiles correspond to vertical bricks that have 2 live cells, the blue tiles have a live lower half but a dead upper half, the red tiles are the complement of this.

A 1024 x 768 detailed shot
http://i2.photobucket.com/albums/y43/PM ... ileJ1S.jpg

A 640 x 480 animation
http://i2.photobucket.com/albums/y43/PM ... eTileI.gif

User avatar
Andrew
Moderator
Posts: 935
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Hexagonal Life

Post by Andrew » October 3rd, 2009, 9:33 pm

eriksw wrote:The applet at http://www.cse.sc.edu/~bays/h6h6h6/ is very nice. Now who can change it to work with the rules described in http://www.radicaleye.com/lifepage/hexrule.txt ?
Golly has an undocumented (and largely untested) ability to support rules in a hexagonal neighborhood. Just append "H" to any B.../S... rule, as in the following example that implements the 2nd glider from the above applet:

Code: Select all

x = 7, y = 6, rule = B245/S3H
obo$4bo$2bo$bo2bobo$3bo$5bo!
Such rules work in both the QuickLife and HashLife algorithms. No support for Callahan's non-totalistic rule though. Maybe a future version of Golly will handle hexagonal grids and rules properly. If anybody wants to write a new HexLife algo for Golly I'd be happy to help collaborate on the necessary GUI changes. (Actually, another possibility is to write a HexLife.py script, along the lines of the 3DLife.py script available from the scripts database -- see Help > Online Archives in Golly 2.1.)

Edit: Callahan's non-totalistic rule could probably be emulated via a suitable .table file. With a clever choice of icons it might even be possible to have something that looks nice at scales 1:8 and 1:16.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
calcyman
Moderator
Posts: 2938
Joined: June 1st, 2009, 4:32 pm

Re: Hexagonal Life

Post by calcyman » October 4th, 2009, 7:23 am

The following rule table represents Callahan's hexagonal CA:

Code: Select all

n_states:2
neighborhood:Moore
symmetries:none

var a={0,1}
var b={0,1}
var c={0,1}
var d={0,1}
var e={0,1}
var f={0,1}
var g={0,1}
var h={0,1}

# C,N,a,E,SE,S,b,W,NW,C'


# Birth 2o

0,1,a,1,0,0,b,0,0,1
0,0,a,1,1,0,b,0,0,1
0,0,a,0,1,1,b,0,0,1
0,0,a,0,0,1,b,1,0,1
0,0,a,0,0,0,b,1,1,1
0,1,a,0,0,0,b,0,1,1

# Death 0

1,0,a,0,0,0,b,0,0,0

# Death 1

1,1,a,0,0,0,b,0,0,0
1,0,a,1,0,0,b,0,0,0
1,0,a,0,1,0,b,0,0,0
1,0,a,0,0,1,b,0,0,0
1,0,a,0,0,0,b,1,0,0
1,0,a,0,0,0,b,0,1,0

# Death 2o

1,1,a,1,0,0,b,0,0,0
1,0,a,1,1,0,b,0,0,0
1,0,a,0,1,1,b,0,0,0
1,0,a,0,0,1,b,1,0,0
1,0,a,0,0,0,b,1,1,0
1,1,a,0,0,0,b,0,1,0

# Death 2p

1,1,a,0,0,1,b,0,0,0
1,0,a,1,0,0,b,1,0,0
1,0,a,0,1,0,b,0,1,0

# Death 5

1,0,a,1,1,1,b,1,1,0
1,1,a,0,1,1,b,1,1,0
1,1,a,1,0,1,b,1,1,0
1,1,a,1,1,0,b,1,1,0
1,1,a,1,1,1,b,0,1,0
1,1,a,1,1,1,b,1,0,0

# Death 6

1,1,a,1,1,1,b,1,1,0
What do you do with ill crystallographers? Take them to the mono-clinic!

User avatar
Andrew
Moderator
Posts: 935
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Hexagonal Life

Post by Andrew » October 4th, 2009, 8:18 am

That table works beautifully -- thanks calcyman! Definitely worthy of inclusion in the Rule Table Repository, although I'm not sure what the rule name should be. I just called it HexLife.table in my tests but maybe it would be best to contact Paul Callahan and let him decide on the name.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

genarojm
Posts: 13
Joined: August 27th, 2009, 11:37 am
Location: Mexico
Contact:

Re: Hexagonal Life

Post by genarojm » October 5th, 2009, 9:10 pm

Also you can see an interesting number of hexagonal Life like rules (2 states) designed by George Maydwell on his Modern CA web site:

http://www.collidoscope.com/modernca/he ... rules.html

eriksw
Posts: 3
Joined: September 30th, 2009, 8:51 am

Re: Hexagonal Life

Post by eriksw » October 8th, 2009, 6:06 am

Thanks for this link. Interesting stuff !

User avatar
Andrew
Moderator
Posts: 935
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Hexagonal Life

Post by Andrew » October 23rd, 2009, 7:48 am

I've added a number of hexagonal neighborhood rules to the repository:
http://code.google.com/p/ruletablerepos ... ghbourhood

If you're using Golly 2.1 you can install the rules directly into Golly by selecting Help > Online Archives > Rule Table Repository and clicking on the zip file links.

All the zip files contain rules in the form of .tree files. Each tree file was created by passing a suitable Python transition function, via the clipboard, into this script (run from Golly):
http://ruletablerepository.googlecode.c ... uletree.py

The script is also available from Help > Online Archives > Golly Scripts Database. See the comments at the top of the script. It really makes it very easy to create new rules, and you only have to learn a minimal amount of Python. For example, here's the transition function for Life:

Code: Select all

name = "LifeTest"
n_states = 2
n_neighbors = 8
# order for 8 neighbors is NW, NE, SW, SE, N, W, E, S, C
def transition_function(a):
    n = a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]
    if n==2 and a[8]==1:
        return 1 
    if n==3:
        return 1
    return 0
Just copy the above lines, run make-ruletree.py from Golly, and it will create LifeTest.tree in your rules folder and switch to the rule, ready to test.

The transition functions for the hexagonal rules are stored in *.txt files in the zips. Using a .txt extension lets you click on their links in the help window and Golly will open the file in your preferred text editor.

Have fun!
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

EricG
Posts: 199
Joined: August 19th, 2011, 5:41 pm
Location: Chicago-area, USA

Re: Hexagonal Life

Post by EricG » October 13th, 2011, 3:40 am

I'm having fun with both Golly's built-in B.../S...H totalistic rules and Paul Callahan's non-totalistic HexLife rule (thank you for posting the rule table!)

Is there a way to correctly rotate and flip patterns created for a hexagonal neighborhood in Golly? If not, any advice?

User avatar
Tropylium
Posts: 421
Joined: May 31st, 2011, 7:12 pm
Location: Finland

Re: Hexagonal Life

Post by Tropylium » October 13th, 2011, 10:45 am

Thanks for the bump, I would have otherwise remain'd unaware of Golly supporting hexagonal CA! :)

Browsing some rules it does seem that there are very few totalistic rules that support anything Life-like, everything in the B2,A01 area either explodes or quickly settles down. However, among B0 rules there seem to be a few with natural spaceships. B0156/S2H has at least three; two c/4 orthogonal, and one 2c/18 diagonal:

Code: Select all

x = 27, y = 13, rule = B0156/S2H
19b2o$21bo$21bo$4b2o7b2o3bo$2bo8bo12bo$o9bo12bobo$2obo8bo10bo2bo$26bo$
23bo$13b2o$18bobo$11bo5bo2bo$11bo!
B0156/S04 and B0156/S13 have spaceships as well.

BTW, for some reason, the axes seem to get flipped in B0 rules. Here, a single cell's neighborhood becomes a NE/SW ship shape, not the NW/SE one it is in A0 rules. Initially fooled me into thinking that there would be four different ships here, one of them a knightship.

(Also shouldn't this be in the "Other CA" forum?)

137ben
Posts: 343
Joined: June 18th, 2010, 8:18 pm

Re: Hexagonal Life

Post by 137ben » October 13th, 2011, 7:40 pm

Spaceships ARE possible in semi-totalistic hexagonal rules:

Code: Select all

x = 5, y = 5, rule = B2/S2H
o2b2o$3b2o$2bo2$4bo!

Code: Select all

x = 4, y = 4, rule = B245/S35H
b3o$bobo$4o$bo!

EricG
Posts: 199
Joined: August 19th, 2011, 5:41 pm
Location: Chicago-area, USA

Re: Hexagonal Life

Post by EricG » October 14th, 2011, 12:13 pm

Hi Tropylium, you beat me to the punch! I thought B0 rules in a hexagonal neighborhood might be fun to look into too. I have a number of finds to report, but I'm also caring for my 20 month old daughter, so it takes me awhile to put everything together in an organized way. I'll have to do it in little bursts when my daughter is both happy and distracted. :-)

I like B01245/S036H -- Try a random field (54% density) with this rule, and you'll find life-like behavior, including a very common glider analog.

You're also quite likely to find the following much larger spaceship, which is the most remarkable natural spaceship I've found so far. If it ever needs a name, I'd like to name it "the Sylph" after my daughter Sylvia.

Code: Select all

x = 86, y = 49, rule = B01245/S036H
77bo$75b2o$74b4o$80b2o$73bo4b3o3b2o$75bo2b4o2bo$80bob4o$57bo16bobo3b3o
$52bo5bo19bob2o2bo$52bobo24bo$51b3obo22bobo3bo$50b3ob3o17bo2bo5b2o$49b
3ob4o16b7ob4o$48b3o3bo2bo15bo4bo4bo$49b2ob4o16b4o5b3o$36b2o10b2o3b2obo
15b5o2b4o$34b5o8bo6bo18b3obo2bo$33b2o2b2o13bo4bo$6b3o5b3o16bo3bo16bobo
$5bo2bo4bo2bo15b2o2b2o14bo2b2o$4bo3bobobo3bo15b5o18bo$4bo2bo4bo2bo17b
2o$4b3o5b3o$48bobobo$2b2ob2o3b2ob2o$47bobobo$2b3o5b3o$bo2bo4bo2bo17b2o
$o3bobobo3bo15b5o18bo$o2bo4bo2bo15b2o2b2o14bo2b2o$3o5b3o16bo3bo16bobo$
26b2o2b2o13bo4bo$26b5o8bo6bo18b3obo2bo$27b2o10b2o3b2obo15b5o2b4o$39b2o
b4o16b4o5b3o$37b3o3bo2bo15bo4bo4bo$37b3ob4o16b7ob4o$37b3ob3o17bo2bo5b
2o$37b3obo22bobo3bo$37bobo24bo$36bo5bo19bob2o2bo$40bo16bobo3b3o$62bob
4o$56bo2b4o2bo$53bo4b3o3b2o$59b2o$52b4o$52b2o$53bo!
And since we (apparently) do not have a nice way to rotate and flip large patterns, here is the spacecraft in a different orientation:

Code: Select all

x = 99, y = 99, rule = B01245/S036H
92b2o$90b5o$89b2o2b2o$89bo3bo$88b2o2b2o2b2o$88b5ob5o$89b2o2b2o2b2o$93b
o3bo$92b2o2b2o$92b5o$93b2o14$68b2o$66b5o$65b2o2b2o$65bo3bo$64b2o2b2o2b
2o$64b5ob5o$65b2o2b2o2b2o$69bo3bo$68b2o2b2o$68b5o$69b2o2$54b3o$53bo2bo
$52bo3bo$52bo2bo$46bo5b3o$38b2o4bo2bo$36b5obo2bo14b3o$35b2o2bo2bob3o
12bo2bo$35bo3b2ob4o12bo3bo$34b2o2bo2bob2o13bo2bo$34b5o3bo15b3o$35bo4bo
$35bo5bo$34b8o$33b2o4b3o$32bo2b2obo18bo$33bo3b2o16bo2bo$32b2o20b3o$32b
2obo17b3obo$31bo21b2o$52bob3o$48b3o2bo$48b2obo2bobo$48b2o4b4o$46b2obo
2b2o2b2o$46bo2bo2bo3bo$47bobo2bo2b2o$44bo2bob7o$48b2o2b2o$44b3obo$44b
2obo$14bo28bo$9bo2bob2o$8b3o2b3o$8bobo2b3o$7b2obo3bo$10bob2o$9b3obo$7b
o2b2o4bo$7bo4b2o3bo$10bob2obo$9bo3bo2bo$14bo$7bo5bo$5bo4bo$6bo16bo$2b
2o3bo13bo2bo$3bo18bo5b3o$o19bo6b5o$bo17bob3ob2ob2o$22b2o2bo3bo$24b2o$
18bo3bob6o$21bo3bo3b2o$27b3o$16bo2bo3b2o2bo$17bo$18bo2$15b2o$16bo$13bo
$14bo!
Two Sylphs can be placed near each other but offset, to make a clean rake!

Code: Select all

x = 216, y = 126, rule = B01245/S036H
179b2o$177b5o$176b2o2b2o$176bo3bo$175b2o2b2o2b2o24b2o$175b5ob5o21b5o$
172bo3b2o2b2o2b2o20b2o2b2o$170b3o7bo3bo21bo3bo$170b3obo4b2o2b2o20b2o2b
2o2b2o$172bo6b5o21b5ob5o$169bobo8b2o20bo3b2o2b2o2b2o$166b2o3b2o4bo22b
3o7bo3bo$166b2ob2o29b3obo4b2o2b2o$165b4obo3bob4o22bo6b5o$174b2ob2o20bo
bo8b2o$167bo4b2o3b2o17b2o3b2o4bo$163b2o8bobo20b2ob2o$161b5o6bo22b4obo
3bob4o$160b2o2b2o4bob3o29b2ob2o$160bo3bo7b3o22bo4b2o3b2o$159b2o2b2o2b
2o3bo20b2o8bobo$159b5ob5o21b5o6bo$160b2o2b2o2b2o20b2o2b2o4bob3o$164bo
3bo21bo3bo7b3o$155b2o6b2o2b2o20b2o2b2o2b2o3bo$153b5o5b5o21b5ob5o$152b
2o2b2o6b2o24b2o2b2o2b2o$152bo3bo37bo3bo$151b2o2b2o2b2o24b2o6b2o2b2o$
151b5ob5o21b5o5b5o$148bo3b2o2b2o2b2o20b2o2b2o6b2o$146b3o7bo3bo21bo3bo$
146b3obo4b2o2b2o20b2o2b2o2b2o$148bo6b5o21b5ob5o$145bobo8b2o20bo3b2o2b
2o2b2o$142b2o3b2o4bo22b3o7bo3bo$142b2ob2o29b3obo4b2o2b2o$141b4obo3bob
4o22bo6b5o$150b2ob2o20bobo8b2o$143bo4b2o3b2o17b2o3b2o4bo$149bobo20b2ob
2o$148bo22b4obo3bob4o$146bob3o29b2ob2o$141b2o5b3o22bo4b2o3b2o$140bobo
5bo30bobo$140b2o36bo$176bob3o$171b2o5b3o$170bobo5bo$170b2o3$146bo$145b
4o$144b2obo$144bobobo$143bo5b2o$144bobo4bo$143bo2bo$144bo3b2o$142bo2b
4obo$143b2ob2o2bo$139bo6b3obo$137b4o2b4obo$137b3o4bo$136b4o8bo$137bo7b
2o$145bobo$143b2o17bo$144bo12b3o3bo$160bo2bo$154bob2ob2o3bobo$152bo4b
3o5b2o$153bo2b4ob2obob2o$152b2o2bo2bo5b2o$150b2o3b2obobobob2o$151bo4bo
bo2bobo$159bo2$156bo$154b4o$154b3o$153b4o$107b3o44bo$101bo3b4o$106b2ob
o$99bobo2bobo2$93bo4bobobo3b2o$96bo2b3o3bo$96bo2b2o2bobobo$99b4o$91bo
5b3o$91b3ob2o2b3o27bo$91b2ob3o2b2ob2o22b2o$91b3o2bo2bo3b2o21bo2bo$92bo
2bo2bo3b3o20b2obo$92bo3bob2o2bo23bo$90b4o4bo4bo18bo2bobo$90b3o5b2obo$
89b4o3b2obo$93b2obo2bo$89bo2b4obo2bo$90bob4o2bo$88bobo2bob2o$88b3o4b2o
$87b2o2bobob2o$89bobo2b3o$90bo2bo$3bo84bob2o$bo85b2o$2o$bo$bobo8$51bo$
49bo$48b2o$49bo$49bobo!
More soon, as Sylvia permits!

User avatar
Tropylium
Posts: 421
Joined: May 31st, 2011, 7:12 pm
Location: Finland

Re: Hexagonal Life

Post by Tropylium » October 14th, 2011, 2:07 pm

EricG wrote:I like B01245/S036H -- Try a random field (54% density) with this rule, and you'll find life-like behavior, including a very common glider analog.

You're also quite likely to find the following much larger spaceship, which is the most remarkable natural spaceship I've found so far. If it ever needs a name, I'd like to name it "the Sylph" after my daughter Sylvia.
Wow, that IS quite remarkable size for a natural spaceship. That has to be one of the more spectacular failed replicators.

And is that S6 you have in there? That should mean that it's an "anti-vacuum" rule — but the inverse rule, ie. B1245/S03 does not behave the same at all. Something's wrong here…

EricG
Posts: 199
Joined: August 19th, 2011, 5:41 pm
Location: Chicago-area, USA

Re: Hexagonal Life

Post by EricG » October 14th, 2011, 2:15 pm

I've tried to engineer rakes without any success enough times that this very small pattern which produces two double rakes (in a non-explosive rule!) seems like magic to me:

Code: Select all

x = 156, y = 34, rule = B01245/S036H
9$119b3o$118bo2bo$117bo3bobo$117bo2bobo$117b3o3b3o23b3o$120bobo2bo22bo
2bo$119bobo3bo21bo3bobo$121bo2bo22bo2bobo$121b3o23b3o3b3o$150bobo2bo$
149bobo3bo$151bo2bo$3b3o145b3o$2bo2bo$bo3bobo$bo2bobo$b3o3b3o23b3o$4bo
bo2bo22bo2bo$3bobo3bo21bo3bobo$5bo2bo22bo2bobo$5b3o23b3o3b3o$34bobo2bo
$33bobo3bo$35bo2bo$35b3o!
Subsets of the pattern are fun too.
--

Yes, something strange is going on with Golly, and if it is "fixed", I hope it doesn't make these rules less fun. Or at least, I hope the current set-up can be an option and can be characterized so it can be run on other programs. Another example of something strange: set up a B0xxx/Sxxx/H rule, note its behavior, and then add S7 or S8 to the rule. I expected that 7s and 8s would be ignored, but they are not -- they change the rule's behavior. If anyone can't quickly reproduce this, let me know, and I'll post some examples. If the fix is simply "don't add 7s and 8s to a hexagonal rule", that's fine with me!

EricG
Posts: 199
Joined: August 19th, 2011, 5:41 pm
Location: Chicago-area, USA

Re: Hexagonal Life

Post by EricG » October 14th, 2011, 5:36 pm

I think I see what Golly is doing now. It is looking for B0 and S8, instead of B0 and S6 as we might expect for hexagonal neighborhoods. Since it doesn't find S8 in rule B01245/S036H, it reverts to the usual David Eppstein idea of changing the rule based on whether the generation is odd or even. But it doesn't generate the expected rule, because again, it uses 8 instead of 6. (For newbies, I'll include David Eppstein's idea at the bottom of this post.)

For rule B01245/S036H, Golly uses B36/S1245H (with correct axes) on even generations, and B258/S34678H (with correct axes) on odd generations. Or perhaps it runs B25/S346H (no 7s and 8s).

To demonstrate this, watch the behavior of this p4 oscillator and its mirror image.

Code: Select all

x = 15, y = 5, rule = B01245/S036H
2b3o5b3o$bo2bo5bo2bo$o3bo5bo3bo$o2bo7bo2bo$3o9b3o!
First run the pattern with B01245/S036H, and then run it again, manually switching the rule from B36/S1245H to B258/S34678H. I think it is safe to remove the S7 and S8 from the rule, but I haven't tested it on any patterns but the p4 oscillator.

Is this post sufficient to report a bug, or should I contact the Golly authors?

Sigh. I really liked that rake. I would be very interested if someone can suggest a way to salvage it in a way that is more elegant than simply alternating two arbitrary rules. I have more hexagonal spaceship rules to report, but now I'm confused about what I'm reporting on.

For anyone bewildered by this post, the following from liferules.cpp in the Golly source code might help:
/* Use David Eppstein's idea to change the current rule depending on gen parity.
If original rule has B0 but not S8:

For even generations, whenever the original rule has a Bx or Sx, omit that
bit from the modified rule, and whenever the original rule is missing a
Bx or Sx, add that bit to the modified rule.
eg. B03/S23 => B1245678/S0145678.

For odd generations, use Bx if and only if the original rule has S(8-x)
and use Sx if and only if the original rule has B(8-x).
eg. B03/S23 => B56/S58.

If original rule has B0 and S8:

Such rules don't strobe, so we just want to invert all the cells.
The trick is to do both changes: invert the bits, and swap Bx for S(8-x).
eg. B03/S238 => B123478/S0123467 (for ALL gens).
*/

User avatar
Andrew
Moderator
Posts: 935
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Hexagonal Life

Post by Andrew » October 14th, 2011, 9:39 pm

EricG wrote:Is there a way to correctly rotate and flip patterns created for a hexagonal neighborhood in Golly?
Here's a Python script that does rotation by 60 degrees (save it as something like hexrot.py):

Code: Select all

# Rotate hexagonal neighborhood pattern clockwise by 60 degrees.
# Author: Andrew Trevorrow (andrew@trevorrow.com), Oct 2011.

import golly as g

if g.empty(): g.exit("There is no pattern.")

rect = g.getrect()
x = rect[0]
y = rect[1]
wd = rect[2]
ht = rect[3]

# find central cell about which rotation will occur
cx = x + wd/2
cy = y + ht/2

# determine number of rings around central cell
numrings = wd
if ht > wd: numrings = ht

# the following transitions are used to calculate positions of cells
# in a ring, where the values start from the NW corner and assume the
# hexagonal neighborhood is emulated by ignoring the NE and SW corners:
# 
#             NW N NE         NW  N
#             W  C  E   ->   W  C  E
#             SW S SE         S  SE
#
transitions = [ (+1,0), (+1,+1), (0,+1), (-1,0), (-1,-1), (0,-1) ]

# rotate live cells within each ring, starting from the innermost ring
ring = 0
while ring < numrings:
   ring += 1
   x = cx-ring
   y = cy-ring
   # generate cell positions in current ring
   cellpos = []
   for i in xrange(6):
      deltax, deltay = transitions[i]
      # each transition element is repeated by the ring number
      for j in xrange(ring):
         cellpos.append( (x,y) )
         x += deltax
         y += deltay
   
   # delete live cells in ring and remember their rotated positions
   # by cycling to the right by the ring number
   saveinfo = []
   for i in xrange(6 * ring):
      x, y = cellpos[i]
      state = g.getcell(x, y)
      if state > 0:
         g.setcell(x, y, 0)
         rotpos = (i + ring) % len(cellpos)
         rotx, roty = cellpos[rotpos]
         saveinfo.append( (rotx, roty, state) )
   
   # create rotated cells
   for info in saveinfo:
      x, y, state = info
      g.setcell(x, y, state)
It seems to work fine, except for rules with B0. There does seem to be a bug in the way we handle B0-and-H rules so for now I wouldn't spend any more time on such rules until we find a solution.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

EricG
Posts: 199
Joined: August 19th, 2011, 5:41 pm
Location: Chicago-area, USA

Re: Hexagonal Life

Post by EricG » October 15th, 2011, 1:34 am

Andrew, that's terrific! Thanks for the script! I look forward to using a fixed version of the B0+H rules, and in the meantime, I'm going to view the buggy version as an opportunity to try out alternating rules that I would have never thought to pair up. (I do think that alternating rules is an interesting idea, as Tropylium, ExtremeEnthusiast, and George Maydwell have previously described in the "Other Cellular Automata" forum.)

Thank you again!
---
Spaceship rules for "the buggy version":

B02345/S023H - has a linear replicator.
B02345/S02H - the linear replicator still works, but in addition, there is a Seirpinski triangle generator. It is fun to see the triangles streched by the distorted hexagonal nature of the neighborhood.
B0345/S02H and B035/S023H are exploding rules with a natural spaceship, and B01346/S02H is a non-exploding rule with at least two natural spaceships.
B0345/S023H is the most interesting -- it has quite a variety of natural spaceships, including some with sparks that might be useful. All of the above can be found very easily with a long & narrow random field.

User avatar
Andrew
Moderator
Posts: 935
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Hexagonal Life

Post by Andrew » October 17th, 2011, 6:43 pm

The good news is we've fixed the bug with B0-and-H rules, so Golly 2.3 will do the right thing (we hope to release it in a few weeks). The bad news is that ALL the B0-and-H patterns found by EricG and Tropylium are not really spaceships etc, so apologies for wasting your time. (I did warn you that the H stuff was untested!)
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

EricG
Posts: 199
Joined: August 19th, 2011, 5:41 pm
Location: Chicago-area, USA

Re: Hexagonal Life

Post by EricG » October 18th, 2011, 4:47 am

That's great news.

I've confirmed that Golly 2.2's "buggy version" of B1245/S036H is indeed "B36/S1245H (even generations) + B25/S346H (odd generations)", except that you have to use the mirror image of all patterns to stick to the usual convention for hexagonal neighborhoods.

I think it is a neat rule - it is easy to create rakes, but not so easy that any swipe of the mouse will do it, as in some Generations rules. It is sort of a "training wheels rule" for engineered patterns. I've constructed quite a few rakes, puffers, and breeders so far, and I'll post the more interesting ones. I'm still looking for glider and spaceship guns, as well as a true replicator, and I challenge anyone reading this to find one first!

Since the rule won't run in the upcoming version of Golly, I constructed a rule table for it. I barely know what I'm doing, and based it heavily on Tropylium's rule table for alternating rules found here: viewtopic.php?f=11&t=719#p5060 I'll include the rule table below. If anyone has any suggestions for making it run faster or improving it, I'm all ears. I used symmetries:permute because Tropylium did, but would symmetries:rotate6reflect or some other symmetry make the rule work better in any way?

Andrew, I'm in awe of the work that has gone into Golly, and I hope the following question doesn't sound cheeky coming from a newbie like me, but have you considered giving Golly built-in support for alternating rules? I realize feature creep is always a problem, but in this case, Golly already supports alternating rules to emulate B0 rules, so I presume all the infrastructure is already in place, except for the user interface. No need to reply - I just wanted you to hear the suggestion. Thanks again.

A first pass at a "Hexasylph" rule table:

Code: Select all

n_states:3
neighborhood:hexagonal
symmetries:permute

var a={0,1,2}
var b={a}
var c={a}
var d={a}
var e={a}
var f={a}


# birth
# 0,1,0,0,0,0,0,2
# 0,1,1,0,0,0,0,2
0,1,1,1,0,0,0,2
# 0,1,1,1,1,0,0,2
# 0,1,1,1,1,1,0,2
0,1,1,1,1,1,1,2


# survival
#1,0,0,0,0,0,0,2
1,1,0,0,0,0,0,2
1,1,1,0,0,0,0,2
# 1,1,1,1,0,0,0,2
1,1,1,1,1,0,0,2
1,1,1,1,1,1,0,2
# 1,1,1,1,1,1,1,2


# death otherwise
1,a,b,c,d,e,f,0

# birth
# 0,2,0,0,0,0,0,1
0,2,2,0,0,0,0,1
# 0,2,2,2,0,0,0,1
# 0,2,2,2,2,0,0,1
0,2,2,2,2,2,0,1
# 0,2,2,2,2,2,2,1


# survival
# 2,0,0,0,0,0,0,1
# 2,2,0,0,0,0,0,1
# 2,2,2,0,0,0,0,1
2,2,2,2,0,0,0,1
2,2,2,2,2,0,0,1
# 2,2,2,2,2,2,0,1
2,2,2,2,2,2,2,1

# death otherwise
2,a,b,c,d,e,f,0
(Edited to fix incomplete cut-&-paste of ruletable)

User avatar
Andrew
Moderator
Posts: 935
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Hexagonal Life

Post by Andrew » October 18th, 2011, 6:43 am

... have you considered giving Golly built-in support for alternating rules?
I think it's unlikely, for a couple of reasons:

1. It looks quite easy to create rule tables for exploring these rules. (I tested yours and it seems to work fine.) In fact, it should be possible to create a script that could spit out a desired rule table given 2 rules
(but no, I'm not volunteering!).

2. More importantly, rule tables will actually run faster than a modified HashLife! It's the same reason HashLife doesn't support B0-not-S8 rules (which require two alternating rules to emulate). To use one rule for even gens and another rule for odd gens we'd have to restrict the step size to 1, but that defeats one of HashLife's features that makes it so fast -- ie. the ability to jump ahead many generations.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

Post Reply