ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

Rule request thread

For discussion of other cellular automata.

Re: Rule request thread

Postby wildmyron » July 18th, 2018, 6:56 am

Caenbe wrote:I guess I should have mentioned, I don't have Lua yet. So, that'll be a blast to get working.

You don't need to get the Lua interpreter separately, it comes included with Golly from version 3.0 on.
wildmyron
 
Posts: 790
Joined: August 9th, 2013, 12:45 am

Re: Rule request thread

Postby gameoflifemaniac » July 18th, 2018, 6:56 am

Is it possible do a cellular automaton that would emulate Larger than Life?
The icons would look like this:
Attachments
Larger than Life emulator icons.png
Larger than Life emulator icons.png (645 Bytes) Viewed 182 times
https://www.youtube.com/watch?v=q6EoRBvdVPQ
One big dirty Oro. Yeeeeeeeeee...
User avatar
gameoflifemaniac
 
Posts: 601
Joined: January 22nd, 2017, 11:17 am
Location: Poland

Re: Rule request thread

Postby Caenbe » July 18th, 2018, 5:15 pm

With the modification to the script I detailed earlier, everything seems to be working exactly as it should. Here's the modified version:
-- initAsyncUniverse - initialise a part of the universe to run asynchronous CA rules
-- see http://conwaylife.com/forums/viewtopic.php?p=61953#p61953
-- Author: Arie Paap, July 2018
-- Credit: Based on Golly's invert.lua by Andrew Trevorrow

-- Usage: Draw a pattern in a 2-state rule at Gen 0 and then run this script

local g = golly()
local gp = require "gplus"

-- re-assigning inner loop functions results in a 10% speed up
local setcell = g.setcell
local getcell = g.getcell

-- Determine the area to initialise
local buffer = 50
local r = g.getselrect()
if #r == 0 then r = {0, 0, 0, 0} end

r[1] = r[1] - buffer
r[2] = r[2] - buffer
r[3] = r[3] + 2*buffer
r[4] = r[4] + 2*buffer

r = gp.rect(r)

-- Convert cells within this area

local oldsecs = os.clock()
local newsecs = os.clock()
local state = 0

for row = r.top, r.bottom do
    -- if large selection then give some indication of progress
    newsecs = os.clock()
    if newsecs - oldsecs >= 1.0 then
        oldsecs = newsecs
        g.update()
    end
    for col = r.left, r.right do
        state = 2 + 2 * ( 2*(row % 2) + ((row + col) % 2) )     
        setcell(col, row, state - getcell(col, row))
    end
end

Thanks, everyone involved. Unfortunately, I'm kind of busy lately, so I may not have a lot of time to investigate these asynchronous rules.
0.1485̅
Caenbe
 
Posts: 45
Joined: September 20th, 2016, 4:24 pm
Location: Nowhere Land, USA

Re: Rule request thread

Postby AforAmpere » July 18th, 2018, 7:38 pm

gameoflifemaniac wrote:Is it possible do a cellular automaton that would emulate Larger than Life?
The icons would look like this:


Only if Golly can handle over 68 billion transitions. This is because each cell would have 16 states, and the number of border cells is 9, so 16^9 transitions, or just over 68 billion. Unlike the method for reducing the number of transitions for Life played on this effectively larger grid (I discussed this somewhere else), which I estimate can be reduced to around 65,000 transitions, this idea of LTL using this grid, with a maximum range of two, would have no easy way that I can see to reduce the number of transitions, effectively making the number incredibly large.

I tried my hand at making Life work on this kind of grid, but it turned out to be too much for me, even with some ways to reduce the number of transitions further. Maybe a script could work for that, but not for the LTL version, as far as I can see.
Things to work on:
- Find a (7,1)c/8 ship in a Non-totalistic rule (someone please search the rules)
- Find a C/10 in JustFriends
- Find a C/10 in Day and Night
AforAmpere
 
Posts: 708
Joined: July 1st, 2016, 3:58 pm

Re: Rule request thread

Postby wildmyron » July 18th, 2018, 10:52 pm

Caenbe wrote:With the modification to the script I detailed earlier, everything seems to be working exactly as it should.

Ahh, yes. That does match the behaviour correctly and I see that the version I posted had the cell states for rows with odd x flipped. The resulting behaviour is certainly less explosive and seems similarly chaotic to CGoL.

gameoflifemaniac wrote:Is it possible do a cellular automaton that would emulate Larger than Life?
The icons would look like this:

Do you mean something like the ruletables produced by the Extended Neighborhood Emulator Script? In that case the neighbourhood is a disc rather than the full range 2 Moore neighbourhood, but I think ruletables emulating rules with the same survival conditions on the two neighbourhoods would come to very similar sizes. Did you have a particular Larger Than Life rule in mind? for range 2 rules I would say it's possible, depending on the number of B/S transitions specified, but for larger ranges I don't think 256 states is sufficient (has someone done that calculation?)

I'm afraid I don't understand your table of icons, perhaps I misunderstood what you want the rule to do.
wildmyron
 
Posts: 790
Joined: August 9th, 2013, 12:45 am

Re: Rule request thread

