Problem with Scratch CA script

Has something gone haywire? Let us know about it!
Post Reply
User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Problem with Scratch CA script

Post by gameoflifemaniac » March 2nd, 2018, 12:52 pm

This was supposed to be a script that can run any B/S rule on a closed 19*19 grid.
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
rowett
Moderator
Posts: 3776
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: Problem with Scratch CA script

Post by rowett » March 2nd, 2018, 1:18 pm

gameoflifemaniac wrote:This was supposed to be a script that can run any B/S rule on a closed 19*19 grid.
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?
Interesting stuff...

The first problem I found is that you need to set the pen colour before updating the grid at the end.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 2nd, 2018, 2:18 pm

rowett wrote:
gameoflifemaniac wrote:This was supposed to be a script that can run any B/S rule on a closed 19*19 grid.
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?
Interesting stuff...

The first problem I found is that you need to set the pen colour before updating the grid at the end.
Idk
Even if I fixed this script, it would be painfully slow. This prototype was actually an attempt to fix an issue that occured in my first prototype, because that one was the SECOND. The first is much faster, because the square doesn't have to move to the neighboring cells and check if it's touching grey. Instead, it checks the value of item for example cell#+1 or cell#-20 or cell+19. But something weird happens at the edge. If you draw something, you'll find out why.
Here's the script:
https://scratch.mit.edu/projects/207380010/
But I found out how to fix that. I just have to not allow the neighbor count to increase by 1 in special cases. For example:
if item(cell#-1)of pattern = 1 and not(cell# mod 19 = 1) then
change neighbor count by 1
That means that if the cell that the square is checking is on the left edge, the cell cell#-1 (which is on the right edge one line above), won't be taken into account. But I'm too lazy to do this now :lol:
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
BlinkerSpawn
Posts: 1992
Joined: November 8th, 2014, 8:48 pm
Location: Getting a snacker from R-Bee's

Re: Problem with Scratch CA script

Post by BlinkerSpawn » March 2nd, 2018, 6:03 pm

I believe it's wrapping horizontally and vertically but not both at once for corner cases.
LifeWiki: Like Wikipedia but with more spaceships. [citation needed]

Image

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 3rd, 2018, 2:55 am

Ok, I added the neighborhood exceptions. The third prototype is here:
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Problem with Scratch CA script

Post by 77topaz » March 3rd, 2018, 5:24 am

gameoflifemaniac wrote:Ok, I added the neighborhood exceptions. The third prototype is here:
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!
Additionally, the corners of the box break when you try a B0 rule.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 3rd, 2018, 9:37 am

77topaz wrote:
gameoflifemaniac wrote:Ok, I added the neighborhood exceptions. The third prototype is here:
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!
Additionally, the corners of the box break when you try a B0 rule.
What I did do wrong?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 3rd, 2018, 1:12 pm

GG
I did the script!!!
https://scratch.mit.edu/projects/207527992/
It seems to work, and it's only lite because it does only one main feature: calculating the pattern. The full version will contain a population counter and a rule displayer and will be released soon. Maybe I will make the grid bigger...
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Problem with Scratch CA script

Post by 77topaz » March 3rd, 2018, 3:56 pm

gameoflifemaniac wrote:GG
I did the script!!!
https://scratch.mit.edu/projects/207527992/
It seems to work, and it's only lite because it does only one main feature: calculating the pattern. The full version will contain a population counter and a rule displayer and will be released soon. Maybe I will make the grid bigger...
Now, instead of just breaking at the corners for B0 rules, it breaks all along the edges. :P

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 3rd, 2018, 5:01 pm

77topaz wrote:
gameoflifemaniac wrote:GG
I did the script!!!
https://scratch.mit.edu/projects/207527992/
It seems to work, and it's only lite because it does only one main feature: calculating the pattern. The full version will contain a population counter and a rule displayer and will be released soon. Maybe I will make the grid bigger...
Now, instead of just breaking at the corners for B0 rules, it breaks all along the edges. :P
This is normal. It's a closed grid.
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Problem with Scratch CA script

Post by 77topaz » March 3rd, 2018, 5:05 pm

gameoflifemaniac wrote:This is normal. It's a closed grid.
But wouldn't it make more sense to have the edges automatically stay in the right state, as they would if the entire universe were "strobing"?

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 3rd, 2018, 5:08 pm

77topaz wrote: But wouldn't it make more sense to have the edges automatically stay in the right state, as they would if the entire universe were "strobing"?
What do you mean? They do!
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Problem with Scratch CA script

Post by 77topaz » March 3rd, 2018, 5:13 pm

gameoflifemaniac wrote:
77topaz wrote: But wouldn't it make more sense to have the edges automatically stay in the right state, as they would if the entire universe were "strobing"?
What do you mean? They do!
No, the cells at the edges don't act as if the entire universe were strobing. For example, try B012345678/S5. The edges in this rule should simply strobe, but they remain alive at the transition from a live background to a dead one, because the simulator treats them as if they have five live neighbours rather than eight. Thus, it is clear that this simulator treats every cell outside the box as always dead, even for B0 rules where they should strobe.
Last edited by 77topaz on March 3rd, 2018, 6:41 pm, edited 1 time in total.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 3rd, 2018, 5:34 pm

77topaz wrote:
gameoflifemaniac wrote: What do you mean? They do!
No, the cells at the edges don't act as if the entire universe were strobing. For example, try B012345678/S5. The edges in this rule should simply strobe, but they remain alive at the transition from a live background to a dead one, because the simulator treats them as if they have five live neighbours rather than eight. Thus, it is clear that this simulator treats every cell outside the box as always dead, even for B0 rules were they should strobe.
Ahh... But it runs the same as in Golly. If you run the rule R1, C0, S5..5, B0..8, NM:P19,19 (B012345678/S5:P19,19),
it would behave just as in the script.
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

fluffykitty
Posts: 1175
Joined: June 14th, 2014, 5:03 pm
Contact:

Re: Problem with Scratch CA script

Post by fluffykitty » March 3rd, 2018, 5:46 pm

Well, what do you want to do?

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 4th, 2018, 6:27 am

fluffykitty wrote:Well, what do you want to do?
In what sense?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 4th, 2018, 8:40 am

Btw, here's the complete script.
https://scratch.mit.edu/projects/209098001/
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 23rd, 2018, 1:39 pm

I'm working on a function that copies the pattern into RLE format. But it works only for one-cell thick patterns. For other patterns it never stops the calculation! Help!
Last edited by gameoflifemaniac on March 23rd, 2018, 1:45 pm, edited 1 time in total.
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
BlinkerSpawn
Posts: 1992
Joined: November 8th, 2014, 8:48 pm
Location: Getting a snacker from R-Bee's

Re: Problem with Scratch CA script

Post by BlinkerSpawn » March 23rd, 2018, 1:44 pm

gameoflifemaniac wrote:I'm working on a function that copies the pattern into RLE format. But it works only for one-cell thick patterns! Help!
Your script should be inserting a '$' at the end of each row to indicate a new row.
LifeWiki: Like Wikipedia but with more spaceships. [citation needed]

Image

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: Problem with Scratch CA script

Post by gameoflifemaniac » March 23rd, 2018, 4:18 pm

BlinkerSpawn wrote:
gameoflifemaniac wrote:I'm working on a function that copies the pattern into RLE format. But it works only for one-cell thick patterns! Help!
Your script should be inserting a '$' at the end of each row to indicate a new row.
I mean, read my post once again, because I edited it.
EDIT: I figured out how to fix it.
EDIT: Fixed!
EDIT: The link to the script is now different.
https://scratch.mit.edu/projects/213417388/
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

Post Reply