Page 1 of 7

CAViewer - A Cellular Automaton Simulator written in Java

Posted: April 5th, 2020, 1:36 am
by lemon41625
I wrote this CA simulator to simulate multi - state extended neighbourhood rules that Golly and Lifeviewer cannot.
There is support for alternating rules, mutliple states and customisable neighbourhoods. Unfortunately, the algorithm used to compute the cellular automaton is rather slow and the program has several bugs.

Rules are defined as python code. There are some sample rules in the rules folder.

There are 3 dependencies - PyQt5, pyperclip and PIL. Requires Python 3.6 or higher.
There is no .exe file as compiling the program to .exe stops the changing of rules from working.

Future work:
  • Support for b and o in rles and rles with above 26 states.
    Faster Algorithm (Maybe Dynamic Programming Optimisation)
    Function to identify various patterns
    Support for Hexagonal and Triangular Tilings
See https://github.com/jedlimlx/Cellular-Automaton-Viewer for the latest version.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 5th, 2020, 8:58 am
by lemon41625
Update:

New rules added to rules folder.
Bug where opening pattern popup would appear multiple times fixed if new pattern is created.
Tooltips on buttons added.

Also some screenshots:
Pic.png
Pic.png (32.64 KiB) Viewed 26171 times
Pic.png
Pic.png (48.09 KiB) Viewed 26171 times

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 6th, 2020, 5:16 am
by yujh
Most people(because they have golly)use python 2.x.x,which is different from this, may be a big problem.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 6th, 2020, 8:12 am
by lemon41625
Update v1.0:

Files now come with a WinPython Portable Distribution. (No need to install Python 3, but only works for Windows) - To run, run RunMain.bat
On Mac or Linux, you need to run the code with your own python installation.

New rules added to rules folder and rules folder has been reorganised.
New option to set zoom of the program.

Update v1.1:

New rules added to rules folder
Options for Symmetries in Random Soups - C1, C2_1, C2_2, C2_4, D2_+1, D2_+2, D4_+1, D4_+2, D4_+4 (More Symmetries Coming Soon)
Options for Adjusting Simulation Speed
New DP Algorithm Added (Its actually very very very slow, still trying to speed it up)

Please give me feedback if you have any. Thanks.
Files: https://mega.nz/file/ZBs3jCxR#Uk38sumvX ... FYF5LUokZ0

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 8th, 2020, 10:02 pm
by lemon41625
Also here are the instructions for running the program.

Instructions
=================================
To Start the Program, Run RunMain.bat or Main.py

Patterns are stored as rles.

After you select the Pattern / Area with the Selection Tool
To Copy, Press Ctrl+C
To Cut, Press Ctrl+X
To Delete, Press Del
To Paste, in the area, Press Ctrl+V
To Generate Random Soup, Press the Button with a Soup
To Generate Multi-State Random Soup, Press the Button with a Soup and a 2 on it

In the file menu, you can save, open, and create a new pattern.
In the edit menu, you can copy, cut, delete and paste a pattern.
In the control menu, you can adjust random soup and simulation settings and step forward 1 generation.
In the zoom menu, you can zoom in and out and set the zoom.

Troubleshooting
================================
When you run the simulation, it the cells do not change, it could be because there is an error in your transition function or because there is an error in the program.
If you suspect a bug, please report it.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 8th, 2020, 11:00 pm
by yujh
Can’t open link here. https://mega.nz/file/ZBs3jCxR#Uk38sumv ... FYF5LUokZ0could be blocked.Can you post the zip file here?

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 9th, 2020, 12:06 am
by lemon41625
Here is the file on Google Drive. I will keep it here until I have time to upload everything to github.
https://drive.google.com/open?id=1ML_nm ... hxyKZiGuq_

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 9th, 2020, 12:12 am
by yujh
Oh no!(Ha, I live in China. No google.)

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 9th, 2020, 12:49 am
by lemon41625
Uploaded to Github: https://github.com/jedlimlx/CAViewer
Link to the WinPython: https://app.nihaocloud.com/f/50bbe4ea7e364b19a873/?dl=1 -> Unzip and Place Folder in the zip inside CAViewer Folder

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 9th, 2020, 1:06 am
by yujh
Sorry, but I can’t open this also(what? Is it a Chinese website blocked by Chinese?你好云。咋么了,我一点也不云。) https://app.nihaocloud.com/f/50bbe4ea7 ... a873/?dl=1wait, there is only html,python and c++ . What?(I know nothing about python)

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 9th, 2020, 1:54 am
by lemon41625
New Github Link: https://github.com/jedlimlx/Cellular-Automaton-Viewer (Everything Inside)

Unzip the WPy64-3770.zip and place the folder inside inside CAViewer.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 10th, 2020, 3:36 am
by lemon41625
Update v1.2:

No longer need to unzip WinPython zip. It is already unzipped in the github.

Fixed Numpy Library not Found Bug and Recorder Icon Missing Bug

Added Function to Identify Pattern - Oblique (9, 4)c/13 Spaceship, P 1880 Oscillator... (For now, only supports still life, oscillators and spaceships)
If it outputs failed, it means that the pattern is not still life, oscillator or spaceship. If you suspect a bug, please report it.

Added Function to Record Pattern and save as gif.

Added New Rules:
BSFKLWeighted_Rule_5 is quite GOL Like (2 Known Spaceships - One 2c/2 and One 2c/6, 1 Known Oscillator)
BSFKLAlternating_Rule_1 has Oblique (9, 4)c/13 Spaceship

Code: Select all

