CAViewer - A Cellular Automaton Simulator written in Java

For scripts to aid with computation or simulation in cellular automata.
MathAndCode
Posts: 5141
Joined: August 31st, 2020, 5:58 pm

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by MathAndCode » October 1st, 2020, 9:41 pm

dvgrn wrote:
September 28th, 2020, 8:48 pm
Yoel wrote:
September 28th, 2020, 6:29 pm
BTW, is there a Golly script for loading patterns written in apgcodes?
Here's one from early 2016: apgcode-to-clipboard-RLE.py. Hard to believe that apgcodes have been around that long.
What about the other way around?
I am tentatively considering myself back.

User avatar
dvgrn
Moderator
Posts: 10610
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by dvgrn » October 1st, 2020, 9:47 pm

MathAndCode wrote:
October 1st, 2020, 9:41 pm
dvgrn wrote:
September 28th, 2020, 8:48 pm
Yoel wrote:
September 28th, 2020, 6:29 pm
BTW, is there a Golly script for loading patterns written in apgcodes?
Here's one from early 2016: apgcode-to-clipboard-RLE.py. Hard to believe that apgcodes have been around that long.
What about the other way around?
The comments in that script include a pointer to biggiemac's script which converts a Golly selection to an apgcode (and opens the relevant Catagolue page for you).

MathAndCode
Posts: 5141
Joined: August 31st, 2020, 5:58 pm

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by MathAndCode » October 1st, 2020, 9:49 pm

dvgrn wrote:
October 1st, 2020, 9:47 pm
The comments in that script include a pointer to biggiemac's script which converts a Golly selection to an apgcode (and opens the relevant Catagolue page for you).
Ah; thank you. I was about to start typing one myself when I saw that you had replied.
I am tentatively considering myself back.

lemon41625
Posts: 344
Joined: January 24th, 2020, 7:39 am
Location: 小红点 (if you know where that is)

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by lemon41625 » October 11th, 2020, 2:41 am

Update 2.4:
  • Rule Support
    • Added support for regenerating generations
    • Added support for [R]Symbiosis
    • Added support for INT rules (Moore, Hexagonal, Far Corners, Far Edges, R2 Cross, Knight)
    • Added support for custom rules (*.rule)
      • SQC Ruletables
      • Golly Ruletables
      • Golly Ruletrees
  • GUI / Editing Improvements
    • Clearing cells cache is faster
    • Fixed rotate clockwise and anticlockwise.
Documentation: https://jedlimlx.github.io/Cellular-Automaton-Viewer
Wiki: https://jedlimlx.github.io/Cellular-Aut ... /Home.html

Precompiled Binaries: https://github.com/jedlimlx/Cellular-Au ... r/releases
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...

Yoel
Posts: 384
Joined: July 2nd, 2020, 1:02 am
Location: Electronic jungle
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by Yoel » October 27th, 2020, 4:02 am

dvgrn wrote:
September 29th, 2020, 11:31 am
Yoel wrote:
September 29th, 2020, 11:11 am
Where can I read a detailed description of the apgcode format?
Anything like that that isn't on the LifeWiki, certainly ought to be. In this case the coverage is fairly good.
Do you know how linear growth patterns are encoded? The LifeWiki page doesn't explain it. For example, a couple of days ago I discovered a new natural puffer in standard Life by apgsearching (no so new really, a reaction of two well known puffers). Its apgcode is as follows:


yl1152_1_339_9141fc3314f83e5b956ec6958426db33


It appears in this soup:

Code: Select all

x = 16, y = 16, rule = B3/S23
booooooooobbobbo$
obbbbooobobbbobb$
bobooooobbobboob$
oobbbbobooobooob$
bbbbbobobobboobb$
bbbbooobbobobboo$
obbooobbbbooboob$
bbobbobobobboooo$
oooobbbooooboobo$
ooooobobbbbbbooo$
oobbobbooboooboo$
obboobbbobbbbbbo$
obbooobobboboooo$
obbobobobooooobb$
oobboobbbooboobb$
obboobobooobbbbo!
However, if I try to parse it by the Python script, although it is standard Life, it reads the aphanumeric line as a normal apgcode and produces mess that seems totally unrelated to the pattern:

