Scratch app for illustrating 2x2 Moore neighborhood tiles

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
pcallahan
Posts: 845
Joined: April 26th, 2013, 1:04 pm

Scratch app for illustrating 2x2 Moore neighborhood tiles

Post by pcallahan » July 14th, 2021, 1:33 pm

This is more of a toy than a script. It's unlikely be useful in finding anything new, but it does provide a visualization of neighborhood counts. I have played around with it a little. My personal goal is to improve my intuition about small Life patterns.

Here is a link to the Scratch app.

It started out as a way to get around the fact that printing tiles described in this thread on magnetic sheets is a lot to ask of anyone.

I have printed three styles of these tiles and tried them out on a whiteboard to build still lifes. Since I sometimes run out of tiles, it also helps to have a virtual environment where I never run out (though I do run out of virtual whiteboard).

The main features of this app are the ability to create new tiles, position them (with automatic snap to grid), rotate them in place, and change tile type. There is also a way to cycle between four styles of tiles. I set the default to be one with contoured boundaries. There is a clumsy "upload/download" feature for tile layouts that uses copy-pasted text. It's the best I could manage in Scratch.

In the lower left corner, there is a picture of a glider. It is not documented, and is intended as an easter egg of sorts. Clicking on it turns on the ability to toggle live cells by pressing 't' (placing tiles appropriately) and perform a single CGoL generation by pressing 'g'.

Note: the goal of this app is to simulate something that can be done by hand with physical tiles, so the above goes against the whole point. However, it is a lot easier to enter patterns this way, and also possible to verify that a pattern is a still life (but there's no undo if it's not).

Here's a glider-block collision shown with tiles.
gliderblock.png
gliderblock.png (1.56 MiB) Viewed 1454 times
You might ask "Why Scratch?" (a learning language aimed at kids). It comes down to a tradeoff between what I know how to program in and what is sharable online (since Java applets are no longer an option). My first thought was to develop something in Unity 2D, but that isn't sharable.

Scratch is OK for the simplest features. It took some shoehorning to implement a Life rule, though. I use sorted lists of cell coordinates as the data structure, and I implement sort using a quadratic selection sort algorithm. That can all be found in the code section of the glider sprite.

ColorfulGabrielsp138
Posts: 288
Joined: March 29th, 2021, 5:45 am

Re: Scratch app for illustrating 2x2 Moore neighborhood tiles

Post by ColorfulGabrielsp138 » July 15th, 2021, 5:49 am

Sorry, they had banned Scratch. Maybe you could post an attachment?

Code: Select all

x = 21, y = 21, rule = LifeColorful
11.E$10.3E$10.E.2E$13.E4$2.2B$.2B$2B$.2B15.2D$19.2D$18.2D$17.2D4$7.C$
7.2C.C$8.3C$9.C!
I have reduced the glider cost of quadratic growth to eight and probably to seven. Looking for conduits...

User avatar
pcallahan
Posts: 845
Joined: April 26th, 2013, 1:04 pm

Re: Scratch app for illustrating 2x2 Moore neighborhood tiles

Post by pcallahan » July 15th, 2021, 9:55 am

ColorfulGabrielsp138 wrote:
July 15th, 2021, 5:49 am
Sorry, they had banned Scratch. Maybe you could post an attachment?
Really? Why is Scratch banned? I am not sure what kind of attachment would help. Here's a link to the downloaded Scratch file. https://drive.google.com/file/d/1mRJlPJ ... sp=sharing

It can be run offline by downloading the app described here: https://scratch.mit.edu/download If that's blocked, then do a search with keywords scratch app. For example, it is available through the Apple store here: https://apps.apple.com/us/app/scratch/i ... 5996?mt=12

That's a lot of trouble to go through and what I had hoped to avoid, e.g. if I had implemented it in Unity 2D.

User avatar
yujh
Posts: 3066
Joined: February 27th, 2020, 11:23 pm
Location: I'm not sure where I am, so please tell me if you know
Contact:

Re: Scratch app for illustrating 2x2 Moore neighborhood tiles

Post by yujh » July 15th, 2021, 10:43 am

pcallahan wrote:
July 15th, 2021, 9:55 am
Snip
Oh my goodness? You don’t know google is banned? There is a scratch download from windows itself that is working. Probably just attach it to a post or send it into GitHub?
Rule modifier

B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7

Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!

User avatar
pcallahan
Posts: 845
Joined: April 26th, 2013, 1:04 pm

Re: Scratch app for illustrating 2x2 Moore neighborhood tiles

Post by pcallahan » July 15th, 2021, 11:16 am

yujh wrote:
July 15th, 2021, 10:43 am
pcallahan wrote:
July 15th, 2021, 9:55 am
Snip
Oh my goodness? You don’t know google is banned? There is a scratch download from windows itself that is working. Probably just attach it to a post or send it into GitHub?
Sorry. I wasn't sure where the first reply was posted from. Does this work? https://github.com/PaulBC/grid-sat-solv ... 0Tiles.sb3

(I also linked the printable tile sheets on Google drive, because that's how I link everything. Maybe that's a mistake.)

----------------------------------

Update: As noted, the Scratch app can display in different styles. I find the one with diamond and explicit adjacency lines easiest to check visually (i.e. for still life violations). However the earlier one that shows dots arranged as surrounding cells is less gimmicky and shows the Moore neighborhood without imposing any symmetry. Being able to switch between may be useful (though again it doesn't help much if you are using physical tiles, or at least requires significantly more effort). Here they are for comparison.
Screen Shot 2021-07-15 at 11.00.00 AM.png
Screen Shot 2021-07-15 at 11.00.00 AM.png (186.49 KiB) Viewed 1373 times
Screen Shot 2021-07-15 at 10.59.48 AM.png
Screen Shot 2021-07-15 at 10.59.48 AM.png (242.86 KiB) Viewed 1373 times
Here is what you would copy into the "upload" box to see the above in the Scratch app.

Code: Select all

1 -117 -91 0 2 -117 -65 0 1 -117 -39 90 2 -91 -91 -90 4 -91 -65 -90 3 -91 -39 -90 1 -91 -13 90 1 -91 65 0 1 -91 91 90 1 -65 -91 -90 1 -65 -65 180 2 -65 -39 -90 2 -65 -13 90 1 -65 39 0 3 -65 65 0 3 -65 91 -90 1 -65 117 90 1 -39 -65 0 4 -39 -39 90 2 -39 -13 90 1 -39 13 0 3 -39 39 0 3 -39 65 -90 3 -39 91 0 1 -39 117 180 2 -13 -65 -90 4 -13 -39 -90 1 -13 -13 180 2 -13 13 -90 2 -13 39 90 1 -13 65 -90 1 -13 91 180 1 13 -65 -90 3 13 -39 -90 2 13 -13 0 4 13 13 90 2 13 39 90 1 39 -39 -90 2 39 -13 180 2 39 13 180 1 39 39 180 1 65 -39 0 2 65 -13 0 2 65 13 0 1 65 39 90 1 91 -65 0 3 91 -39 0 2 91 -13 180 2 91 13 180 3 91 39 -90 1 91 65 90 2 117 -65 -90 4 117 -39 180 1 117 -13 90 1 117 13 0 4 117 39 90 2 117 65 90 1 143 -65 -90 2 143 -39 180 1 143 -13 180 1 143 13 -90 2 143 39 180 1 143 65 180

Post Reply