Postby wildmyron » July 19th, 2018, 2:20 am

Here's a Python script to generate ruletables for asynchronous versions of Life-like rules, according to Caenbe's spec.

I've only tested it with B3S23 and verified that it generates a ruletable which behaves identically to AsyncLife which I posted earlier.

# genAsyncRule.py
# Generate a ruletabe to emulate an asynchronous cellular automata
# see http://conwaylife.com/forums/viewtopic.php?p=61953#p61953
# Author: Arie Paap, July 2018

import golly as g

# Rule generator functions derived from apgsearch v1.1 by Adam P. Goucher

# Save a rule file:
def saverule(name, comments, table, colours):

    ruledir = g.getdir("rules")
    filename = ruledir + name + ".rule"

    results = "@RULE " + name + "\n\n"
    results += "*** File autogenerated by genAsyncRule. ***\n"
    results += comments
    results += "\n\n@TABLE\n\n"
    results += table
    results += "\n@COLORS\n\n"
    results += colours

    try:
        f = open(filename, 'w')
        f.write(results)
        f.close()
    except:
        g.warn("Unable to create rule table:\n" + filename)

# Generate a transition line
def scoline(chara, charb, left, right, amount):

   line = str(left) + ","

   for i in xrange(8):
      if (i < amount):
         line += chara
      else:
         line += charb
      line += str(i+1)
      line += ","

   line += str(right) + "\n"

   return line

# Construct and save the ruletable
def saveAsyncRule():
    # Set outer-totalistic rule:
    rulestring = g.getstring("Enter Life-like rule to use?", "B3/S23")
    mode = 0
    ess = [False]*9
    bee = [False]*9

    for c in rulestring:
        if ((c == 's') | (c == 'S')):
            mode = 0
        if ((c == 'b') | (c == 'B')):
            mode = 1
        if (c == '/'):
            mode = 1 - mode
        if ((ord(c) >= 48) & (ord(c) <= 56)):
            d = ord(c) - 48
            if (mode == 0):
                ess[d] = True
            else:
                bee[d] = True
    alphanumeric = "B"
    for i in xrange(9):
        if (bee[i]):
            alphanumeric += str(i)
    alphanumeric += "S"
    for i in xrange(9):
        if (ess[i]):
            alphanumeric += str(i)

    comments = """
An Asynchronous version of RULESTRING
http://conwaylife.com/forums/viewtopic.php?p=61953#p61953

Cells obey the usual rules of RULESTRING, but instead of the cells all updating
simultaneously, they update in a specific asynchronous fashion.

Cell states:
0:       vacuum
odd:    On cells
even:   Off cells

The way cells update is as follows:
At time 4n, all cells with even x and even y update (initialised to states 1 and 2).
At time 4n+1, all cells with odd x and even y update (initialised to states 3 and 4).
At time 4n+2, all cells with odd x and odd y update (initialised to states 5 and 6).
At time 4n+3, all cells with even x and odd y update (initialised to states 7 and 8).
"""
    comments.replace("RULESTRING", rulestring)
    varlist = """
var OFF1 = {2,4,6,8}
var OFF2 = OFF1
var OFF3 = OFF1
var OFF4 = OFF1
var OFF5 = OFF1
var OFF6 = OFF1
var OFF7 = OFF1
var OFF8 = OFF1
var ON1 = {1,3,5,7}
var ON2 = ON1
var ON3 = ON1
var ON4 = ON1
var ON5 = ON1
var ON6 = ON1
var ON7 = ON1
var ON8 = ON1
var any1 = {0,1,2,3,4,5,6,7,8}
var any2 = any1
var any3 = any1
var any4 = any1
var any5 = any1
var any6 = any1
var any7 = any1
var any8 = any1
"""   
    table = "n_states:9\n"
    table += "neighborhood:Moore\n"
    table += "symmetries:permute\n"
    table += varlist
    table += "\n"
   
    table += "# Active cells\n"
   
    minperc = 10
    for i in xrange(9):
        if (bee[i]):
            if (minperc == 10):
                minperc = i
            table += scoline("ON","OFF",2,7,i)
        if (ess[i]):
            table += scoline("ON","OFF",1,7,i)

    table += scoline("","any",1,8,0)
    table += scoline("","any",2,8,0)
   
    table += "\n# Inactive cells\n"
    table += scoline("","any",4,2,0)
    table += scoline("","any",6,4,0)
    table += scoline("","any",8,6,0)
    table += scoline("","any",3,1,0)
    table += scoline("","any",5,3,0)
    table += scoline("","any",7,5,0)

    colours = """
0    0    0    0
1  255  255  255
2   64   64   64
3  255    0    0
4   64    0    0
5  255  128    0
6   64   32    0
7  255  255    0
8   64   64    0
"""
   
    name = "Async_"+alphanumeric
    saverule(name, comments, table, colours)
   
    return name

rulename = saveAsyncRule()
g.setrule(rulename)
wildmyron
 
Posts: 790
Joined: August 9th, 2013, 12:45 am

Previous

Return to Other Cellular Automata

Who is online

Users browsing this forum: xanman12321 and 5 guests