ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

My own Simulator with Layers

For general discussion about Conway's Game of Life.

My own Simulator with Layers

Postby Hawk » June 1st, 2018, 5:07 am

Hello Community,

I would like to share with you the simulator of Game of Life I created (for my bachelor thesis :roll: ). It is a Java desktop application using JavaFX on UI. As such, you would need JRE (http://www.oracle.com/technetwork/java/javase/downloads/jre10-downloads-4417026.html) to run it.

Here is the link to the zipped jar, it is too big to put into an attachment:
https://drive.google.com/open?id=1dyXlWvEsIaeqGuL3FJuGC5474jlLIanV

The main focus of this simulator is to visualise multiple (up to 4 for graphic reasons) independent layers of simulation in parallel on a finite grid. Each layer can have a different modification regarding the connections of grid edges or overlapping of corners. The layers are differentiated with colours. There is tracking of the current population of each layer and the current generation in the evolution.

The simulation can store a history of previous steps, the capacity can be adjusted. Using this history, you can step backwards. Furthermore, you can adjust the step size and currently used rule of the simulation. There is a possibility to create a random soup, import RLE file into every layer, or export each layer individually (RLE).

There is a function to benchmark the current configuration (including every layer, step size, rule, ...) with the use of the history. The benchmark tries to run until every layer has been stabilised, i.e. an identical copy of the current pattern is found in the history (disregarding absolute position). Additionally, you could choose to benchmark an initial random soup and to run multiple iterations.
The benchmark result is stored as a .tsv file in the /benchmark directory. You can merge a single or multiple benchmark files into a set of statistics stored in the /statistics directory.


I would really appreciate if somebody (experienced or not) looked into my creation and rate it (if possible ASAP). I am looking forward to any remarks or suggestions anyone would have.

P.S.: I will probably publish the source code and javadocs later.
Hawk
 
Posts: 5
Joined: June 1st, 2018, 4:22 am

Re: My own Simulator with Layers

Postby Redstoneboi » June 1st, 2018, 6:41 am

could you program oscillation detect and object identification too?
c(>^x^<c)~
This is Fluffy the cat.
Fluffy wants to discover new things that everyone likes.
Fluffy likes to watch spaceship guns in Golly.

There’s one problem,

Fluffy doesn’t exist :(
User avatar
Redstoneboi
 
Posts: 283
Joined: May 14th, 2018, 3:57 am

Re: My own Simulator with Layers

Postby Hawk » June 1st, 2018, 7:01 am

The benchmark does detect oscillation by checking, whether the current pattern is in the history (the pattern is extracted in the bounding box). The period is determined by how far in history it has occurred.

So a block will be found 1 steps in history = period of 1 = still life.
Glider will move in some direction, and after 4 steps it will find an identical pattern in a bounding box regardless of absolute position. The period will be the 4 steps backwards in history.

As of individual object identification, probably there would be a way somehow, although I do not see any simple way straight away with my current implementation. Maybe I could try, but it won't be very soon.

How exactly do you expect this object identification to work like? F.e. in an ash I would determine how many blinkers, blocks, etc. there is?

P.S.: I have just noticed that something does not work in the JAR as opposed to running it from my IDE. WIP.
Hawk
 
Posts: 5
Joined: June 1st, 2018, 4:22 am

Re: My own Simulator with Layers

Postby Macbi » June 1st, 2018, 7:07 am

Can someone help me run it? I'm trying the following command:
~/Downloads$ java -jar ./GameOfLifeProj.jar
Error: Could not find or load main class sk.tuke.bp.szegedi.app.main.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
User avatar
Macbi
 
Posts: 501
Joined: March 29th, 2009, 4:58 am

Re: My own Simulator with Layers

Postby Hawk » June 1st, 2018, 7:51 am

I have uploaded an updated version of the JAR to the drive. The JAR was missing one dependency (benchmark was crashing).

@Macbi Please try the new JAR and make sure you have Java 9+ (cmd: java -version). Missing javafx/application/Application looks like you do not even have Java 8.
Hawk
 
Posts: 5
Joined: June 1st, 2018, 4:22 am

Re: My own Simulator with Layers

Postby Macbi » June 1st, 2018, 7:59 am

I tried again with the new .jar but I got the same error. Probably something wrong with my version or the fact I'm on Linux.
~$ java -version
openjdk version "10.0.1" 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Debian-4)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Debian-4, mixed mode)
Are other people getting it to work?
User avatar
Macbi
 
Posts: 501
Joined: March 29th, 2009, 4:58 am