Code: Select all

x = 35, y = 8, rule = Life
2$b2ob2ob3obobob4o4b2o4b4o$5bob2o2bob2obo2b2obo4b2ob3o$3bob2o3b2o2b2o
2b5obobob2o$bo3b2o4b2obob2o2b2obobo3b2o!
The encoding is entirely different from the extended Wechsler format. It's obviously plain hex, because no other letters besides a-f appear in those codes, and it's always 32 symbols, i.e. 16 bytes. Linear growth patterns in multistate rules are also encoded the same way, as a 16 byte hex line. However, they are not internal server IDs of the patterns either, because if I don't upload hauls to Catagolue or run Apgsearch disconnected from the network, it still systematically logs the same codes for the same patterns on my computer.

User avatar
Moosey
Posts: 4306
Joined: January 27th, 2019, 5:54 pm
Location: here
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by Moosey » October 27th, 2020, 5:27 pm

Yoel wrote:
October 27th, 2020, 4:02 am
Do you know how linear growth patterns are encoded? The lifeWiki page doesn't explain it...
iirc yl apgcodes are something like yl(period of the puffer, more or less & depending on the ash but I forget how)_(period of the ash I think)_(I have no clue)_(hash of the ash, rhyme unintended)
not active here but active on discord

Schiaparelliorbust
Posts: 3686
Joined: July 22nd, 2020, 9:50 am
Location: Acidalia Planitia

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by Schiaparelliorbust » October 28th, 2020, 3:45 am

Moosey wrote:
October 27th, 2020, 5:27 pm
Yoel wrote:
October 27th, 2020, 4:02 am
Do you know how linear growth patterns are encoded? The lifeWiki page doesn't explain it...
iirc yl apgcodes are something like yl(period of the puffer, more or less & depending on the ash but I forget how)_(period of the ash I think)_(I have no clue)_(hash of the ash, rhyme unintended)
I think it's the period of the population of the ash, so if the puffer has glide symmetry or any other way for it's ash's population to have a period smaller than the puffer's period, then that will be after yl.
Hunting's language (though he doesn't want me to call it that)
Board And Card Games
Colorised CA
Alien Biosphere

lemon41625
Posts: 344
Joined: January 24th, 2020, 7:39 am
Location: 小红点 (if you know where that is)

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by lemon41625 » October 28th, 2020, 4:57 am

Features added since last update:
  • Rule support
    • Added [R]DeadlyEnemies
    • Added Multi-state Cyclic HROT
    • Added Alternating Rules
    • Revamped apgtable generation (looks alot cleaner now)
  • GUI / Editing Improvements
    • Better undo / redo support
    • Ability to view population graph
    • Ability to modify random soup generation settings
  • Search Program
    • New catalyst search program (with support for multiple catalysts)
Documentation: https://jedlimlx.github.io/Cellular-Automaton-Viewer
Wiki: https://jedlimlx.github.io/Cellular-Aut ... /Home.html

Precompiled Binaries: https://github.com/jedlimlx/Cellular-Au ... r/releases

EDIT:
It appears there were some bugs with undo / redo and the multi-state cyclic HROT rules. They are fixed now.
Download from https://github.com/jedlimlx/Cellular-Au ... /333652086

===================================

@Yoel
CAViewer supports multi-state cyclic rules according to my notation. I'll get the other notation done soon.
So I guess you can try it out and let me know if there are any issues.

A useful function that CAViewer has is the ability to simulate extended neighbourhood rules.
For a multi-state cyclic rule, the extended neighbourhood notation is something like R2,C3,B4,0,0,3,1,2,2,1,M2,2,S2,l-2,3,l-0,NB.

CAViewer can also generate apgtables (for both extended neighbourhoods and R1 moore rules) for apgsearch to use. To run them in Golly, you will need to replace the neighbourhood with the Golly supported neighbourhood aliases.

A *.zip file (rules.zip) containing some other rules that can be run in CAViewer can be found https://github.com/jedlimlx/Cellular-Au ... r/releases.
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...

lemon41625
Posts: 344
Joined: January 24th, 2020, 7:39 am
Location: 小红点 (if you know where that is)

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by lemon41625 » November 17th, 2020, 9:23 pm

Update v2.6:
  • Rule support
    • Added support for rulestring canonisation and min, max rule generation in INT rules
    • Added support for [R]History and [R]E(x)nergetic for INT rules
    • Added INT generations support, including B0 rules
    • Added bounded grid (specifically toroidal grids)
  • GUI / Editing Improvements
    • Ability to simulation inside and outside selection
    • Improved rendering
  • Search Program
    • New brute force search program
    • Ability to flip and rotate catalysts in catalyst search program
    • Ability to call catalyst search program from CLI
Documentation: https://jedlimlx.github.io/Cellular-Automaton-Viewer
Wiki: https://jedlimlx.github.io/Cellular-Aut ... /Home.html

Precompiled Binaries: https://github.com/jedlimlx/Cellular-Au ... r/releases
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...

Yoel
Posts: 384
Joined: July 2nd, 2020, 1:02 am
Location: Electronic jungle
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by Yoel » November 18th, 2020, 10:03 pm

Hi!

Yesterday your CAViewer killed the PSU in my computer! I'm kidding. For about a month it was humming like a drill and heating up like an iron. However, the last drop was trying to load a relatively large pattern into CAV (a tiling of 7 Rule 100 units for Brians' Brain, 50,488 cells on a 2688-wide cylinder), while apgsearching in parallel mode in the background. This caused a spectacular explosion of a capacitor inside the power supply! :twisted:

First, a couple of small things:

1. chmod +x can be preset in .zip and .tar.gz archives as well as on Github:

https://stackoverflow.com/questions/409 ... ile-in-git

One way to ensure Linux compatibility, if you don't have a Linux box at hand, is to install a full testing distro under VirtualBox.

3. I preconfigured colors in Gluons, Gluonic etc. as RGB for obvious aesthetic reasons. It would be nice to add a state coloring menu and store color preferences for each rule.

4. Does RuleLoader actually work in CAViewer? I could not figure out how to insert custom rule tables.

Now, there is recurring thread synchronization bug, ConcurrentModificationException in updateCells, which leaves persistent cells that disrupt the whole thing. As far as I can see, this issue occurs very often when you step through by keeping the space pressed down, and only occasionally, but often enough, when you run a pattern or step only once and wait for the update. Opening a new pattern does not help to get rid of them. Once CAV is desynchonized, one must kill it and rerun again. Sometimes this bug does not throw an exception and remains unnoticed, which make pattern updates unreliable.

In case it's OS-specific, which I doubt:

$ uname -a
Linux hibou 5.4.0-4-amd64 #1 SMP Debian 5.4.19-1 (2020-02-13) x86_64 GNU/Linux
$ java -version
openjdk version "14-ea" 2020-03-17
OpenJDK Runtime Environment (build 14-ea+36-Debian-2)
OpenJDK 64-Bit Server VM (build 14-ea+36-Debian-2, mixed mode, sharing)

That's the main problem I see so far. Otherwise, cyclical multistate rules seem to work correctly, although I didn't try different neighborhoods yet.

I am sure you know that all sorts of other exceptions are thrown by CAV all the time, but I don't know whether they cause any problems.

BTW, is there a zoom option in CAV? And what's the default and maximum grid size?

lemon41625
Posts: 344
Joined: January 24th, 2020, 7:39 am
Location: 小红点 (if you know where that is)

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by lemon41625 » November 18th, 2020, 11:27 pm

Yoel wrote:
November 18th, 2020, 10:03 pm
Hi!

Yesterday your CAViewer killed the PSU in my computer! I'm kidding. For about a month it was humming like a drill and heating up like an iron. However, the last drop was trying to load a relatively large pattern into CAV (a tiling of 7 Rule 100 units for Brians' Brain, 50,488 cells on a 2688-wide cylinder), while apgsearching in parallel mode in the background. This caused a spectacular explosion of a capacitor inside the power supply! :twisted:
CAViewer isn't really supposed to run large patterns. But, I won't really expect the capacitor to explode...
Yoel wrote:
November 18th, 2020, 10:03 pm
I preconfigured colors in Gluons, Gluonic etc. as RGB for obvious aesthetic reasons. It would be nice to add a state coloring menu and store color preferences for each rule.
Okay, I'll get that done.
Yoel wrote:
November 18th, 2020, 10:03 pm
4. Does RuleLoader actually work in CAViewer? I could not figure out how to insert custom rule tables.
You can place the rule file in a rules folder in the same folder as the CAViewer binary. You can also upload the rule to the LifeWiki:Rule namespace. Then, click on set rule and enter the rule's name.
Yoel wrote:
November 18th, 2020, 10:03 pm
Now, there is recurring thread synchronization bug, ConcurrentModificationException in updateCells, which leaves persistent cells that disrupt the whole thing. As far as I can see, this issue occurs very often when you step through by keeping the space pressed down, and only occasionally, but often enough, when you run a pattern or step only once and wait for the update. Opening a new pattern does not help to get rid of them. Once CAV is desynchonized, one must kill it and rerun again. Sometimes this bug does not throw an exception and remains unnoticed, which make pattern updates unreliable.
I'm aware of this bug and it happens on my computer too. Unfortunately, I haven't been able to fix it but I'll keep trying.
Yoel wrote:
November 18th, 2020, 10:03 pm
BTW, is there a zoom option in CAV? And what's the default and maximum grid size?
To zoom use the scroll wheel like in Golly.

The maximum grid size is infinite but you can only edit patterns in a grid of 4096x4096 (I think). It can be adjusted by using a bounded grid, but I haven't gotten to adding in lines to denote where the bounds of the bounded grid are. Also if there are cells that are too far away from the origin (this generally doesn't happen unless a large pattern is intentionally loaded into the thing), the zoom kind of starts glitching.
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...

Yoel
Posts: 384
Joined: July 2nd, 2020, 1:02 am
Location: Electronic jungle
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by Yoel » November 19th, 2020, 1:51 am

lemon41625 wrote:
November 18th, 2020, 11:27 pm
You can place the rule file in a rules folder in the same folder as the CAViewer binary. You can also upload the rule to the LifeWiki:Rule namespace. Then, click on set rule and enter the rule's name.
I see, very useful! I would make a separate subdirectory for rules though, to avoid mess, or add an option to choose a different default path for rules and patterns like in Golly. Perhaps, looking for the user's default Golly rule directory (usually ~/.golly/Rules) could also be useful, to avoid unnecessary copying of the tables.
lemon41625 wrote:
November 18th, 2020, 11:27 pm
To zoom use the scroll wheel like in Golly.
Ah... gotcha! I was not actually aware of this wheel feature (or forgot about it). I always use Ctl+[ and Ctl+] for zooming in Golly,

I see that you also use extended Wolfram codes. Did you see this post? For 2-color and 3-color cyclic 1D rules I use a different notation, which is humanly comprehensible, unlike Wolfram codes:

1DRB[births]-[survivals/mutations] and 1DRGB[births]-[survivals/mutations], where the code is written as a sequence of ternary digits for 2-color rules and 4-base digits for 3-color, which encodes all possible unique color combinations possible in isotropic cyclical 1D: 2/6 for 2 colors and 3/10 for 3 colors. Some of these rules resemble W54 or W110 with gliders, puffers etc. Unfortunately, Golly don't support larger neighborhoods with >2 states (besides Generations). I'll try to check up such rules in CAViewer.

