CAViewer - A Cellular Automaton Simulator written in Java
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
You can load the .ca_rule file is the other file format used by the application.
There is a dropdown in the open rule menu to open .ca_rule file format.
There is a dropdown in the open rule menu to open .ca_rule file format.
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Re: CAViewer - A Cellular Automaton Simulator written in Python
The load rule design is clumsy! This is a direct result of pattern files not including a rule family name together with parameters defining the specific rule within the family. If this design were implemented, there would be no need for a load rule command since the load pattern command can select the correct rule before loading the pattern. Such a design would also substantially reduce the number of transFunc.py and rule.ca_rule files that your program must manage. In fact these files could be replaced by inherited rule class objects. See my suggestions in previous posts.
Brian Prentice
Brian Prentice
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
Update v1.10:
Double Totalistic B/S Condition is both supported by Regenerating Generations Rulespace and BSFKL Rulespace
Improved Replicator Identification Function
Fixed Title Bug
Added New Rules to Rules Folder:
BSFKLDouble_Rule_1 has a 16c/66 diagonal linear replicator (what helped me figure out the error in the identification function)
Also has c and c/2 spaceships and an oscillator that looks like a figure 8.
Any feedback and bug reports are welcome!
For most if not all rules in the sample rules folder can be directly loaded by opening the pattern.
If not an error is raised and the user is asked to open the relevant rule. Afterwards, that rule is also added to the RecordedRules folder and you can just open patterns with that rule name directly.
I chose this load rule design as it mirrors what golly does so it will be easier for the community to use (as everyone uses golly).
Next update I may implement a new pattern format that includes the rule as well as the pattern inside the same file.
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code Only:
Renamed BokaBB to Double Totalistic as suggested by bubblegumbubblegum wrote: ↑April 26th, 2020, 2:12 amDouble-totalistic?lemon41625 wrote: ↑April 26th, 2020, 1:02 amBtw, I was hoping that the rulespace could be given a name.
Double Totalistic B/S Condition is both supported by Regenerating Generations Rulespace and BSFKL Rulespace
Improved Replicator Identification Function
Fixed Title Bug
Added New Rules to Rules Folder:
BSFKLDouble_Rule_1 has a 16c/66 diagonal linear replicator (what helped me figure out the error in the identification function)
Also has c and c/2 spaceships and an oscillator that looks like a figure 8.
Any feedback and bug reports are welcome!
Something similar has already been done. Previously opened rules are placed in the RecordedRules Folder.bprentice wrote: ↑April 26th, 2020, 11:22 amThe load rule design is clumsy! This is a direct result of pattern files not including a rule family name together with parameters defining the specific rule within the family. If this design were implemented, there would be no need for a load rule command since the load pattern command can select the correct rule before loading the pattern. Such a design would also substantially reduce the number of transFunc.py and rule.ca_rule files that your program must manage. In fact these files could be replaced by inherited rule class objects. See my suggestions in previous posts.
Brian Prentice
For most if not all rules in the sample rules folder can be directly loaded by opening the pattern.
If not an error is raised and the user is asked to open the relevant rule. Afterwards, that rule is also added to the RecordedRules folder and you can just open patterns with that rule name directly.
I chose this load rule design as it mirrors what golly does so it will be easier for the community to use (as everyone uses golly).
Next update I may implement a new pattern format that includes the rule as well as the pattern inside the same file.
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code Only:
- Attachments
-
- CAViewer.zip
- (2.89 MiB) Downloaded 195 times
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
Update v1.11:
Added .ca_pattern format for patterns.
It looks like this: (Ignore the invalid rle at the bottom)
Name: Regenerating_Rule_1
Neighbourhood Range: 2
Neighbourhood:
0,0,1,0,0
0,3,3,3,0
1,3,0,3,1
0,3,3,3,0
0,0,1,0,0
State Weights: 0,1,0,0
Rulespace: Regenerating Generations
B/S Conditions: Outer Totalistic
Rulestring: rg4l1b7,8,9,11,12,20,25,27s5,6,9,10,20rb9rs7,11,15,24,27
Colour Palette:
None
**********
x = 637, y = 574, rule = Regenerating_Rule_1
389.A247.$388.3A246!
Added Rhombic's Geneascopy (Only Average Total Population Avaliable for Now)
Added Population Data Download
Added RegeneratingWeighed_Rule_1 to Sample Rules Folder
Bug reports and feedback are appreciated!
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code Only:
Added .ca_pattern format for patterns.
It looks like this: (Ignore the invalid rle at the bottom)
Name: Regenerating_Rule_1
Neighbourhood Range: 2
Neighbourhood:
0,0,1,0,0
0,3,3,3,0
1,3,0,3,1
0,3,3,3,0
0,0,1,0,0
State Weights: 0,1,0,0
Rulespace: Regenerating Generations
B/S Conditions: Outer Totalistic
Rulestring: rg4l1b7,8,9,11,12,20,25,27s5,6,9,10,20rb9rs7,11,15,24,27
Colour Palette:
None
**********
x = 637, y = 574, rule = Regenerating_Rule_1
389.A247.$388.3A246!
Added Rhombic's Geneascopy (Only Average Total Population Avaliable for Now)
Added Population Data Download
Added RegeneratingWeighed_Rule_1 to Sample Rules Folder
Bug reports and feedback are appreciated!
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code Only:
- Attachments
-
- CAViewer.zip
- (2.85 MiB) Downloaded 184 times
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
Update v1.12:
Added Grid Lines
Fixed some bugs with .ca_pattern format
Added more rules to sample rules folder:
RegeneratingWeighted_Rule_2 has an oblique (2, 8)c/12 spaceship.
RegeneratingWeighted_Rule_3 has an orthogonal 2c/2 spaceship as well as some common puffers.
BSFKLDouble_Rule_2 also has a 3 orthogonal c spaceships as well as a P3 Phoenix and a P14.
BSFKLDouble_Rule_3 also has 3 orthogonal spaceships moving at c and P96 oscillator.
Picture of CAViewer with Grid Lines GIF of BSFKLDouble_Rule_3 Any feedback or bug reports are appreciated!
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
Added Grid Lines
Fixed some bugs with .ca_pattern format
Added more rules to sample rules folder:
RegeneratingWeighted_Rule_2 has an oblique (2, 8)c/12 spaceship.
RegeneratingWeighted_Rule_3 has an orthogonal 2c/2 spaceship as well as some common puffers.
BSFKLDouble_Rule_2 also has a 3 orthogonal c spaceships as well as a P3 Phoenix and a P14.
BSFKLDouble_Rule_3 also has 3 orthogonal spaceships moving at c and P96 oscillator.
Picture of CAViewer with Grid Lines GIF of BSFKLDouble_Rule_3 Any feedback or bug reports are appreciated!
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
- Attachments
-
- CAViewer.zip
- (2.31 MiB) Downloaded 175 times
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
- yujh
- Posts: 3066
- Joined: February 27th, 2020, 11:23 pm
- Location: I'm not sure where I am, so please tell me if you know
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
A little suggestion:
Is that a RRO?
Is that a RRO?
Rule modifier
B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7
Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!
B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7
Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
I think so.
LifeWiki Definition:
A reflectorless rotating oscillator (or looping spaceship) - abbreviated as RRO - is a pattern that rotates itself after a certain number of generations. There is the additional constraint that two non-interacting copies of the pattern could be combined into an oscillator with a period equal to exactly half of that of the component oscillators. This is like the pi orbital, but without the stabilisation.
Not sure whether it satisfies the additional constraint (actually not sure what the additional constraint means).
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
- yujh
- Posts: 3066
- Joined: February 27th, 2020, 11:23 pm
- Location: I'm not sure where I am, so please tell me if you know
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
lemon41625 wrote: ↑May 3rd, 2020, 9:42 pmI think so.
LifeWiki Definition:
A reflectorless rotating oscillator (or looping spaceship) - abbreviated as RRO - is a pattern that rotates itself after a certain number of generations. There is the additional constraint that two non-interacting copies of the pattern could be combined into an oscillator with a period equal to exactly half of that of the component oscillators. This is like the pi orbital, but without the stabilisation.
Not sure whether it satisfies the additional constraint (actually not sure what the additional constraint means).
Hunting wrote: ↑April 9th, 2020, 8:33 amHow many RROs you can fit into one single loop - that reduces the RRO's period.
To see what I mean. Here is the earliest reference of the term "RRO" on this forum:It is loopability 2 because you can fit two RROs into a loop:Code: Select all
x = 5, y = 8, rule = B2i34ik7/S23-a4ikn5j7 2bobo$bo2bo$2obo$obo4$3o!
You cannot, however, fit 4 RROs into it:Code: Select all
x = 35, y = 29, rule = B2i34ik7/S23-a4ikn5j7 2bobo$bo2bo$2obo$obo4$3o14$32b3o4$32bobo$31bob2o$30bo2bo$30bobo!
To see what I mean by "reduce the period", look at the first and second pattern. The first is p420, and the second one is p210.Code: Select all
x = 35, y = 35, rule = B2i34ik7/S23-a4ikn5j7 24bo3b2o$24bo4b2o$24bo3bo2bo$2bobo24bo$bo2bo25b2o$2obo$obo4$3o14$32b3o 4$32bobo$31bob2o$3b2o25bo2bo$5bo24bobo$3bo2bo3bo$4b2o4bo$5b2o3bo!
However, even though you can fit 5 RROs here:It is not loopability 5 because the period still remains 372, the original RRO period.Code: Select all
x = 24, y = 25, rule = B2i3aijnq4city5ackqy6cik7c8/S23-a4city5aiknq 3bo12b2o$5b2o9bo$b4o11b3o$3b2o$2bo2bo$bo3bo$2b3o4$21bo$20b3o$22b2o$b3o 15b3o$4o14b3o$2o$bo$2b2o$3bo18bo$2b2o17bo$2bobo8b2o6bo$3bo8bobob3o$14b 3obo$18bo$15b3o!
————————————————————————
I will surely get the award, by the way.
Rule modifier
B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7
Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!
B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7
Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
I have installed CAViewer in Ubuntu Linux
disclaimer: this is the first time I use Cython
commands from my bash history
commands from my bash history
Code: Select all
/usr/bin/sudo apt install python3-pyqt5 python3-pyperclip python3-numpy python3-pil
/usr/bin/sudo apt install cython3
cd CAViewer/
cd CACompute
touch __init__.py
cp -i Compute.cpp compute.cpp
python3 setup.py --help
python3 setup.py build_ext --inplace
cd ..
cd CAComputeParse/
touch __init__.py
cp -i Compute.cpp compute.cpp
python3 setup.py build_ext --inplace
cd ..
#export DISPLAY=:0
python3 Main.py
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
Update v1.13:
Added martin.novy's installation instructions to the README.md (they are installation instructions right?)
Added a-b for all rulestrings. For example, b3s2-6 instead of b3s2,3,4,5,6.
Added Naive Rules
Fixed bsfkl double totalistic bug.
Added more rules to sample rules folder:
RegeneratingWeighted_Rule_4 has 6 spaceships (3 orthogonal and 3 diagonal) and 3 oscillators (P12, P8, P2)
RegeneratingWeighted_Rule_5 has 5 spaceships (2 orthogonal and 3 diagonal). One of the diagonal spaceships looks very interesting. It looks like a moving RRO (4-5 in the loop).
Next update plan on adding parameter maps (need to figure out how they how first) and maybe test convolutions to see if they can be faster than my current algorithm as described in the README.
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
Added martin.novy's installation instructions to the README.md (they are installation instructions right?)
Added a-b for all rulestrings. For example, b3s2-6 instead of b3s2,3,4,5,6.
Added Naive Rules
Fixed bsfkl double totalistic bug.
Added more rules to sample rules folder:
RegeneratingWeighted_Rule_4 has 6 spaceships (3 orthogonal and 3 diagonal) and 3 oscillators (P12, P8, P2)
RegeneratingWeighted_Rule_5 has 5 spaceships (2 orthogonal and 3 diagonal). One of the diagonal spaceships looks very interesting. It looks like a moving RRO (4-5 in the loop).
Next update plan on adding parameter maps (need to figure out how they how first) and maybe test convolutions to see if they can be faster than my current algorithm as described in the README.
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
- Attachments
-
- CAViewer.zip
- (3.32 MiB) Downloaded 185 times
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
yes, thankslemon41625 wrote: ↑May 5th, 2020, 10:07 am
Added martin.novy's installation instructions to the README.md (they are installation instructions right?)
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
I am happy, that it is quite easy to add new rule families to CAViewer.
as my first experiments, i merely copied
CAViewer/Rules/Single State/Outer Totalistic/OuterTotalistic_Rule_1
and renamed it to
CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219
transFunc.py :
I tried in the app ... OK so far
then I need a change in the LtL_r3_12141219/transFunc.py
after I change something in
CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219/transFunc.py
I guess I should NOT copy to CAViewer/RecordedRules/LtL_r3_12141219.py
I guess I should NOT copy to CAViewer/transFunc.py
I guess I should do File -> Open-rule : transFunc.py
(CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219/transFunc.py)
is this the correct way?
as my first experiments, i merely copied
CAViewer/Rules/Single State/Outer Totalistic/OuterTotalistic_Rule_1
and renamed it to
CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219
transFunc.py :
Code: Select all
# Information about the Rule (Must be filled)
n_states = 2 # Number of States
alternating_period = 1 # For alternating rules / neighbourhoods
colour_palette = None # Colours of the different states
rule_name = "LtL_r3_12141219" # Rule Name
...
then I need a change in the LtL_r3_12141219/transFunc.py
after I change something in
CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219/transFunc.py
I guess I should NOT copy to CAViewer/RecordedRules/LtL_r3_12141219.py
I guess I should NOT copy to CAViewer/transFunc.py
I guess I should do File -> Open-rule : transFunc.py
(CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219/transFunc.py)
is this the correct way?
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: CAViewer - A Cellular Automaton Simulator written in Python
Yes.
You can copy to transFunc.py and RecorededRules/LtL_r3_12141219.py if you want but the program will automatically do that for you.
If you are editing rules directly in transFunc.py, you would need to restart the program.
You can copy to transFunc.py and RecorededRules/LtL_r3_12141219.py if you want but the program will automatically do that for you.
If you are editing rules directly in transFunc.py, you would need to restart the program.
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
my completed demo
CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219/transFunc.py
CAViewer/Rules/Single State/Outer Totalistic/LtL_r3_12141219/transFunc.py
Code: Select all
import numpy as np
r=3
diam=2*r+1
abirth=np.zeros(diam*diam+1)
asurvival=abirth
abirth[12:15]=1
asurvival[12:20]=1
# Information about the Rule (Must be filled)
n_states = 2 # Number of States
alternating_period = 1 # For alternating rules / neighbourhoods
colour_palette = None # Colours of the different states
rule_name = "LtL_r3_12141219" # Rule Name
range_3_moore = []
for i in range(-3, 4):
for j in range(-3, 4):
if i == 0 and j == 0: continue
range_3_moore.append((i, j))
# Neighbourhood of the Rule (Relative Distance from Central Cell)
def get_neighbourhood(generation): # Note (y, x) not (x, y)
return range_3_moore
# Transition Function of Rule, Last Element of Neighbours is the Central Cell
def transition_func(neighbours, generation):
n=sum(neighbours)
if neighbours[-1] == 1:
return asurvival[n]
else:
return abirth[n]
# Does the next state of the cell depend on its neighbours?
# If yes, return next state
# If no, return -1
def depend_on_neighbours(state, generation):
return -1
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
CAViewer, Bipolar rules
EDIT: backlink:
https://conwaylife.com/forums/viewtopic.php?f=11&t=4490
In theory, my bipolar rules need cell states -1 , 0, +1
In practice, they can be simulated by 1, 0, 2
Then my bipolar rules become a subfamily of SquareCell rule_table rules ... generalized multistate weighted outer totalistic with ranges 1 and 2
(BTW, is the SquareCell rule_table rule family well documented or discussed in the wiki or in forums ?)
bipolar rules need special "transformed values" (called "state weights" in SquareCell)
for states 0,1,2
in theory, values 0,-1,1
in practice, I added +1
to each of them, so values are: 1,0,2
and then I added +9 to my thresholds
bipolar00.sqc
https://conwaylife.com/forums/viewtopic.php?f=11&t=4490
In theory, my bipolar rules need cell states -1 , 0, +1
In practice, they can be simulated by 1, 0, 2
Then my bipolar rules become a subfamily of SquareCell rule_table rules ... generalized multistate weighted outer totalistic with ranges 1 and 2
(BTW, is the SquareCell rule_table rule family well documented or discussed in the wiki or in forums ?)
bipolar rules need special "transformed values" (called "state weights" in SquareCell)
for states 0,1,2
in theory, values 0,-1,1
in practice, I added +1
to each of them, so values are: 1,0,2
and then I added +9 to my thresholds
bipolar00.sqc
Code: Select all
#Rule = Rule Table
#States = 3
#Counts = 19
#SW 1,0,2
#NW 0,0,0,0,0
#NW 0,1,1,1,0
#NW 0,1,1,1,0
#NW 0,1,1,1,0
#NW 0,0,0,0,0
#RT 0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0
#RT 0,0,0,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0
#RT 0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,0,0,0,0
#Rows = 4
#Columns = 4
#L .3A$.B.A$AB.A$.2A
Last edited by martin.novy on August 13th, 2020, 9:52 am, edited 7 times in total.
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: "Bipolar" rules ... a new(?) rule family, with natural spaceships, with code for SquareCell, and soon for CAViewer
No, to the best of my knowledge. Most rule exploration in the forums are INT and outer totalistic rules which I think is a bit unfortunate given the many unexplored rulespaces that people have come up with over the years.martin.novy wrote: ↑May 6th, 2020, 9:29 amBTW, is the SquareCell rule_table rule family well documented or discussed in the wiki or in forums?
Why don't you make a post about bipolar rules here https://conwaylife.com/forums/viewtopic.php?f=11&t=4483 and explain them more clearly? I don't quite understand what you are trying to say.
EDIT: I sort of understand them now. So its basically state weights 0, -1, 1. 0 for dead cell, -1 are state 1 and 1 for state 2. For the rule table, you can have anything you want? Do you intend to make a rulestring for this rulespace (if so I can write in code in CAViewer to support it in the rule dialog and the .ca_rule format)?
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
CAViewer/Rules/Others/bipolar00/transFunc.py
Code: Select all
# forked from CAViewer/Rules/Others/Rule_1/transFunc.py
rule_table_string = """
0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0
0,0,0,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,0,0,0,0
"""
lst = []
rule_table = []
###for i in rule_table_string.split("\n")[1:]:
for i in rule_table_string.split("\n")[1:-1]:
lst = []
###for j in i.split(",")[:-1]:
for j in i.split(","):
lst.append(int(j))
rule_table.append(lst)
###
###print(rule_table)
# Information about the Rule (Must be filled)
n_states = len(rule_table) # Number of States
alternating_period = 1 # For alternating rules / neighbourhoods
colour_palette = None # Colours of the different states
rule_name = "bipolar00" # Rule Name
###
###print(n_states)
# Neighbourhood of the Rule (Relative Distance from Central Cell)
def get_neighbourhood(generation): # Note (y, x) not (x, y)
return [
(1, -1), (1, 0), (1, 1), #(1, 2),
(0, -1), (0, 0), (0, 1), #(0, 2),
(-1, -1), (-1, 0), (-1, 1)#, (-1, 2),
]
###
###print(get_neighbourhood(0))
# Transition Function of Rule, Last Element of Neighbours is the Central Cell
def transition_func(neighbours, generation):
n = 0
weights = [
1, 1, 1,# 2, #3,
1, 1, 1,# 2, #2,
1, 1, 1# 2,
]
state_weights = [1, 0, 2]
for i in range(len(neighbours) - 1):
n += ( ###weights[i] *
state_weights[neighbours[i]] )
try:
if n >= 0:
return rule_table[neighbours[-1]][n]
else:
return 0
except IndexError:
return 0
# Does the next state of the cell depend on its neighbours?
# If yes, return next state
# If no, return -1
def depend_on_neighbours(state, generation):
return -1
Last edited by martin.novy on May 7th, 2020, 6:14 am, edited 2 times in total.
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
CAViewer, Bipolar rules
rulestring ...lemon41625 wrote: ↑May 6th, 2020, 9:40 am
Do you intend to make a rulestring for this rulespace (if so I can write in code in CAViewer to support it in the rule dialog and the .ca_rule format)?
EDIT on August 15:
lemon41625 wrote: ↑August 15th, 2020, 12:52 am
I've already implemented multiline rulestrings for weighted neighbourhoods in CAViewer v2.
See https://github.com/jedlimlx/Cellular-Au ... iewer/wiki. Specifically the portion on HROT rules (note that the LV format isn't actually implemented yet).
EDIT in August:
I would either suggest:
A) multiline rulestrings, where every line begins with a #KEYWORD
keep nearly the sqc format
B) Or for single-line rulestrings:
Code: Select all
SQC;Rule=Rule-Table;States=3;Counts=19;SW=1,0,2;NW=0,0,0,0,0;NW=0,1,1,1,0;NW=0,1,1,1,0;NW=0,1,1,1,0;NW=0,0,0,0,0;RT=0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0;RT=0,0,0,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0;RT=0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,0,0,0,0
Last edited by martin.novy on August 15th, 2020, 9:13 am, edited 8 times in total.
Re: CAViewer - A Cellular Automaton Simulator written in Python
No, but there have been several hints posted. An example:martin.novy wrote: ↑May 6th, 2020, 9:29 am(BTW, is the SquareCell rule_table rule family well documented or discussed in the wiki or in forums ?)
viewtopic.php?f=11&t=3479&p=62281#p62281
I wrote Square Cell, Hexagonal Cell and Triangular Cell for my own use. They use the same general design as Mirek Wojtowicz's MCell here:
http://psoup.math.wisc.edu/mcell/
This was an excellent CA simulator that is no longer maintained and only runs on Window XP.
I think you are the first person to install and run Square Cell.
I have expressed my views and suggestions in earlier posts to this thread.
Brian Prentice
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
CAViewer ... Primordia (cellular automata) looks easy to implement in our programs
a rule family distantly related to generalizations of Generations
number of states: 2 to 18+
range 1 outer totalistic (sum of 8 cells)
4 parameters
https://chakazul.github.io/Primordia/Primordia.html
Keys
h shows help
Enter
Space
...
Start/stop running
Run once
I am almost sure, that "cell grows " means:
"""
The rule is identified by code [S/K+L,M,N].
S is the maximum state of each cell (minimum is 0) ...
K, L, M, N are ... parameters. In each generation, a cell grows if its neighbourhood (i.e. sum of its 8 neighbouring cells) is within the growth range K to K+L, remains the same if within the stable range K-M to K+L+N minus the growth range, or shrinks if outside of these ranges.
Conway's Game of Life is equivalent to rule [1/3+0,1,0], with states 0/1, stable range = 2 and growth range = 3.
"""
EDIT
author's original code is at
https://github.com/Chakazul/Primordia/b ... .html#L941
number of states: 2 to 18+
range 1 outer totalistic (sum of 8 cells)
4 parameters
https://chakazul.github.io/Primordia/Primordia.html
Keys
h shows help
Enter
Space
...
Start/stop running
Run once
I am almost sure, that "cell grows " means:
Code: Select all
if state < S : state += 1
"""
The rule is identified by code [S/K+L,M,N].
S is the maximum state of each cell (minimum is 0) ...
K, L, M, N are ... parameters. In each generation, a cell grows if its neighbourhood (i.e. sum of its 8 neighbouring cells) is within the growth range K to K+L, remains the same if within the stable range K-M to K+L+N minus the growth range, or shrinks if outside of these ranges.
Conway's Game of Life is equivalent to rule [1/3+0,1,0], with states 0/1, stable range = 2 and growth range = 3.
Code: Select all
[-------========++++++++========----------]
0 (M) K (L) (N) 8S
shrink stable growth stable shrink
EDIT
author's original code is at
https://github.com/Chakazul/Primordia/b ... .html#L941
Code: Select all
var c = worldOld[i][j];
var c0 = c;
var n = worldOld[i-1][j-1] + worldOld[i-1][j] + worldOld[i-1][j+1]
+ worldOld[i][j-1] + worldOld[i][j+1]
+ worldOld[i+1][j-1] + worldOld[i+1][j] + worldOld[i+1][j+1];
if (n<pK-pM || n>pK+pL+pN) c--; else if (n>=pK && n<=pK+pL) c++;
c = Bound(c, 0, states);
world[i][j] = c;
Last edited by martin.novy on August 13th, 2020, 10:07 am, edited 1 time in total.
Re: CAViewer - A Cellular Automaton Simulator written in Python
Martin,
Here is an implementation of Primordia:
Other than run Life it doesn't seem to do much. The step code is in Primordia.java lines 114 thru 135 and the new rule code is also in Primordia.java lines 25 thru 44. Please check the first code section and improve the second.
Brian Prentice
Here is an implementation of Primordia:
Other than run Life it doesn't seem to do much. The step code is in Primordia.java lines 114 thru 135 and the new rule code is also in Primordia.java lines 25 thru 44. Please check the first code section and improve the second.
Brian Prentice
-
- Posts: 344
- Joined: January 24th, 2020, 7:39 am
- Location: 小红点 (if you know where that is)
Re: Primordia (cellular automata) is a subset of Regenerating Generations
The primodia rulespace seems to be a subset of my regenerating generations rulespace as defined here: https://conwaylife.com/forums/viewtopic.php?f=11&t=4449martin.novy wrote: ↑May 7th, 2020, 11:24 ama rule family distantly related to generalizations of Generations
number of states: 2 to 18+
range 1 outer totalistic (sum of 8 cells)
4 parameters
https://chakazul.github.io/Primordia/Primordia.html
Keys
h shows help
Enter
Space
...
Start/stop running
Run once
I am almost sure, that "cell grows " means:
Code: Select all
if state < S : state += 1
"""
The rule is identified by code [S/K+L,M,N].
S is the maximum state of each cell (minimum is 0) ...
K, L, M, N are ... parameters. In each generation, a cell grows if its neighbourhood (i.e. sum of its 8 neighbouring cells) is within the growth range K to K+L, remains the same if within the stable range K-M to K+L+N minus the growth range, or shrinks if outside of these ranges.
Conway's Game of Life is equivalent to rule [1/3+0,1,0], with states 0/1, stable range = 2 and growth range = 3.
"""Code: Select all
[-------========++++++++========----------] 0 (M) K (L) (N) 8S shrink stable growth stable shrink
EDIT
author's original code is at
https://github.com/Chakazul/Primordia/b ... .html#L941
Code: Select all
var c = worldOld[i][j]; var c0 = c; var n = worldOld[i-1][j-1] + worldOld[i-1][j] + worldOld[i-1][j+1] + worldOld[i][j-1] + worldOld[i][j+1] + worldOld[i+1][j-1] + worldOld[i+1][j] + worldOld[i+1][j+1]; if (n<pK-pM || n>pK+pL+pN) c--; else if (n>=pK && n<=pK+pL) c++; c = Bound(c, 0, states); world[i][j] = c;
For example, the rule [S/K+L,M,N] in Primodia can be expressed by rg(S+1)lSbGsSrbGrsS where G and S are the growth and survival ranges.
The regenerating generations rulespace is already natively supporting in CAViewer in the rule dialog and in the .ca_rule format.
The transFunc.py code is here: (However, I still recommend the .ca_rule format)
Code: Select all
rule_string = "rg3/l1/b3/s2,3/rb3,6/rs5,8"
birth = set([int(x) for x in rule_string.split("/")[2].replace("b", "").split(",")])
survival = set([int(x) for x in rule_string.split("/")[3].replace("s", "").split(",")])
regen_birth = set([int(x) for x in rule_string.split("/")[4].replace("rb", "").split(",")])
regen_survival = set([int(x) for x in rule_string.split("/")[5].replace("rs", "").split(",")])
birth_state = int(rule_string.split("/")[1].replace("l", ""))
# Information about the Rule (Must be filled)
n_states = int(rule_string.split("/")[0].replace("rg", "")) # Number of States
alternating_period = 1 # For alternating rules / neighbourhoods
colour_palette = None # Colours of the different states
rule_name = "RegenLife" # Rule Name
# Neighbourhood of the Rule (Relative Distance from Central Cell)
def get_neighbourhood(generation): # Note (y, x) not (x, y)
return [(1, -1), (1, 1), (-1, 1), (-1, -1),
(1, 0), (0, 1), (-1, 0), (0, -1)]
# Transition Function of Rule, Last Element of Neighbours is the Central Cell
def transition_func(neighbours, generation):
n = 0
for i in neighbours[:-1]:
if i == 1: n += 1
if neighbours[-1] == 0:
if n in birth:
return birth_state
return 0
elif neighbours[-1] == 1:
if n in survival:
return 1
return 2
else:
if n in regen_birth:
return neighbours[-1] - 1
elif n in regen_survival:
return neighbours[-1]
return (neighbours[-1] + 1) % n_states
# Does the next state of the cell depend on its neighbours?
# If yes, return next state
# If no, return -1
def depend_on_neighbours(state, generation):
return -1
No, I have also installed and run Square Cell. However, I stopped using it because I could not zoom in and out without number keys on my keyboard.
The entire reason I decided to develop CAViewer is due to this issue and me not fully understanding the square cell ruletable format until I developed CAViewer.
Download CAViewer: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
Supports:
BSFKL, Extended Generations, Regenerating Generations, Naive Rules, R1 Moore, R2 Cross and R2 Von Neumann INT
And some others...
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
the author's discoveries are at
https://github.com/Chakazul/Primordia/b ... Animals.js
do you plan to put it to github ?
Re: CAViewer - A Cellular Automaton Simulator written in Python
No. I will probably just write a python script to convert Animals.js to Square Cell pattern files and be done with it unless you can improve my new rule code.
Brian Prentice
- martin.novy
- Posts: 142
- Joined: October 22nd, 2014, 6:22 am
- Location: Czechia, EU
- Contact:
Re: CAViewer - A Cellular Automaton Simulator written in Python
(?would you mind, if I upload it to Github with subtitle :
a copy of the original program by Brian Prentice ( viewtopic.php?p=96383#p96355 ) )
EDIT: OK, I will not do it.
Last edited by martin.novy on May 8th, 2020, 11:56 am, edited 2 times in total.