Re: My own Simulator with Layers

Postby Hawk » June 1st, 2018, 8:20 am

Try something like this https://github.com/roikku/swift-explorer/issues/54
I had this too and solved it with manually installing OpenJFX:
sudo apt-get install openjfx

It turns out that default OpenJDK does not come with OpenJFX (JavaFX implementation) by default.


Java runs on JVM, it is platform independent, so there should be no problems with Linux per se. The problem will be, that in standard JRE you have JavaFX packed, but apparently not so in OpenJDK.

BTW my java -version:
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
Hawk
 
Posts: 5
Joined: June 1st, 2018, 4:22 am

Re: My own Simulator with Layers

Postby Redstoneboi » June 1st, 2018, 8:29 am

i think with object detecton you just have to find some live cells that are at most 1 cell apart.

this definition counts strict still lives with more than 1 island such as the aircraft carrier:
x = 3 y = 1 rule = B3/S23
2o$o2bo$2b2o!

by this definition pseudo still lives are objects of their own.

maybe add something that checks if separating an island changes its shape, to count only strict still lives?
if a birth or a death occurs in the separated islands that does not occur in the normal pattern, it’s a strict still life:
x = 2 y = 2 rule = B3/S23
2o$o!


the upper left island is not a still life, so the aircraft carrier is a strict still life, despite having 2 islands.
this would eliminate the block on block, where if you separate the 2 islands, it remains a block.
c(>^x^<c)~
This is Fluffy the cat.
Fluffy wants to discover new things that everyone likes.
Fluffy likes to watch spaceship guns in Golly.

There’s one problem,

Fluffy doesn’t exist :(
User avatar
Redstoneboi
 
Posts: 283
Joined: May 14th, 2018, 3:57 am

Re: My own Simulator with Layers

Postby Macbi » June 4th, 2018, 2:20 pm

Now that I've got it to work, this is a really neat program. I wish the speed could be turned up bit higher though. Is 20 as fast as it can calculate or is it just an arbitrary limit?

It's fun to set four differently shaped universes going with the same initial pattern and watch as they slowly decouple.
User avatar
Macbi
 
Posts: 501
Joined: March 29th, 2009, 4:58 am

Re: My own Simulator with Layers

Postby Hawk » June 4th, 2018, 6:07 pm

Well the speed limitation choice was not completely random. I did not want to allow the user to easily cycle, thus shut down the app. Internally, the basic interval is 50ms and the speed is altered by multiplying this speed by a coeficient. 50ms translates to 20gen/s.

However this is not an absolute limitation. I tried out different speeds on my PC and set 20 gen/s as a "fast enough for 4 layer and a moderate grid size" but with lesser interval it started to lag. If I choose on my PC 4 layers and say a grid 300x300 there is a problem even with the 1gen/s speed.

The main bottleneck is that the grid has to be rendered on the UI each generation. The rendering is way slower than the evolution computation itself. The currently accepted workaround is to change the step size to a larger number, which means, that the grid is rendered only that often. Pick a reasonable number, setting it to something high would prolong the computation of one iteration longer than the speed evolution period is, which would result in trying to calculate new generation when the current is not yet computed. What happens is callback hell, callbacks stacking on each other. Utlimately, the UI freezes and you cannot control it.

An other aspect is, that I tried it only on my computer, and if you have a beast, you could certainly do higher speeds. This is not much of a change in the code really. But try setting a larger step size first.

PROJECT UPDATE: I updated the jar to the latest version and also included JavaDoc.
Hawk
 
Posts: 5
Joined: June 1st, 2018, 4:22 am

Re: My own Simulator with Layers

Postby Redstoneboi » June 4th, 2018, 10:48 pm

Hawk wrote:The main bottleneck is that the grid has to be rendered on the UI each generation. The rendering is way slower than the evolution computation itself.


Have you tried zooming into specific parts of a pattern, and only rendering areas within the zoom region?
c(>^x^<c)~
This is Fluffy the cat.
Fluffy wants to discover new things that everyone likes.
Fluffy likes to watch spaceship guns in Golly.

There’s one problem,

Fluffy doesn’t exist :(
User avatar
Redstoneboi
 
Posts: 283
Joined: May 14th, 2018, 3:57 am

Re: My own Simulator with Layers

Postby Macbi » June 5th, 2018, 3:44 am

Ah yes, I forgot about the step-size setting. Why not add a slider for it next to speed?
User avatar
Macbi
 
Posts: 501
Joined: March 29th, 2009, 4:58 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests