Rule with 'Memories'

For discussion of other cellular automata.
Post Reply
User avatar
islptng
Posts: 496
Joined: May 24th, 2024, 6:17 am
Location: 种花家

Rule with 'Memories'

Post by islptng »

This kind of rule has a feature: Cells can have memories.


M=1 is simply 2D Moore; M=2 means a cell can remember its previous generation; etc.
(We treat evolutionary sequences of 2D CA as 3D structures, just as how we treated 1D as 2D)
Then, when M=3, a cell and its neighborhood is:

Code: Select all

3D version=1 size=100 pos=36,51,49
x=3 y=4 z=3 rule=3D5..7/6
$3o$3o$3o/bo$3o$3o$3o/$3o$3o$3o!
Use this script for make_ruletree.py:

Code: Select all

birth = [5,9]
survival = [3,4,5,8]
memory = 2

name = "B"
for i in birth: name += str(i) + ","
name += "S"
for i in survival: name += str(i) + ","
name += "M" + str(memory)
n_states = 2 ** memory
n_neighbors = 8
def tobinary(n):
	res = []
	while n != 0:
		res.append(n % 2)
		n = n // 2
	while len(res) < memory:
		res.append(0)
	return res
def append(n, new):
	binlist = [new] + tobinary(n)[:-1]
	res = 0
	while len(binlist) != 0:
		res *= 2
		res += binlist.pop()
	return res
def onbitinbin(n):
	binlist = tobinary(n)
	cnt = 0
	for i in binlist: cnt += i
	return cnt
def transition_function(a):
	n = 0
	for i in a[:-1]:
		n += onbitinbin(i)
	if n in survival and a[8] % 2 == 1:
		return append(a[8], 1)
	if n in birth and a[8] % 2 == 0:
		return append(a[8], 1)
	return append(a[8], 0)

The rule in the script is B5,9/S3,4,5,8/M2, you can change it.

B5,9/S3,4,5,8/M2
This rule has a small P30:

Code: Select all

x = 4, y = 3, rule = B5,9,S3,4,5,8,M2
.2C$CB.C$.2C!

@RULE B5,9,S3,4,5,8,M2

@TREE

