CellArray format and UnrealScript generator

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

CellArray format and UnrealScript generator

Post by Gustavo6046 » July 16th, 2015, 2:22 pm

The CellArray format was created to complement (and maybe replace) the RLE format due to the following perks:
  • -Compatible to C-branch languages like UnrealScript due to the implementation of variables;
    -Resembles XML and can be converted to it;
    -Easy to be written by other scripts, in XML or original format;
    -Occupies more space, but who cares?
The following is a glider in CellArray:

Code: Select all

CellArray1.0(Name=Glider Discoverer=* DiscoverYear=1980 TopLeft=-1,1 Size=3,3)
{
truecells=(X2Y3,X1Y2,X1Y1,X2Y1,X3Y1,), falsecells=(X1Y3,X3Y3,X2Y2,X3Y2)
}
The Truecells lists the locations with alive cells inside the Size=x,y bounding box, the optional Falsecells list the locations which are not. Falsecells is used when Size is not informed (i.e. Size=*,*).
In XML it would look like that:

Code: Select all

<CellArray version="1.0" name="Glider" discoverer="*" discoveryear="1980" topleft="-1,1" size="3,3">
 <truecells locations="X2Y3, X1Y2, X1Y1, X2Y1, X3Y1" />
 <falsecells locations="X3Y1, X3Y3, X2Y2, X3Y2" />
</CellArray>
You can even group patterns in XML to make the called "pattern collection" for many multi-pattern purposes.

I also built a UnrealScript program (in GitHub) which implements CellArray in UnrealScript and, according to description, "emphasizes the UnrealScript 1.0's added compatibility to CellArray-coded patterns using structs".
The name suggests it converts from some other format to CellArray, because my initial project was an RLE to CellArray converter, but seeing the difficulty on it, decided just to make an app with some functions to do what was said above.

User avatar
The Turtle
Posts: 102
Joined: May 6th, 2015, 8:14 pm
Location: Chicago, Illinois

Re: CellArray format and UnrealScript generator

Post by The Turtle » July 16th, 2015, 2:44 pm

Isn't this like Life 1.06?
Some tips:
You don't need TopLeft. Just add the TopLeft x-coordinate to all of truecells x-coordinates, and add the TopLeft y-coordinate to all of truecells y-coordinates.
Some questions:
What is Size for?
Doesn't space matter? This format will not work well with highly-populated, dense, patterns. The pattern also takes longer to load for those type of patterns.
Why do you need falsecells? Isn't falsecells just the list of cells not in truecells?

Anyway, it's not a bad idea.
Only two things are constant: change and the speed of light.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: CellArray format and UnrealScript generator

Post by Gustavo6046 » July 16th, 2015, 2:58 pm

The Turtle wrote:Isn't this like Life 1.06?
Some tips:
You don't need TopLeft. Just add the TopLeft x-coordinate to all of truecells x-coordinates, and add the TopLeft y-coordinate to all of truecells y-coordinates.
Some questions:
What is Size for?
Doesn't space matter? This format will not work well with highly-populated, dense, patterns. The pattern also takes longer to load for those type of patterns.
Why do you need falsecells? Isn't falsecells just the list of cells not in truecells?

Anyway, it's not a bad idea.
I never saw Life 1.06, but it might be some kind of 1.06 adapted for XML.
Falsecells is metadata, topleft determines the position of the pattern in relation to the center of the grid (topleft if it is centered in the grid), offset (pertains to CellArray 1.01) determines the position of the cell anywhere in the grid (only used when the pattern isn't in the center, i.e. when it must be positioned in the grid instead of just defining a pattern, is the difference between the actual top left cell of its current position and the top left cell when centered in the grid) and the Size's use is to determine the pattern's bottomleft position by subtracting the topleft's Y by size's Y. Why? Because the cell locations are relative to the bottomleft position.
If there is no truecells, then falsecells assume instead. It can save memory in cases where more cells are alive, you only determine the ones that aren't thus saving space.

User avatar
The Turtle
Posts: 102
Joined: May 6th, 2015, 8:14 pm
Location: Chicago, Illinois

Re: CellArray format and UnrealScript generator

Post by The Turtle » July 16th, 2015, 3:07 pm

Gustavo6046 wrote:I never saw Life 1.06, but it might be some kind of 1.06 adapted for XML.
Check the wiki on "Life 1.06".
Only two things are constant: change and the speed of light.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: CellArray format and UnrealScript generator

Post by Gustavo6046 » July 17th, 2015, 12:21 pm

The Turtle wrote:
Gustavo6046 wrote:I never saw Life 1.06, but it might be some kind of 1.06 adapted for XML.
Check the wiki on "Life 1.06".
Ok, it is different. Instead of showing the locations with markers, CellArray uses an list of coordinates of the cells true or false. You don't need falsecells, it is purely metadata.
Wait, Life 1.06 is also a list! But this one actually is designed to work with non-Python, non-Perl languages and XML as well, so it outdoes.

Post Reply