CAViewer - A Cellular Automaton Simulator written in Java

For scripts to aid with computation or simulation in cellular automata.
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 Python

Post by lemon41625 » June 7th, 2020, 8:08 am

Update v1.21:

Added support for hexagonal tilings
Added a snaking reading order for naive rules (like nn0osn0)
Added support for bounded grids (for now the only way to change the grid is to open a pattern with the appropriate rle header, Klein Bottle and Cross Surface kind of broken)
Added support for comments in RLEs

For hexagonal rules (looking for suggestions on intuitive way to define neighbourhood)
If you don't define tiling it defaults to square, if you don't define B/S Conditions it defaults to Outer Totalistic.

Code: Select all

Name: Hexagonal

Neighbourhood Range: 2

Neighbourhood:
0,0,0,0,0
0,1,1,0,0
0,1,0,1,0
0,0,1,1,0
0,0,0,0,0

State Weights: 0,1

Rulespace: Single State

B/S Conditions: Outer Totalistic

Tiling: Hexagonal

Rulestring: 2,3/3

Colour Palette:
None
Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
Attachments
CAViewer.zip
(4.32 MiB) Downloaded 176 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...

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 Python

Post by lemon41625 » June 15th, 2020, 8:14 am

Update v1.22:

Fixed Klein Bottle and Cross Surface
Added Spherical with Bubblegum's help (its broken)
Added an agar searching tool under the search menu - It uses the same algorithm as OCAgar and RandAgar and supports all rules supported by CAViewer.
For now it only outputs to the console and the rle header used is also invalid. I'll get that fixed soon.

Fixed some bugs and made some other minor improvements

Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
Attachments
CAViewer.zip
(4.36 MiB) Downloaded 171 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...

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 Python

Post by lemon41625 » June 21st, 2020, 1:29 am

Update v1.23:

Added support for generating apgtables for all INT rules supported by CAViewer and Outer Totalistic B/S Conditions as well as Single State and Extended Generations Rules
Fixed bug where the bounded grid lines weren't showing up
Further optimised the agar searching algorithm.
The agar search program now outputs stuff to a directory chosen by the user.
Added more rules to the sample rules folder.
Added more stuff to the README.md

Also, changed the way that the cython files need to be compiled.
If you are on linux/mac, just compile the setup.py file in the CAViewer directory. No need to compile individually.

I also think I should get started on that LtL search program I was planning to do.

Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
Attachments
CAViewer.zip
(7.63 MiB) Downloaded 177 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...

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by martin.novy » June 21st, 2020, 6:18 am

lemon41625 wrote:
June 21st, 2020, 1:29 am

I also think I should get started on that LtL search program I was planning to do.
could you tell me something about 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 Python

Post by lemon41625 » June 21st, 2020, 6:20 am

martin.novy wrote:
June 21st, 2020, 6:18 am
lemon41625 wrote:
June 21st, 2020, 1:29 am

I also think I should get started on that LtL search program I was planning to do.
could you tell me something about it?
I orginally wanted to use the lifesrc algorithm. But I changed my mind. It's SMT solver based and I'm building off some code by WildMyron and Scorbie.
It should be able to search for spaceships and oscillators.

I'll provide more details when I release it in a few days.
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 Python

Post by lemon41625 » July 6th, 2020, 9:38 am

Update v1.24:

Added Knight INT Rules
Added reptition detection in the agar search via population sequences (approach inspired by Hunting's TODO statement in the OCAgar repo)
Made CAViewer render hexagonal rule with actual hexagons (some stuff is broken but I'll fix it soon)
Added apgtable generation for BSFKL (doesn't work for OT) and Regenerating Generations (untested)
Added more rules into the rules folder.

Added an easter egg 🥚

Also ignore my previous post about the setup.py. Just use the ones in the CACompute and CAComputeParse folder.

Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
Attachments
CAViewer.zip
(4.05 MiB) Downloaded 170 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...

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 Python

Post by lemon41625 » July 24th, 2020, 6:18 am

Update v1.25:

Fixed some compability issues with clang.
Updated the README with new installation instructions.

Fixed? alternating rules. Well its still broken but perhaps less broken.

Source Code + WinPython Installation: https://github.com/jedlimlx/Cellular-Automaton-Viewer
Source Code:
CAViewer.zip
(6.81 MiB) Downloaded 170 times
=====================================

I'm also working on a Java port of CAViewer to fix all those compability issues and improve cross platform support.
It's still a pre-release so its not on github.

It's built using JavaFX and Java's OOP features should make maintaining the code far easier. It also seems to be possible to embed a *.jar into html to get a web app.

JavaFX is also easier to use. Using Java will also allow me to finally implement @bprentice's suggestion to use classes to define rule families.
However, Java does not have dynamic code execution so you'll have to recompile it which also means you need JDK for writing custom rule families.
Otherwise, the JRE should suffice.

Here's the *.exe: https://drive.google.com/file/d/1urlROx ... sp=sharing for those who can't run Java.
Here's the *.jar https://drive.google.com/file/d/1WIgO-E ... sp=sharing
Also that's not my real email address that I'm using to share the files.

If you're in China, wait till I put it on github. The executable files exceed 10 MB so I can't upload them here.
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 Python

Post by lemon41625 » July 28th, 2020, 8:30 am

bprentice wrote:
April 22nd, 2020, 3:44 pm
To simplify and reduce the number of your transition functions consider a design that uses python classes to implement rule families.

An object created from the base rule class reads and writes the pattern specification which is common to all rules. Objects created from inherited rule classes implement a specific rule family. Methods in these inherited classes use dialogs to display and obtain rule parameters and options. Methods are also provided to generate and test new rules.
Done!

New features in the prerelease:
Added tooltips
Fix RLE bug
Added headers & comments to RLEs
Added a rule search program to look for rules that support spaceships (it outputs to the invisble console but that will be address soon)
Added documentation for modifying the application MODIFY.md. This includes the custom rule families requested by Brian Prentice.
Added new neighbourhood types - Gaussian & Aligned Checkerboard

Get the precompiled binaries here: https://github.com/jedlimlx/Cellular-Au ... r/releases
martin.novy wrote:
July 28th, 2020, 7:34 am
do you already have a subcollection of interesting rules with just 2 states or "generations-states" and 0/1 neigh. weights and state weights in range 2 ?
Have a look at these searches I ran with the HROT rule search. There are some interesting rules inside. The seed used to run the search is found at the top.
Attachments
ships.zip
(67.87 KiB) Downloaded 152 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...

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by martin.novy » July 28th, 2020, 9:28 am

lemon41625 wrote:
July 28th, 2020, 8:30 am

Have a look at these searches I ran with the HROT rule search. There are some interesting rules inside. The seed used to run the search is found at the top.
big thanks for the datasets!

I plan to convert the rulestrings to lifelib notation, and feed the list to testOfRules.py

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 Python

Post by lemon41625 » July 31st, 2020, 3:45 am

After what seemed like a million commits, I finally setup Github Actions.

Well... The MacOS Binary isn't uploading so that might be a problem.

https://github.com/jedlimlx/Cellular-Au ... er/actions
Download the Jar here: https://github.com/jedlimlx/Cellular-Au ... s/12750932
Download the Windows Binaries here: https://github.com/jedlimlx/Cellular-Au ... s/12750934
Download the Linux Binaries here: https://github.com/jedlimlx/Cellular-Au ... s/12750933
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, Bipolar rules

Post by lemon41625 » August 15th, 2020, 12:52 am

martin.novy wrote:
May 6th, 2020, 10:54 am
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)?
rulestring ... what does @BPrentice think ?

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
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).

Hopefully I can release the new update soon.
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...

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: CAViewer, Bipolar rules

Post by martin.novy » August 15th, 2020, 9:27 am

lemon41625 wrote:
August 15th, 2020, 12:52 am
martin.novy wrote:
May 6th, 2020, 10:54 am

EDIT in August:
I would either suggest:
A) multiline rulestrings, ...
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).
thanks for info
I have now added a link from that my post to this your post

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 Python

Post by lemon41625 » August 17th, 2020, 6:01 am

Update v2.0:
  • Added support for HROT Generations (no state weights yet)
  • Added support for LifeViewer's weighted neighbourhood format
  • Added support for apgtable generation for weighted rules
  • Improved the rule search program
    • Added repeat speeds / periods detection
    • Built in parameter setting dialog and dialog to view search results
    • Added support for saving results to *.csv file.
    • Support for multi-threading
  • Improved identification
    • Added support for min, max rules
  • Improved the Giffer
    • Support for pixel sizes > 1 and different timing between frames
  • Added rules to the rules folder
Documentation: https://github.com/jedlimlx/Cellular-Au ... iewer/wiki