x = 17, y = 20, rule = BSFKLAlternating_Rule_1
17.$17.$17.$17.$17.$6.A10.$5.BAB9.$6.AB2A7.$5.B4A7.$6.2BA8.$17.$17.$17.$17.$17.$17.$17.$17.$17.$17.1$!
And some others...

If you do not know how to code Python, you can edit the rulestrings inside the sample transFunc.py files. Currently there are Outer Totalistic, BSFKL and Extended Generations Rulestrings.

https://github.com/jedlimlx/Cellular-Automaton-Viewer

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 12th, 2020, 2:16 am
by lemon41625
Update v1.3:

Sped up simulation slightly (Not much difference)
Added new rule format (.ca_rule) for those who do not know who to code python.
Added ability to identify guns.
Not yet supported natively, modify Rules/sample.ca_rule to change rule.

Added New Rules to Others (Using Square Cell's Rule Table Format):
WeightedGenerations_Rule_8 supports some interesting spaceships - (24c/26, 3c/2, 10c/10...).
And some others...

Screenshot of Rule_1 with Identity Function
Thing.png
Thing.png (43.02 KiB) Viewed 25930 times
https://github.com/jedlimlx/Cellular-Automaton-Viewer

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 13th, 2020, 10:14 pm
by yujh
How big is the file?(to be sure there isn’t any error while downloading, github didn’t tell the size)
Is there grids?
Edit:
Can’t download

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 14th, 2020, 1:47 am
by lemon41625
The file downloaded from github should be about 170 MB before unzipping. Its mostly because of the WinPython Installation.
The source code only takes up about 1 MB.

I can download the file from github. Can you let me know what is the error?
I will attach the source code here.
However, you will need to download Python 3.6 or higher, and install the dependecies PyQt5, Pyperclip, Numpy and PIL and run Main.py.

If there are any other problems, let me know.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 14th, 2020, 5:27 am
by yujh
Thanks.
Can’t download error is really common in China.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 14th, 2020, 9:51 pm
by bubblegum
I'm working on a similar project known as eCA, with just one dependency: pygame

(and i've been working on this for two months and i just discovered this)
and it's not very complete, I mean it's just a black screen right now, but I'm trying to tie this closely to LifeViewer so kind of like the LV app that never will be

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 15th, 2020, 12:23 am
by lemon41625
Update v1.4
Added native support for .ca_rule - Option in Rule Opening Menu (Supports BSFKL, Outer Totalistic and Extended Generations).
Also hoping someone can help with writing transition func for isotropic non totalistic range 2 von neumann rules.
I am also looking for suggestions on how to identify rakes and replicators programatically.

Added New Rules:
AlternatingGenerations_Rule_2 has an oblique (1,4)c/6 Spaceship
Details of Rule_4 here: https://conwaylife.com/forums/viewtopic.php?f=11&t=4347

https://github.com/jedlimlx/Cellular-Automaton-Viewer

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 15th, 2020, 7:43 am
by bprentice
Please provide a version of your CA Simulator that runs on Windows 7.

Brian Prentice

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 15th, 2020, 8:45 am
by lemon41625
It should be compatible for Windows 7, I think. Can you let me know what the error is?

It also may be the WinPython Installation only working for Windows 10. If so, you will have to install Python 3.6 or higher with dependencies PyQt5, Pyperclip, Numpy and PIL.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 15th, 2020, 10:25 am
by bprentice
Since your software runs on Python 3.6 as stated here:

posting.php?f=9&mode=reply&t=4391&sid=e ... 91#pr93310

and Python 3.6 runs on Windows 7, please provide a Python 3.6 version of Wpy64-3770. Then both Windows 7 and Windows 10 will be conveniently supported.

Brian Prentice

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 15th, 2020, 10:56 am
by lemon41625
I will work on it.
However, it the software can run on Python 3.6 or higher.
The installation provided is Python 3.7.7 which can also run on Windows 7.

So for now, you can use the existing installation of Python 3.7.7.

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 15th, 2020, 2:06 pm
by bprentice
I tried your simulator again as you suggested and had some success. Yesterday I made the incorrect assumption that loading a pattern would first select the correct rule. This lead to many error messages. Today I first cleared the display, then loaded a rule and then loaded a pattern. I tried most of your patterns and they all seemed to work. You might want to update your user notes so that others don't make the same mistake that I did.

I look forward to following your progress as you continue to develop your software. Please write a note describing in detail what must be done to install a new version without having to reload WinPython and the required packages.

Brian Prentice

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 16th, 2020, 9:54 am
by lemon41625
Update v1.5:

Updated README.md to mention that loading a pattern does not load corresponding rule.
Added New Rule Interface to Generate Rules in .ca_rule format visually. (Will add generating random rules in this soon)
Fixed Bug in Random Soup Symmetries.
Added Error Message in when opening and loading rle if the number of states is incorrect.
Added Rules to Rule Folder

Note:
When there is a new update, unless I specify that the dependecies change, you can just replace source code.
There is no need to replace the WinPython Installation.

Source code is attached. Source with WinPython Installation can be found at https://github.com/jedlimlx/Cellular-Automaton-Viewer

Re: CAViewer - A Cellular Automaton Simulator written in Python

Posted: April 16th, 2020, 1:14 pm
by bprentice
Your 'number of states is incorrect' error message is displayed by simply loading rule '../Others/Rule_4' and then loading a pattern from that rule. To determine what is happening do the following:

After a request is made to load a rule, write the name of the requested rule together with its number of states to the cmd window.

After a request is made to load a pattern, write the name of the requested pattern together with the required number of states and the name of the current rule and the current number of states to the cmd window.

Brian Prentice