idea for cool reversible 1d oca
- tommyaweosme
- Posts: 314
- Joined: January 15th, 2024, 9:37 am
idea for cool reversible 1d oca
for my 200th post, i will show you this
three states. black, blue, and pink.
groups are in two, and move left every generation like margolus, but for 1D.
anyway, here is an explanation of what my idea is.
0 = black
1 = blue
2 = pink
00 > 00
01 > 12
02 > 10
10 > 01
11 > 20
12 > 21
20 > 02
21 > 11
22 > 22
here is an example:
0 0|0 2|
0|0 1|0
0 1|2 0|
1|2 0|2
if there was a way to make it in lifeviewer, i would like it.
three states. black, blue, and pink.
groups are in two, and move left every generation like margolus, but for 1D.
anyway, here is an explanation of what my idea is.
0 = black
1 = blue
2 = pink
00 > 00
01 > 12
02 > 10
10 > 01
11 > 20
12 > 21
20 > 02
21 > 11
22 > 22
here is an example:
0 0|0 2|
0|0 1|0
0 1|2 0|
1|2 0|2
if there was a way to make it in lifeviewer, i would like it.
home from sleepover
Re: idea for cool reversible 1d oca
1D Margolus rules do sound interesting, I made an emulation ruletable of this one, which is the 1D equivalent of the billiard balls rule.
In fact, I wrote python implementation to simulate 1D Margolus rules. A lot of them are boring, but some of them have interesting dynamics, for example, most elementary 1D rules form down-facing triangles, however, this Margolus rule forms sideways triangles!
Which follows this rule
00 -> 10
01 -> 01
10 -> 00
11 -> 11
As for the rule you described, it shouldn't be too hard to make, however, I don't think you specified enough transitions to make into a rule. But if someone were to try, I would be curious to see the results.
EDIT: I made a mistake, you actually did specify enough transitions to complete the rule. I put it into the python implementation and ran it on a random torus of size 512. Here is the result:
Code: Select all
x = 26, y = 1, rule = 1dmargolus
DCDCDCBCDCDCDCDCDCDADCDCDC!
@RULE 1dmargolus
0 = nothing
1 = alive (even parity)
2 = alive (odd parity)
3 = dead (even parity)
4 = dead (odd parity)
red = left
blue = right
@TABLE
n_states:5
neighborhood:oneDimensional
symmetries:none
#switch parity
3,0,0,4
4,0,0,3
3,4,4,4
4,3,3,3
3,4,0,4
4,3,0,3
3,0,4,4
4,0,3,3
#rule specific transitions
#red move left
4,3,1,1
1,4,4,4
4,1,3,3
#blue move right
3,4,2,4
3,2,4,2
2,3,3,3
#bounce off eachother
2,3,1,1
1,2,4,2
1,4,2,4
2,1,3,3
#grow emulation agar
0,3,0,3
0,0,3,3
0,4,0,4
0,0,4,4
@COLORS
1 255 128 128
2 128 128 255
3 128 0 0
4 0 0 128
00 -> 10
01 -> 01
10 -> 00
11 -> 11
As for the rule you described, it shouldn't be too hard to make, however, I don't think you specified enough transitions to make into a rule. But if someone were to try, I would be curious to see the results.
EDIT: I made a mistake, you actually did specify enough transitions to complete the rule. I put it into the python implementation and ran it on a random torus of size 512. Here is the result:
Code: Select all
x=17,y=16,rule=B3/S23
3bo3bobo2bob2o$bobo4bo4b4o$bobo5bobo2b3o$b2obob2o3b2o$3o4b2ob2o2b2o$4b
o4bo$4b2obobob2ob3o$3ob3o2b2o$b3o2bobobo5bo$o3b2o3bobo2b2o$4bo3bob2o3b
o$2obo2bobobo2b2o$3b3o5bo2b2o$2obo4bo2bob2o$o3bob2obo3b2o$2bo8bobobo![[ STOP 3 GPS 4 ]]
- tommyaweosme
- Posts: 314
- Joined: January 15th, 2024, 9:37 am
Re: idea for cool reversible 1d oca
could you provide the code needed for this implement?
edit: there are only 24 2-state (edit: reversible) 1d margolus rules
edit: there are actually 4^4 (edit: 256) 2-state 1d margolus rules
edit: there are only 24 2-state (edit: reversible) 1d margolus rules
edit: there are actually 4^4 (edit: 256) 2-state 1d margolus rules
home from sleepover
Re: idea for cool reversible 1d oca
Here is the code, currently configured to run the described rule. Press E to randomize the pattern, space to pause, and R to randomize the rule. Other parameters can be changed in the code.
Code: Select all
from random import randint
#parameters
cellnum = 512
cellwidth = 1024/cellnum
cellheight = 1024/cellnum
height = 320/cellheight #number of generations to show at once
states = 3 #number of cell states
rule = {}
def randomrule():
global rule
rule = {}
for a in range(states):
for b in range(states):
rule[(a,b)] = (randint(0,states-1),randint(0,states-1))
#set the rule
rule[(0,0)] = (0,0)
rule[(0,1)] = (1,2)
rule[(0,2)] = (1,0)
rule[(1,0)] = (0,1)
rule[(1,1)] = (2,0)
rule[(1,2)] = (2,1)
rule[(2,0)] = (0,2)
rule[(2,1)] = (1,1)
rule[(2,2)] = (2,2)
cells = [randint(0,states-1) for c in range(cellnum)]
def step():
global cells
previous.append(cells)
newcells = cells[:]
for c in range(0,cellnum,2):
partion = (cells[(c+parity)%cellnum],cells[(c+parity+1)%cellnum])
newpartion = rule[(partion[0],partion[1])]
newcells[(c+parity)%cellnum] = newpartion[0]
newcells[(c+parity+1)%cellnum] = newpartion[1]
cells = newcells
#store previous generations
previous = []
def draw():
for p in range(len(previous)):
for c in range(cellnum):
'''if previous[p][c] == 0:
color = (0,0,0)
else:
color = (255/previous[p][c],
255/previous[p][c],
255/previous[p][c])'''
if previous[p][c] == 0:
color = (0,0,0)
if previous[p][c] == 1:
color = (0,128,255)
if previous[p][c] == 2:
color = (255,0,255)
pygame.draw.rect(window,color,
(c*cellwidth,p*cellheight,cellwidth,cellheight))
if len(previous)>height:
previous.pop(0)
pygame.display.flip()
import pygame
window = pygame.display.set_mode((1024,320))
pygame.display.set_caption("1D Partioning Automata")
from time import sleep
#what cell to start partioning at (0 or 1)
parity = 0
running = True
paused = False
while running:
parity = 1-parity
if not paused:
step()
draw()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_r:
#change the rule to a random one
window.fill((0,0,0))
randomrule()
previous = []
cells = [randint(0,states-1) for c in range(cellnum)]
elif event.key == pygame.K_e:
window.fill((0,0,0))
previous = []
cells = [randint(0,states-1) for c in range(cellnum)]
elif event.key == pygame.K_SPACE:
#paused the simulation
paused = not paused
pygame.quit()
Code: Select all
x=17,y=16,rule=B3/S23
3bo3bobo2bob2o$bobo4bo4b4o$bobo5bobo2b3o$b2obob2o3b2o$3o4b2ob2o2b2o$4b
o4bo$4b2obobob2ob3o$3ob3o2b2o$b3o2bobobo5bo$o3b2o3bobo2b2o$4bo3bob2o3b
o$2obo2bobobo2b2o$3b3o5bo2b2o$2obo4bo2bob2o$o3bob2obo3b2o$2bo8bobobo![[ STOP 3 GPS 4 ]]
Re: 1D margolus rules
I made some minor improvements to pipsqueek's code:
1. The program now prompts you for the torus size and the rule. Note: when it prompts you about "(x,x) becomes:", you should give two numbers without separators, like "02" (without the quotes)
2. Then, it prompts about whether or not to use a random starting condition. Type "yes" to start randomly, or "no" to start with an ordered pattern.
3. The colors now looks better.
@tommyaweosme: According to Wolfram's classification (the classification for 1D rules), your rule is class 3.
@pipsqueek: Why does the script generate slower and slower over time?
The 3-state 1D margolus rulespace is really quite interesting, here are some rules i discovered:
Strobing, symmetrical, probably class 4: Strobing, class 3: Class 2 (uninteresting, just an example of class 2 rules):
1. The program now prompts you for the torus size and the rule. Note: when it prompts you about "(x,x) becomes:", you should give two numbers without separators, like "02" (without the quotes)
2. Then, it prompts about whether or not to use a random starting condition. Type "yes" to start randomly, or "no" to start with an ordered pattern.
3. The colors now looks better.
Code: Select all
from random import randint
#parameters
cellnum = int(input("torus size: "))
cellwidth = 1024/cellnum
cellheight = 1024/cellnum
height = 320/cellheight #number of generations to show at once
states = 3 #number of cell states
rule = {}
def randomrule():
global rule
rule = {}
for a in range(states):
for b in range(states):
rule[(a,b)] = (randint(0,states-1),randint(0,states-1))
#set the rule
rule[(0,0)] = [int(n) for n in tuple(input("(0,0) becomes: "))]
rule[(0,1)] = [int(n) for n in tuple(input("(0,1) becomes: "))]
rule[(0,2)] = [int(n) for n in tuple(input("(0,2) becomes: "))]
rule[(1,0)] = [int(n) for n in tuple(input("(1,0) becomes: "))]
rule[(1,1)] = [int(n) for n in tuple(input("(1,1) becomes: "))]
rule[(1,2)] = [int(n) for n in tuple(input("(1,2) becomes: "))]
rule[(2,0)] = [int(n) for n in tuple(input("(2,0) becomes: "))]
rule[(2,1)] = [int(n) for n in tuple(input("(2,1) becomes: "))]
rule[(2,2)] = [int(n) for n in tuple(input("(2,2) becomes: "))]
if input("randomize pattern? ").lower() == 'yes':
cells = [randint(0,states-1) for c in range(cellnum)]
else:
cells = [0] * (cellnum // 2) + [1] * (cellnum // 2)
def step():
global cells
previous.append(cells)
newcells = cells[:]
for c in range(0,cellnum,2):
partion = (cells[(c+parity)%cellnum],cells[(c+parity+1)%cellnum])
newpartion = rule[(partion[0],partion[1])]
newcells[(c+parity)%cellnum] = newpartion[0]
newcells[(c+parity+1)%cellnum] = newpartion[1]
cells = newcells
#store previous generations
previous = []
def draw():
for p in range(len(previous)):
for c in range(cellnum):
'''if previous[p][c] == 0:
color = (0,0,0)
else:
color = (255/previous[p][c],
255/previous[p][c],
255/previous[p][c])'''
if previous[p][c] == 0:
color = (0,0,0)
if previous[p][c] == 1:
color = (255,255,255)
if previous[p][c] == 2:
color = (0,255,0)
pygame.draw.rect(window,color,
(c*cellwidth,p*cellheight,cellwidth,cellheight))
if len(previous)>height:
previous.pop(0)
pygame.display.flip()
import pygame
window = pygame.display.set_mode((1024,320))
pygame.display.set_caption("1D Partioning Automata")
from time import sleep
#what cell to start partioning at (0 or 1)
parity = 0
running = True
paused = False
while running:
parity = 1-parity
if not paused:
step()
draw()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_r:
#change the rule to a random one
window.fill((0,0,0))
randomrule()
previous = []
cells = [randint(0,states-1) for c in range(cellnum)]
elif event.key == pygame.K_e:
window.fill((0,0,0))
previous = []
cells = [randint(0,states-1) for c in range(cellnum)]
elif event.key == pygame.K_SPACE:
#paused the simulation
paused = not paused
pygame.quit()
@pipsqueek: Why does the script generate slower and slower over time?
The 3-state 1D margolus rulespace is really quite interesting, here are some rules i discovered:
Strobing, symmetrical, probably class 4: Strobing, class 3: Class 2 (uninteresting, just an example of class 2 rules):
- Attachments
-
- Example class 2 3-state 1D margolus
- 1dmarg3.png (21.89 KiB) Viewed 463 times
Wiki: User:iddi01
I'm making a poll. please contribute.
First gun i constructed:
I'm making a poll. please contribute.
First gun i constructed:
Code: Select all
x = 69, y = 69, rule = B3-n/S1e2-a3-e4e
2$32b3o$32bobo$32bobo$32b3o27$63b4o$b4o58bo2bo$bo2bo23bo4b2o28b4o$b4o
21bobo$28bo21$35bo$34b3o6$33b3o$33bobo$33bobo$33b3o!
Re: 1D margolus rules
Each row on screen is 1 generation of the pattern. These generations are stored in one big array and displayed on the screen. When the program first starts, it doesn't have many rows in the array, so it draws it quickly. But when the entire screen is filled, it gets slow (it shouldn't get any slower, as the top row is removed when it's out of view). It could be made faster by storing the generations as pixels on the screen. Make the following modifications to the code to do so:
Code: Select all
cells = [randint(0,states-1) for c in range(cellnum)]
def step():
global cells
newcells = cells[:]
for c in range(0,cellnum,2):
partion = (cells[(c+parity)%cellnum],cells[(c+parity+1)%cellnum])
newpartion = rule[(partion[0],partion[1])]
newcells[(c+parity)%cellnum] = newpartion[0]
newcells[(c+parity+1)%cellnum] = newpartion[1]
cells = newcells
def draw():
window.scroll(dy=-int(cellheight))
#for p in range(len(previous)):
for c in range(cellnum):
if cells[c] == 0:
color = (0,0,0)
else:
color = (255/cells[c],
255/cells[c],
255/cells[c])
pygame.draw.rect(window,color,
(c*cellwidth,320-int(cellheight),cellwidth,cellheight))
pygame.display.flip()
Code: Select all
x=17,y=16,rule=B3/S23
3bo3bobo2bob2o$bobo4bo4b4o$bobo5bobo2b3o$b2obob2o3b2o$3o4b2ob2o2b2o$4b
o4bo$4b2obobob2ob3o$3ob3o2b2o$b3o2bobobo5bo$o3b2o3bobo2b2o$4bo3bob2o3b
o$2obo2bobobo2b2o$3b3o5bo2b2o$2obo4bo2bob2o$o3bob2obo3b2o$2bo8bobobo![[ STOP 3 GPS 4 ]]
- tommyaweosme
- Posts: 314
- Joined: January 15th, 2024, 9:37 am
Re: idea for cool reversible 1d oca
the code has random end of line markers. can you fix that please?
home from sleepover
Re: idea for cool reversible 1d oca
Do you mean the newline character? Those are just for readability. The code runs fine with or without them. Without them it would be this:tommyaweosme wrote: ↑April 30th, 2024, 4:41 pmthe code has random end of line markers. can you fix that please?
Code: Select all
cells = [randint(0,states-1) for c in range(cellnum)]
def step():
global cells
newcells = cells[:]
for c in range(0,cellnum,2):
partion = (cells[(c+parity)%cellnum],cells[(c+parity+1)%cellnum])
newpartion = rule[(partion[0],partion[1])]
newcells[(c+parity)%cellnum] = newpartion[0]
newcells[(c+parity+1)%cellnum] = newpartion[1]
cells = newcells
def draw():
window.scroll(dy=-int(cellheight))
for c in range(cellnum):
if cells[c] == 0:
color = (0,0,0)
else:
color = (255/cells[c],255/cells[c],255/cells[c])
pygame.draw.rect(window,color,(c*cellwidth,320-int(cellheight),cellwidth,cellheight))
pygame.display.flip()
Code: Select all
x=17,y=16,rule=B3/S23
3bo3bobo2bob2o$bobo4bo4b4o$bobo5bobo2b3o$b2obob2o3b2o$3o4b2ob2o2b2o$4b
o4bo$4b2obobob2ob3o$3ob3o2b2o$b3o2bobobo5bo$o3b2o3bobo2b2o$4bo3bob2o3b
o$2obo2bobobo2b2o$3b3o5bo2b2o$2obo4bo2bob2o$o3bob2obo3b2o$2bo8bobobo![[ STOP 3 GPS 4 ]]
- tommyaweosme
- Posts: 314
- Joined: January 15th, 2024, 9:37 am
Re: idea for cool reversible 1d oca
i meant the first two scripts posted here
edit: i mean end of file
edit: it was a problem with the compiler i was using
edit: i mean end of file
edit: it was a problem with the compiler i was using
home from sleepover
Re: idea for cool reversible 1d oca
When I run the script in Python 3.11 it gives this error:
Can someone update the script for Python 3?
Code: Select all
Traceback (most recent call last):
File "wxpython.cpp", line 3, in <module>
File "C:\Users\User\AppData\Roaming\Golly\golly_clip.py", line 5, in <module>
cellnum = int(input("torus size: "))
^^^^^^^^^^^^^^^^^^^^^
RuntimeError: input(): lost sys.stdin
My rules
-
100th post: 18 November 2023
1000th post: 8 March 2024
10000th post:
-
Warning: This user has grammar issues, and auto-capitalize everything he clicked.
-
100th post: 18 November 2023
1000th post: 8 March 2024
10000th post:
-
Warning: This user has grammar issues, and auto-capitalize everything he clicked.
Re: idea for cool reversible 1d oca
The script should run fine in python 3, but it's not intended to be run in Golly. Instead, you should run the script with Python from a command line or using IDLE, or whichever IDE you have/use for Python. You will also need the pygame module installed.b-engine wrote: ↑April 30th, 2024, 11:16 pmWhen I run the script in Python 3.11 it gives this error:Can someone update the script for Python 3?Code: Select all
Traceback (most recent call last): File "wxpython.cpp", line 3, in <module> File "C:\Users\User\AppData\Roaming\Golly\golly_clip.py", line 5, in <module> cellnum = int(input("torus size: ")) ^^^^^^^^^^^^^^^^^^^^^ RuntimeError: input(): lost sys.stdin
The 5S project (Smallest Spaceships Supporting Specific Speeds) is now maintained by AforAmpere. The latest collection is hosted on GitHub and contains well over 1,000,000 spaceships.
Semi-active here - recovering from a severe case of LWTDS.
Semi-active here - recovering from a severe case of LWTDS.
Re: idea for cool reversible 1d oca
I made a small error in the code, the parity switches when it is paused. Which means the evolution of a pattern changes when you pause. To prevent this, just replace this:
with this:
Code: Select all
parity = 1-parity
if not paused:
step()
draw()
Code: Select all
if not paused:
parity = 1-parity
step()
draw()
Code: Select all
x=17,y=16,rule=B3/S23
3bo3bobo2bob2o$bobo4bo4b4o$bobo5bobo2b3o$b2obob2o3b2o$3o4b2ob2o2b2o$4b
o4bo$4b2obobob2ob3o$3ob3o2b2o$b3o2bobobo5bo$o3b2o3bobo2b2o$4bo3bob2o3b
o$2obo2bobobo2b2o$3b3o5bo2b2o$2obo4bo2bob2o$o3bob2obo3b2o$2bo8bobobo![[ STOP 3 GPS 4 ]]
- tommyaweosme
- Posts: 314
- Joined: January 15th, 2024, 9:37 am
Re: idea for cool reversible 1d oca
thats ok. im not planning to pause on a m-
anyway, im not planning to pause on a margolus 1d oca, so that doesnt matter
any script for 2-state 1d margolus oca?
that was weirdtommyaweosme j.16.24. wrote:-OPEN, CL-
anyway, im not planning to pause on a margolus 1d oca, so that doesnt matter
any script for 2-state 1d margolus oca?
home from sleepover
- unname4798
- Posts: 542
- Joined: July 15th, 2023, 10:27 am
Re: idea for cool reversible 1d oca
Too complex for me.tommyaweosme wrote: ↑May 4th, 2024, 1:59 pmthats ok. im not planning to pause on a m-
that was weirdtommyaweosme j.16.24. wrote:-OPEN, CL-
anyway, im not planning to pause on a margolus 1d oca, so that doesnt matter
any script for 2-state 1d margolus oca?
- tommyaweosme
- Posts: 314
- Joined: January 15th, 2024, 9:37 am
Re: idea for cool reversible 1d oca
IM JUST ASKING YOU TO REMOVE A STATE. AND I AM ASKING THE ENTIRE POPULATION OF CONWAYLIFE.COM, NOT JUST YOU!unname4798 wrote: ↑May 4th, 2024, 2:13 pmToo complex for me.tommyaweosme wrote: ↑May 4th, 2024, 1:59 pmthats ok. im not planning to pause on a m-
that was weirdtommyaweosme j.16.24. wrote:-OPEN, CL-
anyway, im not planning to pause on a margolus 1d oca, so that doesnt matter
any script for 2-state 1d margolus oca?
sorry for snaping. im just really tired of this.
ok, i will move the tommyaweosme lore clues to a sandbox thread. unless january 16 tommyaweosme comes back...hidden lore tinley wrote:tommyaweosme, you should probably move this to a sandbox thread
back on topic, it seems like someone already made it, so if someone could please post it please do! :D
home from sleepover
Re: idea for cool reversible 1d oca
You didn't notice this part of the code?tommyaweosme wrote: ↑May 4th, 2024, 2:16 pmback on topic, it seems like someone already made it, so if someone could please post it please do! :D
Code: Select all
states = 3 #number of cell states
Code: Select all
#old coloring
if cells[c] == 0:
color = (0,0,0)
else:
color = (255/cells[c],
255/cells[c],
255/cells[c])
Code: Select all
#same thing, but for 2 states
rule[(0,0)] = [int(n) for n in tuple(input("(0,0) becomes: "))]
rule[(0,1)] = [int(n) for n in tuple(input("(0,1) becomes: "))]
rule[(1,0)] = [int(n) for n in tuple(input("(1,0) becomes: "))]
rule[(1,1)] = [int(n) for n in tuple(input("(1,1) becomes: "))]
Code: Select all
for a in range(states):
for b in range(states):
i = input(f"({a},{b}) becomes:")
c,d = i.split(',')
c,d = int(c),int(d)
rule[(a,b)] = (c,d)
Code: Select all
x=17,y=16,rule=B3/S23
3bo3bobo2bob2o$bobo4bo4b4o$bobo5bobo2b3o$b2obob2o3b2o$3o4b2ob2o2b2o$4b
o4bo$4b2obobob2ob3o$3ob3o2b2o$b3o2bobobo5bo$o3b2o3bobo2b2o$4bo3bob2o3b
o$2obo2bobobo2b2o$3b3o5bo2b2o$2obo4bo2bob2o$o3bob2obo3b2o$2bo8bobobo![[ STOP 3 GPS 4 ]]
Re: 1D margolus rules
I made 2 scripts which would allow the exploration of 3-state 1D margolus rules in Golly:
1. This script generates a ruletable like this one, It can be run in shell or Golly.
Type a rulestring using a simple notation: For each 2-cell configuration, type what it becomes using 2 numbers without separators, type a comma, then type what the next configuration becomes in the same way. The order for initial configurations are 00,01,02,10,11,12,20,21,22.
Example: tommyaweosme's rule would be encoded as "00,12,10,01,20,21,02,11,22".
You can choose to generate a true 1D rule or a 2D emulation.
2. This script generates a 512x1 3-state margolus soup. It can be run in shell or Golly.
This rulespace turned out to be more interesting than i thought. I've discovered a bunch of interesting rules, which are likely all class 4:
(Note that the ruletables below are all 2D emulation.)
00,21,02,20,00,21,10,12,22 generates adjustable-speed spaceships that interact in complex ways:
00,20,01,02,11,12,10,21,11 has small reflectors and overall complex behavior:
Even though nothing changes every generation except same-color blocks in 11,01,02,10,22,12,20,21,00, it still has complex behavior:
00,12,10,21,02,12,01,21,00 may look explosive at first, but it's still class 4:
00,10,02,01,22,12,20,21,11 is population-conserving, but the behavior seems to be more complex than the aforementioned rules:
00,11,12,10,12,21,22,21,02 is one of the sideways triangles rules, and not explosive:
1. This script generates a ruletable like this one, It can be run in shell or Golly.
Type a rulestring using a simple notation: For each 2-cell configuration, type what it becomes using 2 numbers without separators, type a comma, then type what the next configuration becomes in the same way. The order for initial configurations are 00,01,02,10,11,12,20,21,22.
Example: tommyaweosme's rule would be encoded as "00,12,10,01,20,21,02,11,22".
You can choose to generate a true 1D rule or a 2D emulation.
Code: Select all
def gen1dmargtable(rulestring):
transitions = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]
x = 0
y = 0
for char in rulestring:
if char == ' ':
pass
elif char == ',':
x = 0
y += 1
else:
transitions[y][x] = int(char)
x += 1
if __name__ == '__main__':
emulation = input("True 1D or emulation by 2D (1D/2D)? ").upper() == "2D"
else:
emulation = golly.getstring("True 1D or emulation by 2D (1D/2D)? ", "1D").upper() == "2D"
if emulation:
temp = "0,%s,%s,0,0,0,0,0,%s,%s\n"
else:
temp = "%s,%s,%s,%s\n"
table = """@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:%s
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
""" % ("Moore" if emulation else "oneDimensional")
for n in range(9):
table += temp % (n // 3, 'a', n % 3 + 3, transitions[n][0] + 3)
if n % 3 == 2:
table += temp % (n // 3, 'a', 'b', transitions[n-2][0] + 3)
if n == 2:
table += temp % ('0','b','a',transitions[0][0] + 3)
for n in range(9):
table += temp % (n % 3 + 3, n // 3, 'a', transitions[n][1])
if n >= 6:
table += temp % (n % 3 + 3, 'b', 'a', transitions[n-6][1])
table += """
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
"""
return table
if __name__ == '__main__':
rulestring = input('Type a rulestring, in the format "xx,xx,xx,xx,xx,xx,xx,xx,xx": ')
print(gen1dmargtable(rulestring))
else:
import golly
rulestring = golly.getstring('Type a rulestring, in the format "xx,xx,xx,xx,xx,xx,xx,xx,xx": ','00,01,02,10,11,12,20,21,22')
try:
f = open(golly.getdir('rules') + "1dmargtest.rule", 'r')
golly.warn("""1dmargtest.rule already exists.
Please rename the file and try again.""")
golly.exit()
except FileNotFoundError:
f = open(golly.getdir('rules') + "1dmargtest.rule", 'w')
f.write(gen1dmargtable(rulestring))
f.close()
golly.setrule('1dmargtest')
Code: Select all
import random
def gen1dmargsoup():
char = ['.', 'A', 'B', 'C', 'D', 'E']
rle = "x = 512, y = 1, rule = 1dmargtest\n"
for n in range(512):
rle += char[n % 2 * 3 + random.randrange(3)]
return rle
if __name__ == '__main__':
print(gen1dmargsoup())
else:
import golly
golly.setclipstr(gen1dmargsoup())
golly.paste(0,0,"or")
(Note that the ruletables below are all 2D emulation.)
00,21,02,20,00,21,10,12,22 generates adjustable-speed spaceships that interact in complex ways:
Code: Select all
x = 513, y = 1, rule = 1dmargtest
BDBC.EADADBEBDBDACBEAEBC.EAC.DACBDADAEBDADBEACBEADADBEAEACADAEADAEAD.
DBEBDBDAEBDBDBCBEAEBEBCACBCACACACBE.E.DBEACBDBEACBE.EACBCBCAEACAEBCBC
BDACAE.EBCBDADACBCACADAEBEBCBDAEBC.EBDADBEBEBEBEAC.CBEBDADBEACADBEAC.
DBEBCBEACACADBCACBDACBEACAEAEAEACACBCBDAD.EAEAEAEAEACAEACBD.EACBEBCBC
BE.EBDAEACBDBDBEBDBDBEAEAEBEBCADACBCADBEACAC.CACACBCBDACBDAEBDBCBDBEB
DAEBE.CBCBDBC.D.DAEADADBCBEBCBDAEBDBEBDBCBEACBCADBC.DBDAEBDACAEACADBE
AEADBCBCADAEBCBCBCADBDADBDBDBCBCAEBCBEBCBD.DAEADBEBEADBEADADAE.EBCBEA
EBDBDACBEAE.E.EBD.EADBEBEBCAD!
@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:Moore
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
0,0,a,0,0,0,0,0,3,3
0,0,a,0,0,0,0,0,4,5
0,0,a,0,0,0,0,0,5,3
0,0,a,0,0,0,0,0,b,3
0,0,b,0,0,0,0,0,a,3
0,1,a,0,0,0,0,0,3,5
0,1,a,0,0,0,0,0,4,3
0,1,a,0,0,0,0,0,5,5
0,1,a,0,0,0,0,0,b,5
0,2,a,0,0,0,0,0,3,4
0,2,a,0,0,0,0,0,4,4
0,2,a,0,0,0,0,0,5,5
0,2,a,0,0,0,0,0,b,4
0,3,0,0,0,0,0,0,a,0
0,4,0,0,0,0,0,0,a,1
0,5,0,0,0,0,0,0,a,2
0,3,1,0,0,0,0,0,a,0
0,4,1,0,0,0,0,0,a,0
0,5,1,0,0,0,0,0,a,1
0,3,2,0,0,0,0,0,a,0
0,3,b,0,0,0,0,0,a,0
0,4,2,0,0,0,0,0,a,2
0,4,b,0,0,0,0,0,a,1
0,5,2,0,0,0,0,0,a,2
0,5,b,0,0,0,0,0,a,2
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
#C [[ ZOOM 1 ]]
Code: Select all
x = 513, y = 1, rule = 1dmargtest
BDBC.EADADBEBDBDACBEAEBC.EAC.DACBDADAEBDADBEACBEADADBEAEACADAEADAEAD.
DBEBDBDAEBDBDBCBEAEBEBCACBCACACACBE.E.DBEACBDBEACBE.EACBCBCAEACAEBCBC
BDACAE.EBCBDADACBCACADAEBEBCBDAEBC.EBDADBEBEBEBEAC.CBEBDADBEACADBEAC.
DBEBCBEACACADBCACBDACBEACAEAEAEACACBCBDAD.EAEAEAEAEACAEACBD.EACBEBCBC
BE.EBDAEACBDBDBEBDBDBEAEAEBEBCADACBCADBEACAC.CACACBCBDACBDAEBDBCBDBEB
DAEBE.CBCBDBC.D.DAEADADBCBEBCBDAEBDBEBDBCBEACBCADBC.DBDAEBDACAEACADBE
AEADBCBCADAEBCBCBCADBDADBDBDBCBCAEBCBEBCBD.DAEADBEBEADBEADADAE.EBCBEA
EBDBDACBEAE.E.EBD.EADBEBEBCAD!
@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:Moore
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
0,0,a,0,0,0,0,0,3,3
0,0,a,0,0,0,0,0,4,5
0,0,a,0,0,0,0,0,5,3
0,0,a,0,0,0,0,0,b,3
0,0,b,0,0,0,0,0,a,3
0,1,a,0,0,0,0,0,3,3
0,1,a,0,0,0,0,0,4,4
0,1,a,0,0,0,0,0,5,4
0,1,a,0,0,0,0,0,b,3
0,2,a,0,0,0,0,0,3,4
0,2,a,0,0,0,0,0,4,5
0,2,a,0,0,0,0,0,5,4
0,2,a,0,0,0,0,0,b,4
0,3,0,0,0,0,0,0,a,0
0,4,0,0,0,0,0,0,a,0
0,5,0,0,0,0,0,0,a,1
0,3,1,0,0,0,0,0,a,2
0,4,1,0,0,0,0,0,a,1
0,5,1,0,0,0,0,0,a,2
0,3,2,0,0,0,0,0,a,0
0,3,b,0,0,0,0,0,a,0
0,4,2,0,0,0,0,0,a,1
0,4,b,0,0,0,0,0,a,0
0,5,2,0,0,0,0,0,a,1
0,5,b,0,0,0,0,0,a,1
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
#C [[ ZOOM 1 ]]
Code: Select all
x = 513, y = 1, rule = 1dmargtest
BDBC.EADADBEBDBDACBEAEBC.EAC.DACBDADAEBDADBEACBEADADBEAEACADAEADAEAD.
DBEBDBDAEBDBDBCBEAEBEBCACBCACACACBE.E.DBEACBDBEACBE.EACBCBCAEACAEBCBC
BDACAE.EBCBDADACBCACADAEBEBCBDAEBC.EBDADBEBEBEBEAC.CBEBDADBEACADBEAC.
DBEBCBEACACADBCACBDACBEACAEAEAEACACBCBDAD.EAEAEAEAEACAEACBD.EACBEBCBC
BE.EBDAEACBDBDBEBDBDBEAEAEBEBCADACBCADBEACAC.CACACBCBDACBDAEBDBCBDBEB
DAEBE.CBCBDBC.D.DAEADADBCBEBCBDAEBDBEBDBCBEACBCADBC.DBDAEBDACAEACADBE
AEADBCBCADAEBCBCBCADBDADBDBDBCBCAEBCBEBCBD.DAEADBEBEADBEADADAE.EBCBEA
EBDBDACBEAE.E.EBD.EADBEBEBCAD!
@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:Moore
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
0,0,a,0,0,0,0,0,3,4
0,0,a,0,0,0,0,0,4,3
0,0,a,0,0,0,0,0,5,3
0,0,a,0,0,0,0,0,b,4
0,0,b,0,0,0,0,0,a,4
0,1,a,0,0,0,0,0,3,4
0,1,a,0,0,0,0,0,4,5
0,1,a,0,0,0,0,0,5,4
0,1,a,0,0,0,0,0,b,4
0,2,a,0,0,0,0,0,3,5
0,2,a,0,0,0,0,0,4,5
0,2,a,0,0,0,0,0,5,3
0,2,a,0,0,0,0,0,b,5
0,3,0,0,0,0,0,0,a,1
0,4,0,0,0,0,0,0,a,1
0,5,0,0,0,0,0,0,a,2
0,3,1,0,0,0,0,0,a,0
0,4,1,0,0,0,0,0,a,2
0,5,1,0,0,0,0,0,a,2
0,3,2,0,0,0,0,0,a,0
0,3,b,0,0,0,0,0,a,1
0,4,2,0,0,0,0,0,a,1
0,4,b,0,0,0,0,0,a,1
0,5,2,0,0,0,0,0,a,0
0,5,b,0,0,0,0,0,a,2
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
#C [[ ZOOM 1 ]]
Code: Select all
x = 513, y = 1, rule = 1dmargtest
BDBC.EADADBEBDBDACBEAEBC.EAC.DACBDADAEBDADBEACBEADADBEAEACADAEADAEAD.
DBEBDBDAEBDBDBCBEAEBEBCACBCACACACBE.E.DBEACBDBEACBE.EACBCBCAEACAEBCBC
BDACAE.EBCBDADACBCACADAEBEBCBDAEBC.EBDADBEBEBEBEAC.CBEBDADBEACADBEAC.
DBEBCBEACACADBCACBDACBEACAEAEAEACACBCBDAD.EAEAEAEAEACAEACBD.EACBEBCBC
BE.EBDAEACBDBDBEBDBDBEAEAEBEBCADACBCADBEACAC.CACACBCBDACBDAEBDBCBDBEB
DAEBE.CBCBDBC.D.DAEADADBCBEBCBDAEBDBEBDBCBEACBCADBC.DBDAEBDACAEACADBE
AEADBCBCADAEBCBCBCADBDADBDBDBCBCAEBCBEBCBD.DAEADBEBEADBEADADAE.EBCBEA
EBDBDACBEAE.E.EBD.EADBEBEBCAD!
@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:Moore
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
0,0,a,0,0,0,0,0,3,3
0,0,a,0,0,0,0,0,4,4
0,0,a,0,0,0,0,0,5,4
0,0,a,0,0,0,0,0,b,3
0,0,b,0,0,0,0,0,a,3
0,1,a,0,0,0,0,0,3,5
0,1,a,0,0,0,0,0,4,3
0,1,a,0,0,0,0,0,5,4
0,1,a,0,0,0,0,0,b,5
0,2,a,0,0,0,0,0,3,3
0,2,a,0,0,0,0,0,4,5
0,2,a,0,0,0,0,0,5,3
0,2,a,0,0,0,0,0,b,3
0,3,0,0,0,0,0,0,a,0
0,4,0,0,0,0,0,0,a,2
0,5,0,0,0,0,0,0,a,0
0,3,1,0,0,0,0,0,a,1
0,4,1,0,0,0,0,0,a,2
0,5,1,0,0,0,0,0,a,2
0,3,2,0,0,0,0,0,a,1
0,3,b,0,0,0,0,0,a,0
0,4,2,0,0,0,0,0,a,1
0,4,b,0,0,0,0,0,a,2
0,5,2,0,0,0,0,0,a,0
0,5,b,0,0,0,0,0,a,0
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
#C [[ ZOOM 1 ]]
Code: Select all
x = 513, y = 1, rule = 1dmargtest
BDBC.EADADBEBDBDACBEAEBC.EAC.DACBDADAEBDADBEACBEADADBEAEACADAEADAEAD.
DBEBDBDAEBDBDBCBEAEBEBCACBCACACACBE.E.DBEACBDBEACBE.EACBCBCAEACAEBCBC
BDACAE.EBCBDADACBCACADAEBEBCBDAEBC.EBDADBEBEBEBEAC.CBEBDADBEACADBEAC.
DBEBCBEACACADBCACBDACBEACAEAEAEACACBCBDAD.EAEAEAEAEACAEACBD.EACBEBCBC
BE.EBDAEACBDBDBEBDBDBEAEAEBEBCADACBCADBEACAC.CACACBCBDACBDAEBDBCBDBEB
DAEBE.CBCBDBC.D.DAEADADBCBEBCBDAEBDBEBDBCBEACBCADBC.DBDAEBDACAEACADBE
AEADBCBCADAEBCBCBCADBDADBDBDBCBCAEBCBEBCBD.DAEADBEBEADBEADADAE.EBCBEA
EBDBDACBEAE.E.EBD.EADBEBEBCAD!
@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:Moore
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
0,0,a,0,0,0,0,0,3,3
0,0,a,0,0,0,0,0,4,4
0,0,a,0,0,0,0,0,5,3
0,0,a,0,0,0,0,0,b,3
0,0,b,0,0,0,0,0,a,3
0,1,a,0,0,0,0,0,3,3
0,1,a,0,0,0,0,0,4,5
0,1,a,0,0,0,0,0,5,4
0,1,a,0,0,0,0,0,b,3
0,2,a,0,0,0,0,0,3,5
0,2,a,0,0,0,0,0,4,5
0,2,a,0,0,0,0,0,5,4
0,2,a,0,0,0,0,0,b,5
0,3,0,0,0,0,0,0,a,0
0,4,0,0,0,0,0,0,a,0
0,5,0,0,0,0,0,0,a,2
0,3,1,0,0,0,0,0,a,1
0,4,1,0,0,0,0,0,a,2
0,5,1,0,0,0,0,0,a,2
0,3,2,0,0,0,0,0,a,0
0,3,b,0,0,0,0,0,a,0
0,4,2,0,0,0,0,0,a,1
0,4,b,0,0,0,0,0,a,0
0,5,2,0,0,0,0,0,a,1
0,5,b,0,0,0,0,0,a,2
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
#C [[ ZOOM 1 ]]
Code: Select all
x = 513, y = 1, rule = 1dmargtest
BDBC.EADADBEBDBDACBEAEBC.EAC.DACBDADAEBDADBEACBEADADBEAEACADAEADAEAD.
DBEBDBDAEBDBDBCBEAEBEBCACBCACACACBE.E.DBEACBDBEACBE.EACBCBCAEACAEBCBC
BDACAE.EBCBDADACBCACADAEBEBCBDAEBC.EBDADBEBEBEBEAC.CBEBDADBEACADBEAC.
DBEBCBEACACADBCACBDACBEACAEAEAEACACBCBDAD.EAEAEAEAEACAEACBD.EACBEBCBC
BE.EBDAEACBDBDBEBDBDBEAEAEBEBCADACBCADBEACAC.CACACBCBDACBDAEBDBCBDBEB
DAEBE.CBCBDBC.D.DAEADADBCBEBCBDAEBDBEBDBCBEACBCADBC.DBDAEBDACAEACADBE
AEADBCBCADAEBCBCBCADBDADBDBDBCBCAEBCBEBCBD.DAEADBEBEADBEADADAE.EBCBEA
EBDBDACBEAE.E.EBD.EADBEBEBCAD!
@RULE 1dmargtest
@TABLE
n_states:6
neighborhood:Moore
symmetries:none
var a = {0,1,2,3,4,5}
var b = {1,2,3,4,5}
0,0,a,0,0,0,0,0,3,3
0,0,a,0,0,0,0,0,4,4
0,0,a,0,0,0,0,0,5,4
0,0,a,0,0,0,0,0,b,3
0,0,b,0,0,0,0,0,a,3
0,1,a,0,0,0,0,0,3,4
0,1,a,0,0,0,0,0,4,4
0,1,a,0,0,0,0,0,5,5
0,1,a,0,0,0,0,0,b,4
0,2,a,0,0,0,0,0,3,5
0,2,a,0,0,0,0,0,4,5
0,2,a,0,0,0,0,0,5,3
0,2,a,0,0,0,0,0,b,5
0,3,0,0,0,0,0,0,a,0
0,4,0,0,0,0,0,0,a,1
0,5,0,0,0,0,0,0,a,2
0,3,1,0,0,0,0,0,a,0
0,4,1,0,0,0,0,0,a,2
0,5,1,0,0,0,0,0,a,1
0,3,2,0,0,0,0,0,a,2
0,3,b,0,0,0,0,0,a,0
0,4,2,0,0,0,0,0,a,1
0,4,b,0,0,0,0,0,a,1
0,5,2,0,0,0,0,0,a,2
0,5,b,0,0,0,0,0,a,2
@COLORS
0 62 62 62
1 220 220 220
2 0 220 0
3 90 90 90
4 255 255 255
5 0 255 0
#C [[ ZOOM 1 ]]
I totally agree. If you look at my last post in here (and this post), you'll see that it says "Re: 1D margolus rules".
Wiki: User:iddi01
I'm making a poll. please contribute.
First gun i constructed:
I'm making a poll. please contribute.
First gun i constructed:
Code: Select all
x = 69, y = 69, rule = B3-n/S1e2-a3-e4e
2$32b3o$32bobo$32bobo$32b3o27$63b4o$b4o58bo2bo$bo2bo23bo4b2o28b4o$b4o
21bobo$28bo21$35bo$34b3o6$33b3o$33bobo$33bobo$33b3o!