Download JAR (Java required, Cross-Platform): https://github.com/jedlimlx/Cellular-Au ... s/14274044
Download Windows Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274047
Download Mac Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274046
Download Linux Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274045
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...

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by bprentice » August 18th, 2020, 2:38 pm

lemon41625 wrote:
August 17th, 2020, 6:01 am
Download JAR (Java required, Cross-Platform): https://github.com/jedlimlx/Cellular-Au ... s/14274044
Download Windows Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274047
Download Mac Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274046
Download Linux Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274045
All of these download references generate:
error.png
error.png (1.01 MiB) Viewed 6666 times
Brian Prentice

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 Python

Post by lemon41625 » August 18th, 2020, 7:02 pm

bprentice wrote:
August 18th, 2020, 2:38 pm
lemon41625 wrote: Download JAR (Java required, Cross-Platform): https://github.com/jedlimlx/Cellular-Au ... s/14274044
Download Windows Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274047
Download Mac Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274046
Download Linux Binary (Java not required): https://github.com/jedlimlx/Cellular-Au ... s/14274045
All of these download references generate:
error.png
Brian Prentice

Try: https://github.com/jedlimlx/Cellular-Au ... er/actions

Link on the latest build with a green tick.

You will need a github account to download the lastest build.

EDIT:
In future, I'll just add the generated binaries to the release on github.
Download the artifacts from here: https://github.com/jedlimlx/Cellular-Au ... s/tag/v2.0

No need for a github account.
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 Python

Post by lemon41625 » September 1st, 2020, 10:39 am

Update v2.1:
  • Added apgtable generation for weighted B0 rules
  • Added B0 Generations via a generalised B0 algorithm
    • Now, implementing B0 in other rulespaces is as easy as ABC
  • GUI Improvements
    • Added arbitary range to the neighbourhood selector
    • Added grid lines
    • Added clockwise and anti-clockwise rotation
    • About button will now open up a built-in browser to view documentation
  • Added settings storage (rule will stay the same when application restarts, ...)
  • Improved documentation (setup Github Pages)
  • Added rules to the sample rules folder
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...

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 Python

Post by lemon41625 » September 10th, 2020, 3:51 am

New features added since last update:
  • Rule Support
    • B0 apgtable generation support
    • State weights support
    • Extended Generations support
    • Triangular rules support
  • GUI / Editing Improvements
    • Pasting now works like in Golly
    • Added Ctrl + A to select all, Ctrl + Z to undo
  • Added a command line interface which supports:
    • Random synthesis generate for any ship (input in North-West-West direction) to pipe into apgsearch
    • Random soup generation
    • Simulation
    • Apgtable Generation
    • Identification
    • Minimum and maximum rule identification
  • Bug Fixes
    • Fixed bug which caused ConcurrentModificationException to be thrown and causing the simulation to randomly pause
    • Fixed issues with using space bar to step 1 generation
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...

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 » September 23rd, 2020, 8:53 pm

Update v2.3:
  • Rule Support
    • Added deficient and integer HROT rules
    • Added 1D rules
    • Added HROT History
    • Refactor quite a bit of code
  • GUI / Editing Improvements
    • Simulation is approximately 10 - 20 times faster
    • Ability to adjust step size and maximum simulation speed
  • Command Line Interface
    • Fix simulation command
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


Answering here to avoid cluttering the Symbosis Thread
Yoel wrote:
September 23rd, 2020, 3:30 am
lemon41625 wrote:
September 23rd, 2020, 12:51 am
Yoel wrote:
September 23rd, 2020, 12:42 am
BTW, did anyone try to write extensions to CAViewer in Clojure? I like Lispy syntax, PERL and functional style. Also a matter of personal opinion, of course. :)
I'm afraid that that isn't possible at least in terms of trying to get native support since CAViewer uses Java to define new rulespaces. Find the documentation on how to do it here: https://jedlimlx.github.io/Cellular-Aut ... iewer.html