Yoel
Posts: 384
Joined: July 2nd, 2020, 1:02 am
Location: Electronic jungle
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by Yoel » November 22nd, 2020, 9:19 pm

lemon41625 wrote:
November 18th, 2020, 11:27 pm
You can place the rule file in a rules folder in the same folder as the CAViewer binary. You can also upload the rule to the LifeWiki:Rule namespace. Then, click on set rule and enter the rule's name.
What's the specification of your second version of multi-state cyclic HROT with custom neighborhoods? I mean, when I press the help button in your menu, it mentions "R<range>,C<states>,B<birth>,M<mutate>,M<mutate2>,...,S<survival>,N<neighborhood>".

I assume that neighborhoods are encoded the same way as in Golly 4.0? For example, how do you rewrite the rulestring for Gluonic with the explicit neighborhood? When I try to define a custom neighborhood, it does not save the setting in .rle files. Also, let's say I wish to redefine Gluonic with all cells weighted as 16. Is there way to do it?

lemon41625
Posts: 344
Joined: January 24th, 2020, 7:39 am
Location: 小红点 (if you know where that is)

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by lemon41625 » November 22nd, 2020, 10:46 pm

Yoel wrote:
November 22nd, 2020, 9:19 pm
I assume that neighborhoods are encoded the same way as in Golly 4.0?
Yes, neighbourhoods are encoded in a similiar way to Golly.
Yoel wrote:
November 22nd, 2020, 9:19 pm
When I try to define a custom neighborhood, it does not save the setting in .rle files.
Oops... That was my mistake. I forgot to implement the methods to save the stuff as comments in the RLE files. I'll have that fixed.
Yoel wrote:
November 22nd, 2020, 9:19 pm
For example, how do you rewrite the rulestring for Gluonic with the explicit neighborhood?
The Gluonic rulestring with the explicit neighbourhood would be R1,C4,B0,0,2,0,2,1,M,M,S0,0,0,0,1,1,3,0,0,0,3,0,0,0,3,1,2,0,0,1,2,2,0,1,2,1,0,0,2,1,1,0,2,1,1,1,NM.

Note that commas are needed to seperate the numbers since for rules with larger neighbourhoods, the number of cells is larger than 10.
Yoel wrote:
November 22nd, 2020, 9:19 pm
Also, let's say I wish to redefine Gluonic with all cells weighted as 16. Is there way to do it?
That would be R1,C4,B0,0,32,0,32,16,M,M,S0,0,0,0,16,16,48,0,0,0,48,0,0,0,48,16,32,0,0,16,32,32,0,16,32,16,0,0,32,16,16,0,32,16,16,16,NW101010100010101010.

But, it appears that there is a bug parsing such high weights so it won't work in the application. I'll go and fix it.
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...

lemon41625
Posts: 344
Joined: January 24th, 2020, 7:39 am
Location: 小红点 (if you know where that is)

Re: CAViewer - A Cellular Automaton Simulator written in Java

Post by lemon41625 » November 29th, 2020, 10:40 pm

Update 2.7:
  • Rule support
  • 3x speed improvement for INT rule range generation
    • Add range 2 von neumann, checkerboard and r3 cross INT support
    • Add apgtable generation to Integer HROT and HROT generations with state weights
    • Add naive rules ([R]:T100:NO)
    • Compute heat, temperature and volatility in identification function
  • GUI / Editing Improvements
    • Allow setting of rule directory
    • Allow changing rule colours (tied to individual rulestrings)
    • Add increase / decrease step size button
  • Bugfixes
    • Pattern should update correctly now
    • No more ConcurrentModificationExceptions
    • Fixed bug where neighbourhoods where not generated in the RLE
    • Fixed bug involving parsing weights higher than 8
Documentation: https://jedlimlx.github.io/Cellular-Automaton-Viewer
Wiki: https://jedlimlx.github.io/Cellular-Aut ... /Home.html

Precompiled Binaries: https://github.com/jedlimlx/Cellular-Au ... r/releases
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...

Post Reply