Page 1 of 1

Interactive Life

Posted: June 22nd, 2020, 10:30 pm
by Freywa
This is not strictly Conway's Life, as it is a non-zero-player game. However, I feel like this very old variation (dating from 2000) is worth our interest, as a cellular automaton community.

Interactive Life has a so-called intelligent cell (blue in the link's diagrams). Before the next generation is computed, the player may move the intelligent cell to any dead location in said cell's Moore neighbourhood that has 2 or 3 live neighbours (so that there are nine possible choices including staying still, and the intelligent cell survives the update). The game is over when the survival condition cannot be met.

There is quite some research in the link, but it uses Java applets which are no longer supported by modern browsers. If we could salvage the results from there for posterity, and add our own, that would be great.

Re: Interactive Life

Posted: June 22nd, 2020, 11:03 pm
by Freywa
I am going to use a different move notation here than the one used in the link. The correspondence between the two is as follows:

Code: Select all

\U/     bnd
LSR     woe
<D>     psq
For example, the following move sequence is oop in the new notation:

Code: Select all

x = 37, y = 4, rule = LifeHistory
35.A$A.A8.A9.3A10.A.A$.C8.ACA8.ACA9.A2.A$.A19.BA11.EA!

Re: Interactive Life

Posted: June 23rd, 2020, 3:11 am
by Freywa
As published on clickmazes, there is only one blue/intelligent cell, it can only move within the range-1 Moore neighbourhood and it must ensure it stays alive. If we remove these restrictions we should certainly get more interesting results: what happens if
  • the blue cell can move within a range-2 Moore neighbourhood each generation, or some other larger neighbourhood?
  • the blue cell is immortal, i.e. can wander without dying?
  • there are multiple blue cells?
  • the blue cell is allowed to move to an already occupied space?
  • the blue cell leaves behind an alive cell, rather than a dead one, when it moves?

Re: Interactive Life

Posted: June 23rd, 2020, 6:54 am
by Hunting
Can you provide more details, the link seems mostly cryptic to me. Also edit ur posts

Re: Interactive Life

Posted: June 23rd, 2020, 7:42 am
by Freywa
Hunting wrote: June 23rd, 2020, 6:54 am Can you provide more details, the link seems mostly cryptic to me. Also edit ur posts
I believe I have provided enough detail.

Re: Interactive Life

Posted: June 23rd, 2020, 1:26 pm
by dvgrn
Freywa wrote: June 22nd, 2020, 10:30 pmThere is quite some research in the link, but it uses Java applets which are no longer supported by modern browsers. If we could salvage the results from there for posterity, and add our own, that would be great.
I was surprised that the rules didn't allow the blue cell to move from an existing ON location to another currently-ON location, but I guess if the cell is thought of as actually moving around (and leaving an OFF cell behind itself, even if that location would ordinarily stay ON) then it kind of makes sense.

The website's content seems fairly easy to salvage using "View source" in the browser. For example, this page gives a 247-step solution for building a glider gun. The recipe can't be retrieved from the actual page, but it's in the page source:

Code: Select all

L/R>LS>\\><<DS<<U/<<SS<SS<SSU\SSD<SS</S\R\LSSSLS>></\D\\SS\SS\SS\SSD<SS<SS<SS<SS<SS</S\R\LSD\><LSS\SLSUR\>L</S>U>DU<</U\\S<<SS<SS<SSU\>S<R<LSU</\LSS<SLSDR<//SSL\>S\D\U/D>SD/\/<\\SS\SS\SSR/SS/U<>L>RSU>SR/DDDLS<<U\SUDU/SS/SS/<S/SL/SUSU<<U<D>>>/RS<R>

(plus the following to get the blue cell out of the way, apparently)

U/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SSLRSSSSSSSSSSSSSSSSSSSSSS
I could volunteer to make some kind of alpha version that shows the above list of moves turning into a Gosper glider gun. After that maybe somebody else could work on making it nicer, e.g., by adding more keyboard control options and (ideally) an Undo system like the original Java version.

(If someone else is already coding something, here would be a good place to let me know.)

Re: Interactive Life

Posted: June 23rd, 2020, 5:13 pm
by dvgrn
Here's an alpha-version Python script that could be edited to explore any of the clickmazes recipes. I've hard-coded it to display the 247-step Gosper glider gun recipe.

Code: Select all

# interactive-life.py, version 0.1 alpha
# ... I know, it should probably really be interactive-life.lua,
#     but I'm faster at writing Python and theoretically I could always port it over later.

import golly as g
from time import sleep

# the middle line below is only needed to get the key cell out of the way of the gun, and store it safely in a block. Could be much shorter.
preload = r"L/R>LS>\\><<DS<<U/<<SS<SS<SSU\SSD<SS</S\R\LSSSLS>></\D\\SS\SS\SS\SSD<SS<SS<SS<SS<SS</S\R\LSD\><LSS\SLSUR\>L</S>U>DU<</U\\S<<SS<SS<SSU\>S<R<LSU</\LSS<SLSDR<//SSL\>S\D\U/D>SD/\/<\\SS\SS\SSR/SS/U<>L>RSU>SR/DDDLS<<U\SUDU/SS/SS/<S/SL/SUSU<<U<D>>>/RS<R>" \
        + r"U/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SS/SSLRSSSSSSSSSSSSSSSSSSSSSS" \
        + r"SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"   # let the pattern run for a while to show that the glider gun works
startpat = "kGjFiGhHkHiIjI"

waitlength = 0.5

charlookup = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
chardict = {}
for i in range(62):
  chardict[charlookup[i]]=i

delta = {"S":[0,0],"U":[0,-1],"D":[0,1],
         "L":[-1,0],"R":[1,0],"\\":[-1,-1],
         "/":[1,-1],"<":[-1,1],">":[1,1]}

g.setrule("LifeHistory")
g.new("Interactive-Life")
 
if len(startpat) == 0:
    g.exit("Starting pattern has not been specified.")
if len(startpat) % 2 == 1:
    g.exit("Starting pattern must consist of coordinate pairs (i.e., must be even length).")
for i in range(len(startpat)):
    if startpat[i] not in chardict:
        g.exit("Illegal character found in starting pattern: '" + startpat[i] + "'.")
for i in range(0,len(startpat),2):
    x, y = chardict[startpat[i]],chardict[startpat[i+1]]
    if i == 0:
        x0, y0 = x, y
        g.setcell(x,y,5)
    else:
        g.setcell(x,y,1)

g.fit()
g.setmag( g.getmag() - 2 ) 
g.update()

while 1:
    char = ""
    if preload != "":
        char = preload[:1]
        preload = preload[1:]
        if preload == "":
            g.show("No more preloaded recipe.  Press \, U, /, L, S, R, <, D, >.")
        else:
            ch = "?"
            while ch!="~":
                ch = (g.getevent()+"~~~~~")[4]
                if ch == "+" or ch == "=":
                  waitlength /= 1.3
                elif ch == "_" or ch == "-":
                  waitlength *= 1.3
                g.show("Speed = " + str(waitlength) + ", preloaded characters left = " + str(len(preload)) + ". Current character '" + char + "'.")
            sleep(waitlength)
    else:
        while char == "":
            key = g.getevent()
            if key[:4]=="key ":
                dx, dy = 0,0
    	        char = key[4].upper()
    	        if char not in "SUDLR\/<>Q":
    	            char = ""
    if char == "Q":
        g.show("Simulation complete.")
        g.exit()
    dx, dy = delta[char]
    x1, y1 = x0 + dx, y0 + dy
    # g.note("Moving cell to " + str(x1) + "," + str(y1) + ".")
    g.setcell(x0,y0,0)
    g.setcell(x1,y1,5)
    g.update()
    sleep(waitlength)
    g.run(1)
    if g.getcell(x1,y1) != 5:
        g.exit("Problem:  sequence resulted in cell death in generation " + g.getgen() + ".")
    x0, y0 = x1, y1
    g.update()
As it currently stands, the script starts allowing keyboard interaction once the preloaded characters have been processed. The keys are the same as the characters in the clickmazes scripts:

Code: Select all

\U/
LSR
<D>
To speed up or slow down the processing of preloaded characters, hit + or - respectively. Q quits the script.

I didn't put in a check for legality of the key cell's movement, so it can currently move to be on top of an existing ON cell, which is technically illegal by the standard rules.

This link gives a longer recipe for a Gosper glider gun, but with better commentary on how the construction problem was solved. If anyone wants to play around with this, that might be a good next recipe to implement.

I used the "life2" Java applet's way of specifying initial cells, e.g., "kGjFiGhHkHiIjI" for a 2bo$bobo$o2bo$b2o! loaf. It looks like some of the pages instead specify a starting position by a certain number of preliminary moves of a cell (leaving behind an ON trail, I think). If someone wants to implement that option for a starting pattern, please be my guest. I hereby promise not to do any more work on this script, so it's up to all y'all from here out.