num_states=4
num_neighbors=8
num_nodes=60
1 0 2 0 2
2 0 0 0 0
1 0 3 0 3
2 0 0 0 2
2 0 2 2 2
3 1 3 3 4
1 1 3 1 3
2 2 2 2 6
3 3 4 4 7
2 2 6 6 0
3 4 7 7 9
4 5 8 8 10
2 6 0 0 0
3 7 9 9 12
4 8 10 10 13
3 9 12 12 3
4 10 13 13 15
5 11 14 14 16
1 1 2 1 2
2 0 2 2 18
3 12 3 3 19
4 13 15 15 20
5 14 16 16 21
2 2 18 18 0
3 3 19 19 23
4 15 20 20 24
5 16 21 21 25
6 17 22 22 26
2 18 0 0 0
3 19 23 23 28
4 20 24 24 29
5 21 25 25 30
6 22 26 26 31
3 23 28 28 1
4 24 29 29 33
5 25 30 30 34
6 26 31 31 35
7 27 32 32 36
3 28 1 1 1
4 29 33 33 38
5 30 34 34 39
6 31 35 35 40
7 32 36 36 41
3 1 1 1 1
4 33 38 38 43
5 34 39 39 44
6 35 40 40 45
7 36 41 41 46
8 37 42 42 47
4 38 43 43 43
5 39 44 44 49
6 40 45 45 50
7 41 46 46 51
8 42 47 47 52
4 43 43 43 43
5 44 49 49 54
6 45 50 50 55
7 46 51 51 56
8 47 52 52 57
9 48 53 53 58
and a diagonal spaceship(sorry, I didn't save it).
Last edited by islptng on December 7th, 2024, 1:06 am, edited 1 time in total.
My sandbox | All my engineered replicators | BsKngt | TNT
Asperger, ISTP, using a Dvorak keyboard.

I love my new school life.
User avatar
LuveelVoom
Posts: 897
Joined: April 27th, 2022, 7:59 pm
Location: The 102 dimensional INT hypercube

Re: Rule with 'Memories'

Post by LuveelVoom »

islptng wrote: December 6th, 2024, 1:33 am
B5,9/S3,4,5,8/M2
This rule has a small P30:

Code: Select all

x = 4, y = 3, rule = B5,9,S3,4,5,8,M2
.2C$CB.C$.2C!
and a diagonal spaceship(sorry, I didn't save it).
You should probably include the ruletable in the pattern so it can be run.
User avatar
pifricted
Posts: 1146
Joined: May 25th, 2024, 10:26 am
Location: Click here to set your location

Re: Rule with 'Memories'

Post by pifricted »

P224:

Code: Select all

x = 5, y = 5, rule = B4,10,S4,5,M2
3.B$B2.BA$4.A$.C.A$.ABA!
2c/4o:

Code: Select all

x = 4, y = 3, rule = B4,10,S4,5,7,M2
C2BC$.2C$.2A!
...is enjoying his teenage time.
User avatar
islptng
Posts: 496
Joined: May 24th, 2024, 6:17 am
Location: 种花家

Re: Rule with 'Memories'

Post by islptng »

pifricted wrote: December 8th, 2024, 1:59 am P224:

Code: Select all

x = 5, y = 5, rule = B4,10,S4,5,M2
3.B$B2.BA$4.A$.C.A$.ABA!

@RULE B4,10,S4,5,M2

@TREE

num_states=4
num_neighbors=8
num_nodes=60
1 0 2 0 2
2 0 0 0 0
1 1 3 1 3
2 0 0 0 2
3 1 1 1 3
1 0 3 0 3
2 0 2 2 5
3 1 3 3 6
2 2 5 5 0
3 3 6 6 8
4 4 7 7 9
2 5 0 0 0
3 6 8 8 11
4 7 9 9 12
3 8 11 11 1
4 9 12 12 14
5 10 13 13 15
3 11 1 1 1
4 12 14 14 17
5 13 15 15 18
1 1 2 1 2
2 0 0 0 20
3 1 1 1 21
4 14 17 17 22
5 15 18 18 23
6 16 19 19 24
2 0 20 20 0
3 1 21 21 26
4 17 22 22 27
5 18 23 23 28
6 19 24 24 29
2 20 0 0 0
3 21 26 26 31
4 22 27 27 32
5 23 28 28 33
6 24 29 29 34
7 25 30 30 35
3 26 31 31 1
4 27 32 32 37
5 28 33 33 38
6 29 34 34 39
7 30 35 35 40
3 31 1 1 1
4 32 37 37 42
5 33 38 38 43
6 34 39 39 44
7 35 40 40 45
8 36 41 41 46
3 1 1 1 1
4 37 42 42 48
5 38 43 43 49
6 39 44 44 50
7 40 45 45 51
8 41 46 46 52
4 42 48 48 48
5 43 49 49 54
6 44 50 50 55
7 45 51 51 56
8 46 52 52 57
9 47 53 53 58
Correct period is P244, not P224.
also a small c/3d:

Code: Select all

x = 4, y = 4, rule = B4,10,S4,5,M2
AC$C2B$.B.A$2.B!

@RULE B4,10,S4,5,M2

@TREE

num_states=4
num_neighbors=8
num_nodes=60
1 0 2 0 2
2 0 0 0 0
1 1 3 1 3
2 0 0 0 2
3 1 1 1 3
1 0 3 0 3
2 0 2 2 5
3 1 3 3 6
2 2 5 5 0
3 3 6 6 8
4 4 7 7 9
2 5 0 0 0
3 6 8 8 11
4 7 9 9 12
3 8 11 11 1
4 9 12 12 14
5 10 13 13 15
3 11 1 1 1
4 12 14 14 17
5 13 15 15 18
1 1 2 1 2
2 0 0 0 20
3 1 1 1 21
4 14 17 17 22
5 15 18 18 23
6 16 19 19 24
2 0 20 20 0
3 1 21 21 26
4 17 22 22 27
5 18 23 23 28
6 19 24 24 29
2 20 0 0 0
3 21 26 26 31
4 22 27 27 32
5 23 28 28 33
6 24 29 29 34
7 25 30 30 35
3 26 31 31 1
4 27 32 32 37
5 28 33 33 38
6 29 34 34 39
7 30 35 35 40
3 31 1 1 1
4 32 37 37 42
5 33 38 38 43
6 34 39 39 44
7 35 40 40 45
8 36 41 41 46
3 1 1 1 1
4 37 42 42 48
5 38 43 43 49
6 39 44 44 50
7 40 45 45 51
8 41 46 46 52
4 42 48 48 48
5 43 49 49 54
6 44 50 50 55
7 45 51 51 56
8 46 52 52 57
9 47 53 53 58
Most of the soup settles into this p244 and this c/3d, so far no more objects found.
My sandbox | All my engineered replicators | BsKngt | TNT
Asperger, ISTP, using a Dvorak keyboard.

I love my new school life.
vilc
Posts: 317
Joined: March 20th, 2024, 4:36 pm

Re: Rule with 'Memories'

Post by vilc »

islptng wrote: December 8th, 2024, 7:44 pm [...]
Most of the soup settles into this p244 and this c/3d, so far no more objects found.
There are some naturally occuring p3 oscillators (on the left), one of which can be phase shifted and infinitely extended (on the right) :

Code: Select all

x = 55, y = 6, rule = B4,10,S4,5,M2
ABA6.2A7.B$.C7.2B7.AC24.C7.ABA$.C6.A2.A8.CA22.C8.C$.C7.2B9.B23.C8.C$
9.2A33.C8.C$44.C8.C!
@RULE B4,10,S4,5,M2

@TREE

num_states=4
num_neighbors=8
num_nodes=60
1 0 2 0 2
2 0 0 0 0
1 1 3 1 3
2 0 0 0 2
3 1 1 1 3
1 0 3 0 3
2 0 2 2 5
3 1 3 3 6
2 2 5 5 0
3 3 6 6 8
4 4 7 7 9
2 5 0 0 0
3 6 8 8 11
4 7 9 9 12
3 8 11 11 1
4 9 12 12 14
5 10 13 13 15
3 11 1 1 1
4 12 14 14 17
5 13 15 15 18
1 1 2 1 2
2 0 0 0 20
3 1 1 1 21
4 14 17 17 22
5 15 18 18 23
6 16 19 19 24
2 0 20 20 0
3 1 21 21 26
4 17 22 22 27
5 18 23 23 28
6 19 24 24 29
2 20 0 0 0
3 21 26 26 31
4 22 27 27 32
5 23 28 28 33
6 24 29 29 34
7 25 30 30 35
3 26 31 31 1
4 27 32 32 37
5 28 33 33 38
6 29 34 34 39
7 30 35 35 40
3 31 1 1 1
4 32 37 37 42
5 33 38 38 43
6 34 39 39 44
7 35 40 40 45
8 36 41 41 46
3 1 1 1 1
4 37 42 42 48
5 38 43 43 49
6 39 44 44 50
7 40 45 45 51
8 41 46 46 52
4 42 48 48 48
5 43 49 49 54
6 44 50 50 55
7 45 51 51 56
8 46 52 52 57
9 47 53 53 58
They occur with a (very) approximate frequency of 1 per megacell in large soups.
User avatar
eRroR_6o6
Posts: 387
Joined: August 15th, 2023, 1:24 am
Location: somewhere over the rainbow

Re: Rule with 'Memories'

Post by eRroR_6o6 »

So if I'm not mistaken, this is somewhat like a second-order cellular automaton but 2D, right?

Code: Select all

x = 19, y = 37, rule = B3/S23
13b3o$12b4o$11b2obobo$13bobo$15bo12$10b2o$bobo7bobo$o7b2o3b2o$o3bo2b3o
3bo$o6b4obo$o2bo7bo$3o12bobo$18bo$14bo3bo$14bo3bo$18bo$9bo5bo2bo$8b3o
5b3o2$10bo$2bobo4b2o$5bo2b3o$5bo2b3o$2bo2bo2b2obo$3b3o3b3o$10bo!
User avatar
confocaloid
Posts: 6697
Joined: February 8th, 2022, 3:15 pm
Location: learn to protect yourself against stray gliders and sparks and self-destruct mechanisms

Re: Rule with 'Memories'

Post by confocaloid »

eRroR_6o6 wrote: December 16th, 2024, 10:06 pm So if I'm not mistaken, this is somewhat like a second-order cellular automaton but 2D, right?
As far as I can tell it's a different idea. Here, states of neighbours in the current generation and states of neighbours in the preceding generation are all added together to give a single number; then that number and the current state of the middle cell are used to compute the state of the cell in the next generation.

Second-order cellular automata are reversible, and the state of a cell in the next generation can depend on the state of that one cell in the preceding generation and the states of cells in its neighbourhood in the current generation.
127:1 B3/S234c User:Confocal/R (isotropic CA, incomplete)
Unlikely events happen.
My silence does not imply agreement, nor indifference. If I disagreed with something in the past, then please do not construe my silence as something that could change that.
SomePersonAlt
Posts: 19
Joined: June 3rd, 2025, 5:36 pm
Contact:

Re: Rule with 'Memories'

Post by SomePersonAlt »

islptng wrote: December 6th, 2024, 1:33 am Use this script for make_ruletree.py:

Code: Select all

--snip--
how exactly am i supposed to run this? its not printing anything

Code: Select all

x = 7, y = 7, rule = B3/S23|B2/S2-i
3b3o$2b2obo$b2o3bo$2ob2o$o2b3o$2o2bo$2bo!

#C [[ ZOOM 19.5 TRACK -6/12 -6/12 GPS 6 THEME Golly LOOP 12 AUTOSTART ]]
User avatar
islptng
Posts: 496
Joined: May 24th, 2024, 6:17 am
Location: 种花家

Re: Rule with 'Memories'

Post by islptng »

SomePersonAlt wrote: July 2nd, 2025, 7:48 pm how exactly am i supposed to run this? its not printing anything
Changge the rule if you want, copy it, and click Scripts/Python/Rule-Generators/make-ruletree.py in Golly. Wait a few time and you can see the rule generated.


EDIT:
SomePersonAlt wrote: July 3rd, 2025, 7:54 am I am on android, sadly. Could you make a version that just prints to the console?
Sadly not. You need the Golly library to run it.
Last edited by islptng on July 4th, 2025, 4:29 am, edited 1 time in total.
My sandbox | All my engineered replicators | BsKngt | TNT
Asperger, ISTP, using a Dvorak keyboard.

I love my new school life.
SomePersonAlt
Posts: 19
Joined: June 3rd, 2025, 5:36 pm
Contact:

Re: Rule with 'Memories'

Post by SomePersonAlt »

islptng wrote: July 2nd, 2025, 8:57 pm
SomePersonAlt wrote: July 2nd, 2025, 7:48 pm how exactly am i supposed to run this? its not printing anything
Changge the rule if you want, copy it, and click Scripts/Python/Rule-Generators/make-ruletree.py in Golly. Wait a few time and you can see the rule generated.
I am on android, sadly. Could you make a version that just prints to the console?

Code: Select all

x = 7, y = 7, rule = B3/S23|B2/S2-i
3b3o$2b2obo$b2o3bo$2ob2o$o2b3o$2o2bo$2bo!

#C [[ ZOOM 19.5 TRACK -6/12 -6/12 GPS 6 THEME Golly LOOP 12 AUTOSTART ]]
Post Reply