Nevertheless, you could use an external ruletable generation program once CAViewer supports ruletables (ruletables aren't supported at the moment).
Standard Clojure runs on JVM and is meant to be fully mixable with Java, very much like Scala, but with Lispy syntax and interactivity. It natively supports the entire Java API. Compiled Clojure code is just Java jars. There are dialects of Clojure for Javascript VM and .NET, but I never used them and I don't know much about them. Most likely, there are incompatible with each other, besides some basic functionality.

BTW, there is also an implementation of Common Lisp for Java called Armed Bear Common Lisp (ABCL). It also produces Java jars for integration within Java code, enables the entire Java API inside Lisp (in somewhat ugly way though), inclusion of Java code inside Lisp etc. However, it's slow and it deviates from mainstream Lisps on unexpected subtle levels. People usually use it for functional style of scripting to put pieces of Java code together. Clojure, on the other hand, is only marginally slower than regular Java (like Scala).

ABCL is totally OK for turning my ruletable generator into a Java class, but not suitable for CAs (way too slow for that kind of things).
Then, it should be possible as long as Clojure can do stuff like call Java methods and extend Java classes and implement Java interfaces.
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 » September 28th, 2020, 6:24 pm

lemon41625 wrote:
September 23rd, 2020, 8:53 pm
Then, it should be possible as long as Clojure can do stuff like call Java methods and extend Java classes and implement Java interfaces.
It surely can. One of the main points of Clojure (and Scala, which is conceptually somewhat similar, but has a more Java-like syntax) is to do all Java stuff without too many (if any!) explicit class and interface declarations. The compiler does these boring things for you. Also, it's interactive like other Lisps. You can rewrite parts of your code even while it's running on a server without explicit recompilation. I'll definitely look into your code!

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 » September 28th, 2020, 6:29 pm

lemon41625 wrote:
September 10th, 2020, 3:51 am
[*] B0 apgtable generation support
BTW, is there a Golly script for loading patterns written in apgcodes?

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

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by dvgrn » 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.

Come to think of it, I'm not sure if extended/large-size apgcodes will work with this script -- anyone care to contribute an update if needed?

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 » September 29th, 2020, 7:47 am

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.

Come to think of it, I'm not sure if extended/large-size apgcodes will work with this script -- anyone care to contribute an update if needed?
Unfortunately, it only seems to work with standard Life and not other rules.

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

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by dvgrn » September 29th, 2020, 8:25 am

Yoel wrote:
September 29th, 2020, 7:47 am
Unfortunately, it only seems to work with standard Life and not other rules.
That doesn't seem too terribly unfortunate. The script is very straightforward about defaulting to Life -- see lines 18 and 143.

There's no rule specification in an apgcode, so you'd have to get the rule from somewhere else. A second input? The current Golly rule?

I think those two lines are the only ones that would have to change to support whatever other rule you might want. In fact, I'm not sure that line 18 even matters, since this script isn't running the pattern to find the period, or anything like that. Depending on what you want, you could probably just remove line 18, and also take out the string , rule = B3/S23 at the end of line 143.

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 » September 29th, 2020, 11:11 am

dvgrn wrote:
September 29th, 2020, 8:25 am
Yoel wrote:
September 29th, 2020, 7:47 am
Unfortunately, it only seems to work with standard Life and not other rules.
That doesn't seem too terribly unfortunate. The script is very straightforward about defaulting to Life -- see lines 18 and 143.

There's no rule specification in an apgcode, so you'd have to get the rule from somewhere else. A second input? The current Golly rule?

I think those two lines are the only ones that would have to change to support whatever other rule you might want. In fact, I'm not sure that line 18 even matters, since this script isn't running the pattern to find the period, or anything like that. Depending on what you want, you could probably just remove line 18, and also take out the string , rule = B3/S23 at the end of line 143.
I did notice these two lines. No, it's not it. The script does handle apgcodes for other Life-like rules, but breaks on rules with >2 states (Brian's Brain, for example). I've tried several rules and keep getting the following error:

Code: Select all

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/yoel/golly/apgcode-to-clipboard-RLE.py", line 142, in <module>
    RLE = giveRLE(patt)
  File "/home/yoel/golly/apgcode-to-clipboard-RLE.py", line 95, in giveRLE
    rl_list = [[x[0]-mcc[0],x[1]-mcc[1]] for x in clist_chunks]
IndexError: list index out of range
The problem seems to be in the function giveRLE(). Probably the script was written for earlier versions of apgcode. Note the comment in line 83:

# TBD: check for multistate rule, show appropriate warning.

Where can I read a detailed description of the apgcode format?
Last edited by Yoel on September 29th, 2020, 11:18 am, edited 1 time in total.

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

Re: CAViewer - A Cellular Automaton Simulator written in Python

Post by dvgrn » 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. But if there are any published Python scripts for dealing with apgcodes in multistate rules, I haven't found them. All I know is that Catagolue seems to be handling them somehow these days.

EDIT: Catagolue's RLE format seems a little strange in the above link -- it's using "o"s instead of "A"s. Works fine in Golly, it just isn't what I expected.

Post Reply