Page 1 of 1

Rule with 'Memories'

Posted: December 6th, 2024, 1:33 am
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).

Re: Rule with 'Memories'

Posted: December 6th, 2024, 12:39 pm
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.

Re: Rule with 'Memories'

Posted: December 8th, 2024, 1:59 am
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!

Re: Rule with 'Memories'

Posted: December 8th, 2024, 7:44 pm
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.

Re: Rule with 'Memories'

Posted: December 8th, 2024, 8:44 pm
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.

Re: Rule with 'Memories'

Posted: December 16th, 2024, 10:06 pm
by eRroR_6o6
So if I'm not mistaken, this is somewhat like a second-order cellular automaton but 2D, right?

Re: Rule with 'Memories'

Posted: December 17th, 2024, 8:47 am
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.

Re: Rule with 'Memories'

Posted: July 2nd, 2025, 7:48 pm
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

Re: Rule with 'Memories'

Posted: July 2nd, 2025, 8:57 pm
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.

Re: Rule with 'Memories'

Posted: July 3rd, 2025, 7:54 am
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?